]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: do not treat kernel routes as implicit withdraws
authorJorge Boncompte <jbonor@gmail.com>
Thu, 27 Jul 2017 10:14:32 +0000 (12:14 +0200)
committerJorge Boncompte <jbonor@gmail.com>
Fri, 4 Aug 2017 08:19:36 +0000 (10:19 +0200)
Kernel does not send the best route after adding or deleting routes, if
we treat routes for an existing prefix as implicit withdraw the zebra RIB
goes out of sync with FIB and can announce wrong route to protocols.

host:~# vtysh -c 'show ip route'
S>* 0.0.0.0/0 [0/0] via 192.168.1.1, eth0
C>* 192.168.1.0/24 is directly connected, eth0

host:~# ip route add 192.0.2.0/24 via 192.168.1.101 metric 100
host:~# vtysh -c 'show ip route'
S>* 0.0.0.0/0 [0/0] via 192.168.1.1, eth0
K>* 192.0.2.0/24 via 192.168.1.101, eth0
C>* 192.168.1.0/24 is directly connected, eth0

host:~# ip route add 192.0.2.0/24 via 192.168.1.102 metric 50
host:~# vtysh -c 'show ip route'
S>* 0.0.0.0/0 [0/0] via 192.168.1.1, eth0
K>* 192.0.2.0/24 via 192.168.1.102, eth0
C>* 192.168.1.0/24 is directly connected, eth0

host:~# ip route del 192.0.2.0/24 via 192.168.1.102 metric 50
host:~# vtysh -c 'show ip route'
S>* 0.0.0.0/0 [0/0] via 192.168.1.1, eth0
C>* 192.168.1.0/24 is directly connected, eth0
host:~# ip route show 192.0.2.0/24
192.0.2.0/24 via 10.10.1.101 dev eth0 metric 100

Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
zebra/zebra_rib.c

index f5ee2dff9022203f809c4d4ada06b7d264af5bef..8dca4f9f83da17c157ddf4d3be3488f07cd51703 100644 (file)
@@ -2240,7 +2240,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
 
                if (same->type == re->type && same->instance == re->instance
                    && same->table == re->table
-                   && same->type != ZEBRA_ROUTE_CONNECT)
+                   && !RIB_SYSTEM_ROUTE(same))
                        break;
        }
 
@@ -2469,11 +2469,11 @@ int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
                        continue;
                if (re->instance != instance)
                        continue;
-               if (re->type != ZEBRA_ROUTE_CONNECT) {
+               if (!RIB_SYSTEM_ROUTE(re)) {
                        same = re;
                        break;
                }
-               /* Duplicate connected route comes in. */
+               /* Duplicate system route comes in. */
                else if ((nexthop = re->nexthop)
                         && nexthop->type == NEXTHOP_TYPE_IFINDEX
                         && nexthop->ifindex == ifindex