]> git.puffer.fish Git - mirror/frr.git/commitdiff
Zebra: Fix VRF-id and table for BGP unnumbered (RFC 5549)
authorvivek <vivek@cumulusnetworks.com>
Wed, 6 Apr 2016 21:07:05 +0000 (14:07 -0700)
committervivek <vivek@cumulusnetworks.com>
Wed, 6 Apr 2016 21:07:05 +0000 (14:07 -0700)
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

zebra/zebra_rib.c
zebra/zserv.c

index db8966ba7cdc8de05d00c29098154213fcb4c6ba..8492222ad810cac959649ea3e2a8e17d39075fe8 100644 (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)
-    {
-      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. */
index 6e275ffdad4fee88ecb7007457abcf216739a796..94f437ee196ab9e76ff79c60950fed3b98848286 100644 (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)
     {