]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fix detection of duplicate system routes
authorRenato Westphal <renato@opensourcerouting.org>
Thu, 31 Aug 2017 20:28:05 +0000 (17:28 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 1 Sep 2017 01:13:14 +0000 (22:13 -0300)
Fixes the following bugs:

1)
% ip -6 route add 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
%
% vtysh -c "show ipv6 route"
[snip]
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K>* 5000::/64 [0/1024] via 3000::2, rt1-eth0

2)
% ip -6 route add 7000::/64 via 3000::2
% ip -6 route replace 7000::/64 via 3000::3
% ip -6 ro | grep 7000
7000::/64 via 3000::3 dev rt1-eth0 metric 1024  pref medium
%
% vtysh -c "show ipv6 route"
[snip]
K * 7000::/64 [0/1024] via 3000::3, rt1-eth0
K>* 7000::/64 [0/1024] via 3000::2, rt1-eth0

NOTE: the check for ROUTE_ENTRY_REMOVED was redundant as it was already
performed at the beginning of the loop.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
zebra/zebra_rib.c

index c9e770e2042f3ff8cb434858736efda124b96304..59b693435d278a29f79aa5b5e49c5784faf69efe 100644 (file)
@@ -2469,12 +2469,11 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
                        break;
                }
                /* Duplicate system route comes in. */
-               else if ((rtnh = re->nexthop)
-                        && rtnh->type == NEXTHOP_TYPE_IFINDEX
-                        && rtnh->ifindex == nh->ifindex
-                        && !CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)) {
+               rtnh = re->nexthop;
+               if (nexthop_same_no_recurse(rtnh, nh))
                        return 0;
-               }
+               else
+                       same = re;
        }
 
        /* Allocate new re structure. */