if (rmap_name)
ret = zebra_import_table_route_map_check(
afi, re->type, re->instance, &rn->p,
- re->nhe->nhg->nexthop,
+ re->nhe->nhg.nexthop,
zvrf->vrf->vrf_id, re->tag, rmap_name);
if (ret != RMAP_PERMITMATCH) {
newre->instance = re->table;
ng = nexthop_group_new();
- copy_nexthops(&ng->nexthop, re->nhe->nhg->nexthop, NULL);
+ copy_nexthops(&ng->nexthop, re->nhe->nhg.nexthop, NULL);
rib_add_multipath(afi, SAFI_UNICAST, &p, NULL, newre, ng);
prefix_copy(&p, &rn->p);
rib_delete(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_TABLE,
- re->table, re->flags, &p, NULL, re->nhe->nhg->nexthop,
+ re->table, re->flags, &p, NULL, re->nhe->nhg.nexthop,
re->nhe_id, zvrf->table_id, re->metric, re->distance,
false);
if (re->fib_ng.nexthop)
return &(re->fib_ng);
else
- return re->nhe->nhg;
+ return &(re->nhe->nhg);
}
extern void zebra_vty_init(void);
memcpy(&api.src_prefix, src_p, sizeof(api.src_prefix));
}
- for (nexthop = re->nhe->nhg->nexthop;
+ for (nexthop = re->nhe->nhg.nexthop;
nexthop; nexthop = nexthop->next) {
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
continue;
* nexthop we are looking up. Therefore, we will just iterate
* over the top chain of nexthops.
*/
- for (nexthop = re->nhe->nhg->nexthop; nexthop;
+ for (nexthop = re->nhe->nhg.nexthop; nexthop;
nexthop = nexthop->next)
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
num += zserv_encode_nexthop(s, nexthop);
/* Copy nexthops; recursive info is included too */
copy_nexthops(&(ctx->u.rinfo.zd_ng.nexthop),
- re->nhe->nhg->nexthop, NULL);
+ re->nhe->nhg.nexthop, NULL);
- /* Ensure that the dplane's nexthops flags are clear. */
+ /* Ensure that the dplane nexthops' flags are clear. */
for (ALL_NEXTHOPS(ctx->u.rinfo.zd_ng, nexthop))
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
ctx->u.rinfo.nhe.vrf_id = nhe->vrf_id;
ctx->u.rinfo.nhe.type = nhe->type;
- nexthop_group_copy(&(ctx->u.rinfo.nhe.ng), nhe->nhg);
+ nexthop_group_copy(&(ctx->u.rinfo.nhe.ng), &(nhe->nhg));
- /* If its a group, convert it to a grp array of ids */
+ /* If this is a group, convert it to a grp array of ids */
if (!zebra_nhg_depends_is_empty(nhe)
&& !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_RECURSIVE))
ctx->u.rinfo.nhe.nh_grp_count = zebra_nhg_nhe2grp(
if (re)
copy_nexthops(&(ctx->u.pw.nhg.nexthop),
- re->nhe->nhg->nexthop, NULL);
+ re->nhe->nhg.nexthop, NULL);
route_unlock_node(rn);
}
* We'll need these to do per-nexthop deletes.
*/
copy_nexthops(&(ctx->u.rinfo.zd_old_ng.nexthop),
- old_re->nhe->nhg->nexthop, NULL);
+ old_re->nhe->nhg.nexthop, NULL);
#endif /* !HAVE_NETLINK */
}
ri->rtm_type = RTN_UNICAST;
ri->metric = &re->metric;
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
if (ri->num_nhs >= zrouter.multipath_num)
break;
* the label advertised by the recursive nexthop (plus we don't have the
* logic yet to push multiple labels).
*/
- for (nexthop = re->nhe->nhg->nexthop;
+ for (nexthop = re->nhe->nhg.nexthop;
nexthop; nexthop = nexthop->next) {
/* Skip inactive and recursive entries. */
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
|| !CHECK_FLAG(match->flags, ZEBRA_FLAG_SELECTED))
continue;
- for (match_nh = match->nhe->nhg->nexthop; match_nh;
+ for (match_nh = match->nhe->nhg.nexthop; match_nh;
match_nh = match_nh->next) {
if (match->type == ZEBRA_ROUTE_CONNECT
|| nexthop->ifindex == match_nh->ifindex) {
break;
}
- if (!match || !match->nhe->nhg->nexthop)
+ if (!match || !match->nhe->nhg.nexthop)
return 0;
- nexthop->ifindex = match->nhe->nhg->nexthop->ifindex;
+ nexthop->ifindex = match->nhe->nhg.nexthop->ifindex;
return 1;
}
* We can't just change the values here since we are hashing
* on labels. We need to create a whole new group
*/
- nexthop_group_copy(&new_grp, re->nhe->nhg);
+ nexthop_group_copy(&new_grp, &(re->nhe->nhg));
found = false;
for (nexthop = new_grp.nexthop; nexthop; nexthop = nexthop->next) {
if (re == NULL)
return -1;
- nexthop_group_copy(&new_grp, re->nhe->nhg);
+ nexthop_group_copy(&new_grp, &(re->nhe->nhg));
for (nexthop = new_grp.nexthop; nexthop; nexthop = nexthop->next)
nexthop_del_labels(nexthop);
RNODE_FOREACH_RE (rn, re) {
struct nexthop_group new_grp = {};
- nexthop_group_copy(&new_grp, re->nhe->nhg);
+ nexthop_group_copy(&new_grp, &(re->nhe->nhg));
for (nexthop = new_grp.nexthop; nexthop;
nexthop = nexthop->next) {
}
/* Add the ifp now if its not a group or recursive and has ifindex */
- if (zebra_nhg_depends_is_empty(nhe) && nhe->nhg->nexthop
- && nhe->nhg->nexthop->ifindex) {
+ if (zebra_nhg_depends_is_empty(nhe) && nhe->nhg.nexthop
+ && nhe->nhg.nexthop->ifindex) {
struct interface *ifp = NULL;
- ifp = if_lookup_by_index(nhe->nhg->nexthop->ifindex,
- nhe->nhg->nexthop->vrf_id);
+ ifp = if_lookup_by_index(nhe->nhg.nexthop->ifindex,
+ nhe->nhg.nexthop->vrf_id);
if (ifp)
zebra_nhg_set_if(nhe, ifp);
else
flog_err(
EC_ZEBRA_IF_LOOKUP_FAILED,
"Zebra failed to lookup an interface with ifindex=%d in vrf=%u for NHE id=%u",
- nhe->nhg->nexthop->ifindex,
- nhe->nhg->nexthop->vrf_id, nhe->id);
+ nhe->nhg.nexthop->ifindex,
+ nhe->nhg.nexthop->vrf_id, nhe->id);
}
}
nhe->id = id;
- nhe->nhg = nexthop_group_new();
- nexthop_group_copy(nhe->nhg, copy->nhg);
+ nexthop_group_copy(&(nhe->nhg), &(copy->nhg));
nhe->vrf_id = copy->vrf_id;
nhe->afi = copy->afi;
nhe = zebra_nhg_copy(copy, copy->id);
/* Mark duplicate nexthops in a group at creation time. */
- nexthop_group_mark_duplicates(nhe->nhg);
+ nexthop_group_mark_duplicates(&(nhe->nhg));
zebra_nhg_connect_depends(nhe, copy->nhg_depends);
zebra_nhg_insert_id(nhe);
uint32_t key = 0x5a351234;
- key = jhash_3words(nhe->vrf_id, nhe->afi, nexthop_group_hash(nhe->nhg),
+ key = jhash_3words(nhe->vrf_id, nhe->afi,
+ nexthop_group_hash(&(nhe->nhg)),
key);
return key;
return false;
/* Nexthops should be sorted */
- for (nexthop1 = nhe1->nhg->nexthop, nexthop2 = nhe2->nhg->nexthop;
+ for (nexthop1 = nhe1->nhg.nexthop, nexthop2 = nhe2->nhg.nexthop;
nexthop1 || nexthop2;
nexthop1 = nexthop1->next, nexthop2 = nexthop2->next) {
if (nexthop1 && !nexthop2)
* in the kernel.
*/
- copy_nexthops(&nhg->nexthop, depend->nhg->nexthop, NULL);
+ copy_nexthops(&nhg->nexthop, depend->nhg.nexthop, NULL);
}
return 0;
lookup.id = id ? id : ++id_counter;
lookup.type = type ? type : ZEBRA_ROUTE_NHG;
- lookup.nhg = nhg;
+ lookup.nhg = *nhg;
lookup.vrf_id = vrf_id;
- if (lookup.nhg->nexthop->next) {
+ if (lookup.nhg.nexthop->next) {
/* Groups can have all vrfs and AF's in them */
lookup.afi = AFI_UNSPEC;
} else {
- switch (lookup.nhg->nexthop->type) {
+ switch (lookup.nhg.nexthop->type) {
case (NEXTHOP_TYPE_IFINDEX):
case (NEXTHOP_TYPE_BLACKHOLE):
/*
static void zebra_nhg_free_members(struct nhg_hash_entry *nhe)
{
- nexthop_group_delete(&nhe->nhg);
+ nexthops_free(nhe->nhg.nexthop);
+
/* Decrement to remove connection ref */
nhg_connected_tree_decrement_ref(&nhe->nhg_depends);
nhg_connected_tree_free(&nhe->nhg_depends);
if (match->type == ZEBRA_ROUTE_CONNECT) {
/* Directly point connected route. */
- newhop = match->nhe->nhg->nexthop;
+ newhop = match->nhe->nhg.nexthop;
if (newhop) {
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV6)
return 1;
} else if (CHECK_FLAG(re->flags, ZEBRA_FLAG_ALLOW_RECURSION)) {
resolved = 0;
- for (ALL_NEXTHOPS_PTR(match->nhe->nhg, newhop)) {
+ for (ALL_NEXTHOPS(match->nhe->nhg, newhop)) {
if (!CHECK_FLAG(match->status,
ROUTE_ENTRY_INSTALLED))
continue;
return resolved;
} else if (re->type == ZEBRA_ROUTE_STATIC) {
resolved = 0;
- for (ALL_NEXTHOPS_PTR(match->nhe->nhg, newhop)) {
+ for (ALL_NEXTHOPS(match->nhe->nhg, newhop)) {
if (!CHECK_FLAG(match->status,
ROUTE_ENTRY_INSTALLED))
continue;
UNSET_FLAG(re->status, ROUTE_ENTRY_CHANGED);
/* Copy over the nexthops in current state */
- nexthop_group_copy(&new_grp, re->nhe->nhg);
+ nexthop_group_copy(&new_grp, &(re->nhe->nhg));
for (nexthop = new_grp.nexthop; nexthop; nexthop = nexthop->next) {
if (!duplicate) {
grp[i].id = depend->id;
/* We aren't using weights for anything right now */
- grp[i].weight = depend->nhg->nexthop->weight;
+ grp[i].weight = depend->nhg.nexthop->weight;
i++;
}
PREDECL_RBTREE_UNIQ(nhg_connected_tree);
/*
- * Hashtables contiaining entries found in `zebra_router`.
+ * Hashtables containing nhg entries is in `zebra_router`.
*/
-
struct nhg_hash_entry {
uint32_t id;
afi_t afi;
vrf_id_t vrf_id;
int type;
- struct nexthop_group *nhg;
+ struct nexthop_group nhg;
/* If this is not a group, it
* will be a single nexthop
* Need to ensure that there's a label binding for all nexthops.
* Otherwise, ECMP for this route could render the pseudowire unusable.
*/
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
if (!nexthop->nh_label) {
if (IS_ZEBRA_DEBUG_PW)
zlog_debug("%s: unlabeled route for %s",
*/
void route_entry_copy_nexthops(struct route_entry *re, struct nexthop *nh)
{
- assert(!re->nhe->nhg->nexthop);
- copy_nexthops(&re->nhe->nhg->nexthop, nh, NULL);
+ assert(!re->nhe->nhg.nexthop);
+ copy_nexthops(&re->nhe->nhg.nexthop, nh, NULL);
}
static void route_entry_attach_ref(struct route_entry *re,
int ret = 0;
if (new == NULL) {
- re->nhe->nhg = NULL;
+ if (re->nhe)
+ zebra_nhg_decrement_ref(re->nhe);
+ re->nhe = NULL;
goto done;
}
if (re->nhe_id != new->id) {
- old = zebra_nhg_lookup_id(re->nhe_id);
+ old = re->nhe;
route_entry_attach_ref(re, new);
if (re->type != ZEBRA_ROUTE_BGP)
return 0;
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop))
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop))
if (!nexthop->nh_label || !nexthop->nh_label->num_labels)
return 0;
srcdest_rnode_prefixes(rn, &p, &src_p);
if (info->safi != SAFI_UNICAST) {
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop))
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop))
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
return;
}
/*
* Install the resolved nexthop object first.
*/
- zebra_nhg_install_kernel(zebra_nhg_lookup_id(re->nhe_id));
+ zebra_nhg_install_kernel(re->nhe);
/*
* If this is a replace to a new RE let the originator of the RE
if (info->safi != SAFI_UNICAST) {
UNSET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop))
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop))
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
return;
}
re->fib_ng.nexthop = NULL;
}
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop))
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop))
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
}
/* Update real nexthop. This may actually determine if nexthop is active
* or not. */
- if (!nexthop_group_active_nexthop_num(new->nhe->nhg)) {
+ if (!nexthop_group_active_nexthop_num(&(new->nhe->nhg))) {
UNSET_FLAG(new->status, ROUTE_ENTRY_CHANGED);
return;
}
/* Update the nexthop; we could determine here that nexthop is
* inactive. */
- if (nexthop_group_active_nexthop_num(new->nhe->nhg))
+ if (nexthop_group_active_nexthop_num(&(new->nhe->nhg)))
nh_active = 1;
/* If nexthop is active, install the selected route, if
/* both are connected. are either loop or vrf? */
struct nexthop *nexthop = NULL;
- for (ALL_NEXTHOPS_PTR(alternate->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(alternate->nhe->nhg, nexthop)) {
struct interface *ifp = if_lookup_by_index(
nexthop->ifindex, alternate->vrf_id);
return alternate;
}
- for (ALL_NEXTHOPS_PTR(current->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(current->nhe->nhg, nexthop)) {
struct interface *ifp = if_lookup_by_index(
nexthop->ifindex, current->vrf_id);
SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nhop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nhop)) {
if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;
|| !CHECK_FLAG(ctx_nexthop->flags, NEXTHOP_FLAG_ACTIVE))
ctx_nexthop = nexthop_next_active_resolved(ctx_nexthop);
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;
nhe = zebra_nhg_lookup_id(re->nhe_id);
if (nhe)
zebra_nhg_decrement_ref(nhe);
- } else if (re->nhe->nhg)
- nexthop_group_delete(&re->nhe->nhg);
+ } else if (re->nhe->nhg.nexthop)
+ nexthops_free(re->nhe->nhg.nexthop);
nexthops_free(re->fib_ng.nexthop);
"%s: metric == %u, mtu == %u, distance == %u, flags == %u, status == %u",
straddr, re->metric, re->mtu, re->distance, re->flags, re->status);
zlog_debug("%s: nexthop_num == %u, nexthop_active_num == %u", straddr,
- nexthop_group_nexthop_num(re->nhe->nhg),
- nexthop_group_active_nexthop_num(re->nhe->nhg));
+ nexthop_group_nexthop_num(&(re->nhe->nhg)),
+ nexthop_group_active_nexthop_num(&(re->nhe->nhg)));
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
struct interface *ifp;
struct vrf *vrf = vrf_lookup_by_id(nexthop->vrf_id);
if (re->type == ZEBRA_ROUTE_KERNEL && re->metric != metric)
continue;
if (re->type == ZEBRA_ROUTE_CONNECT &&
- (rtnh = re->nhe->nhg->nexthop)
+ (rtnh = re->nhe->nhg.nexthop)
&& rtnh->type == NEXTHOP_TYPE_IFINDEX && nh) {
if (rtnh->ifindex != nh->ifindex)
continue;
same = re;
break;
}
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, rtnh)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, rtnh)) {
/*
* No guarantee all kernel send nh with labels
* on delete.
if (allow_delete) {
UNSET_FLAG(fib->status, ROUTE_ENTRY_INSTALLED);
/* Unset flags. */
- for (rtnh = fib->nhe->nhg->nexthop; rtnh;
+ for (rtnh = fib->nhe->nhg.nexthop; rtnh;
rtnh = rtnh->next)
UNSET_FLAG(rtnh->flags,
NEXTHOP_FLAG_FIB);
if (CHECK_FLAG(flags, ZEBRA_FLAG_EVPN_ROUTE)) {
struct nexthop *tmp_nh;
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, tmp_nh)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, tmp_nh)) {
struct ipaddr vtep_ip;
memset(&vtep_ip, 0, sizeof(struct ipaddr));
* this decision needs to be revisited
*/
SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop))
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop))
SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB);
rib_uninstall_kernel(rn, re);
static void free_state(vrf_id_t vrf_id, struct route_entry *re,
struct route_node *rn);
-static void copy_state(struct rnh *rnh, struct route_entry *re,
+static void copy_state(struct rnh *rnh, const struct route_entry *re,
struct route_node *rn);
static int compare_state(struct route_entry *r1, struct route_entry *r2);
static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type,
struct nexthop *nexthop;
if (re) {
- for (nexthop = re->nhe->nhg->nexthop; nexthop;
+ for (nexthop = re->nhe->nhg.nexthop; nexthop;
nexthop = nexthop->next) {
UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_RNH_FILTERED);
}
route_map_result_t ret;
if (prn && re) {
- for (nexthop = re->nhe->nhg->nexthop; nexthop;
+ for (nexthop = re->nhe->nhg.nexthop; nexthop;
nexthop = nexthop->next) {
ret = zebra_nht_route_map_check(
afi, proto, &prn->p, zvrf, re, nexthop);
/* Just being SELECTED isn't quite enough - must
* have an installed nexthop to be useful.
*/
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
if (rnh_nexthop_valid(re, nexthop))
break;
}
break;
if (re->type == ZEBRA_ROUTE_NHRP) {
- for (nexthop = re->nhe->nhg->nexthop;
+ for (nexthop = re->nhe->nhg.nexthop;
nexthop;
nexthop = nexthop->next)
if (nexthop->type
XFREE(MTYPE_RE, re);
}
-static void copy_state(struct rnh *rnh, struct route_entry *re,
+static void copy_state(struct rnh *rnh, const struct route_entry *re,
struct route_node *rn)
{
struct route_entry *state;
state->status = re->status;
state->nhe = zebra_nhg_alloc();
- state->nhe->nhg = nexthop_group_new();
- nexthop_group_copy(state->nhe->nhg, re->nhe->nhg);
+ nexthop_group_copy(&(state->nhe->nhg), &(re->nhe->nhg));
rnh->state = state;
}
if (r1->metric != r2->metric)
return 1;
- if (nexthop_group_nexthop_num(r1->nhe->nhg)
- != nexthop_group_nexthop_num(r2->nhe->nhg))
+ if (nexthop_group_nexthop_num(&(r1->nhe->nhg))
+ != nexthop_group_nexthop_num(&(r2->nhe->nhg)))
return 1;
- if (nexthop_group_hash(r1->nhe->nhg) !=
- nexthop_group_hash(r2->nhe->nhg))
+ if (nexthop_group_hash(&(r1->nhe->nhg)) !=
+ nexthop_group_hash(&(r2->nhe->nhg)))
return 1;
return 0;
num = 0;
nump = stream_get_endp(s);
stream_putc(s, 0);
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nh))
+ for (ALL_NEXTHOPS(re->nhe->nhg, nh))
if (rnh_nexthop_valid(re, nh)) {
zapi_nexthop_from_nexthop(&znh, nh);
zapi_nexthop_encode(s, &znh, 0 /* flags */);
if (rnh->state) {
vty_out(vty, " resolved via %s\n",
zebra_route_string(rnh->state->type));
- for (nexthop = rnh->state->nhe->nhg->nexthop; nexthop;
+ for (nexthop = rnh->state->nhe->nhg.nexthop; nexthop;
nexthop = nexthop->next)
print_nh(nexthop, vty);
} else
return;
}
- if (in_addr_cmp((uint8_t *)&(*re)->nhe->nhg->nexthop->gate.ipv4,
- (uint8_t *)&re2->nhe->nhg->nexthop->gate.ipv4)
+ if (in_addr_cmp((uint8_t *)&(*re)->nhe->nhg.nexthop->gate.ipv4,
+ (uint8_t *)&re2->nhe->nhg.nexthop->gate.ipv4)
<= 0)
return;
(uint8_t *)&dest)) {
RNODE_FOREACH_RE (*np, *re) {
if (!in_addr_cmp((uint8_t *)&(*re)->nhe
- ->nhg->nexthop
+ ->nhg.nexthop
->gate.ipv4,
(uint8_t *)&nexthop))
if (proto
|| ((policy == policy2) && (proto == proto2)
&& (in_addr_cmp(
(uint8_t *)&re2->nhe
- ->nhg->nexthop->gate.ipv4,
+ ->nhg.nexthop->gate.ipv4,
(uint8_t *)&nexthop)
>= 0)))
check_replace(np2, re2, np, re);
{
struct nexthop *nexthop;
- nexthop = (*re)->nhe->nhg->nexthop;
+ nexthop = (*re)->nhe->nhg.nexthop;
if (nexthop) {
pnt = (uint8_t *)&nexthop->gate.ipv4;
for (i = 0; i < 4; i++)
if (!np)
return NULL;
- nexthop = re->nhe->nhg->nexthop;
+ nexthop = re->nhe->nhg.nexthop;
if (!nexthop)
return NULL;
if (show_ng)
vty_out(vty, " Nexthop Group ID: %u\n", re->nhe_id);
- for (ALL_NEXTHOPS_PTR(re->nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(re->nhe->nhg, nexthop)) {
char addrstr[32];
vty_out(vty, " %c%s",
if (is_fib)
nhg = rib_active_nhg(re);
else
- nhg = re->nhe->nhg;
+ nhg = &(re->nhe->nhg);
if (json) {
json_route = json_object_new_object();
json_object_int_add(json_route, "internalFlags",
re->flags);
json_object_int_add(json_route, "internalNextHopNum",
- nexthop_group_nexthop_num(re->nhe->nhg));
+ nexthop_group_nexthop_num(&(re->nhe->nhg)));
json_object_int_add(json_route, "internalNextHopActiveNum",
nexthop_group_active_nexthop_num(
- re->nhe->nhg));
+ &(re->nhe->nhg)));
if (uptime < ONE_DAY_SECOND)
sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
tm->tm_sec);
vty_out(vty, "\n");
}
- for (ALL_NEXTHOPS_PTR(nhe->nhg, nexthop)) {
+ for (ALL_NEXTHOPS(nhe->nhg, nexthop)) {
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
vty_out(vty, " ");
else
fib_cnt[ZEBRA_ROUTE_TOTAL]++;
fib_cnt[re->type]++;
}
- for (nexthop = re->nhe->nhg->nexthop; (!cnt && nexthop);
+ for (nexthop = re->nhe->nhg.nexthop; (!cnt && nexthop);
nexthop = nexthop->next) {
cnt++;
rib_cnt[ZEBRA_ROUTE_TOTAL]++;