diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index db8966ba7c..8492222ad8 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -3076,31 +3076,30 @@ rib_add_ipv6_multipath (struct prefix *p, struct rib *rib, safi_t safi, struct rib *same = NULL; struct nexthop *nexthop; int ret = 0; + int family; + + if (!rib) + return 0; + + if (p->family == AF_INET) + family = AFI_IP; + else + family = AFI_IP6; + + /* Lookup table. */ + table = zebra_vrf_table_with_table_id (family, safi, rib->vrf_id, rib->table); + if (! table) + return 0; if (p->family == AF_INET) { - if (!rib) - return 0; - - table = zebra_vrf_table (AFI_IP, safi, rib->vrf_id); - if (!table) - return 0; /* Make it sure prefixlen is applied to the prefix. */ apply_mask_ipv4 ((struct prefix_ipv4 *)p); } else { - if (!rib) - return 0; /* why are we getting called with NULL rib */ - - /* Lookup table. */ - table = zebra_vrf_table_with_table_id (AFI_IP6, safi, rib->vrf_id, rib->table); - if (! table) - return 0; - /* Make sure mask is applied. */ apply_mask_ipv6 ((struct prefix_ipv6 *)p); - } /* Set default distance by route type. */ diff --git a/zebra/zserv.c b/zebra/zserv.c index 6e275ffdad..94f437ee19 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -1412,6 +1412,9 @@ zread_ipv4_route_ipv6_nexthop_add (struct zserv *client, u_short length, vrf_id_ p.prefixlen = stream_getc (s); stream_get (&p.prefix, s, PSIZE (p.prefixlen)); + /* VRF ID */ + rib->vrf_id = vrf_id; + /* We need to give nh-addr, nh-ifindex with the same next-hop object * to the rib to ensure that IPv6 multipathing works; need to coalesce * these. Clients should send the same number of paired set of @@ -1608,7 +1611,9 @@ zread_ipv6_add (struct zserv *client, u_short length, vrf_id_t vrf_id) else rib->tag = 0; + /* VRF ID */ rib->vrf_id = vrf_id; + /* Table */ if (vrf_id) {