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 <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10247
Reviewed By: CCR-4429
Testing Done: Manual verification
This commit is contained in:
vivek 2016-04-06 14:07:05 -07:00
parent 04c4401239
commit 154caaed00
2 changed files with 19 additions and 15 deletions

View File

@ -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. */

View File

@ -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)
{