From: vivek Date: Wed, 6 Apr 2016 21:07:05 +0000 (-0700) Subject: Zebra: Fix VRF-id and table for BGP unnumbered (RFC 5549) X-Git-Tag: frr-2.0-rc1~989^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=154caaed00f7a00acf89375ae6fd4b24d5f47811;p=mirror%2Ffrr.git Zebra: Fix VRF-id and table for BGP unnumbered (RFC 5549) In the case of BGP unnumbered RFC 5549 (IPv4 routes with IPv6 nexthop), the zebra code to handle routes was not initializing the correct VRF id and locating the correct routing table, resulting in the routes not getting installed. Fixed with this change. Signed-off-by: Vivek Venkatraman Reviewed-by: Donald Sharp Ticket: CM-10247 Reviewed By: CCR-4429 Testing Done: Manual verification --- 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) - { - if (!rib) - return 0; + family = AFI_IP; + else + family = AFI_IP6; - table = zebra_vrf_table (AFI_IP, safi, rib->vrf_id); - if (!table) - return 0; + /* 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) + { /* 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) {