]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Fix change of distance on ipv6 route creating duplicate routes
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 23 Oct 2015 02:10:54 +0000 (19:10 -0700)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 24 Oct 2015 00:48:27 +0000 (17:48 -0700)
If you enter:

ipv6 route 2002:44:44:44::44/128 swp1 4
ipv6 route 2002:44:44:44::44/128 swp1 99

You get:

host-111# show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S 2002:44:44:44::44/128 [99/0] is directly connected, swp1
S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1

This problem is fixed in the ipv4 code path.  Copying the same
code from the ipv4 into the ipv6 code path fixes the issue.

With the fix:

host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 4
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
       > - selected route, * - FIB route

S>* 2002:44:44:44::44/128 [4/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)# ipv6 route 2002:44:44:44::44/128 swp1 99
host-111(config)# do show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
       > - selected route, * - FIB route

S>* 2002:44:44:44::44/128 [99/0] is directly connected, swp1
C * fe80::/64 is directly connected, swp1
C>* fe80::/64 is directly connected, eth0
host-111(config)#

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_rib.c

index fcccbc58c1e40f79cb7d0b3529a9dea303dd4579..94a63152929b0e1658fcff7559e470106dc2ab68 100644 (file)
@@ -3606,9 +3606,9 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
   struct static_route *si;
   struct static_route *pp;
   struct static_route *cp;
+  struct static_route *update = NULL;
   struct route_table *stable;
 
-
   /* Lookup table.  */
   stable = vrf_static_table (AFI_IP6, SAFI_UNICAST, vrf_id);
   if (! stable)
@@ -3628,17 +3628,24 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
   /* Do nothing if there is a same static route.  */
   for (si = rn->info; si; si = si->next)
     {
-      if (distance == si->distance 
-         && type == si->type
-         && tag == si->tag
+      if (type == si->type
          && (! gate || IPV6_ADDR_SAME (gate, &si->addr.ipv6))
          && (! ifname || strcmp (ifname, si->ifname) == 0))
        {
-         route_unlock_node (rn);
-         return 0;
+         if ((distance == si->distance) && (tag == si->tag))
+           {
+             route_unlock_node (rn);
+             return 0;
+           }
+         else
+           update = si;
        }
     }
 
+  /* Distance or tag changed. */
+  if (update)
+    static_delete_ipv6 (p, type, gate, ifname, update->tag, update->distance, vrf_id);
+
   /* Make new static route structure. */
   si = XCALLOC (MTYPE_STATIC_ROUTE, sizeof (struct static_route));