]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: fix isis_route_merge_verify logic
authorChristian Franke <chris@opensourcerouting.org>
Thu, 26 Jul 2018 08:02:15 +0000 (10:02 +0200)
committerChristian Franke <chris@opensourcerouting.org>
Fri, 3 Aug 2018 11:25:39 +0000 (13:25 +0200)
This addresses two issues for L1L2 operation:

a) If an L1 route has ROUTE_ACTIVE unset and an L2 route for the same
destination has ROUTE_ACTIVE set, isisd would still put the L1 route
into the merged table. This causes the route for the destination to
get uninstalled from zebra until the next SPF run, which is incorrect.

To fix this, look at the ROUTE_ACTIVE flag and allow L2 routes to win
against L1 routes, when the L1 has ROUTE_ACTIVE unset.

b) If an L1 route wins against an existing L2 route, the ZEBRA_SYNCED
flag would remain on the L2 route. This leads to the problem that when
the L1 route disappears again, the L2 doesn't get reinstalled, since
isisd assumes it's already in the RIB because ZEBRA_SYNCED is set.

Solve this by clearing ZEBRA_SYNCED on L2 routes, if they lose against
an L1 route.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
isisd/isis_route.c

index b6fb90b6dd57bd8560b48b09ddda972f23e9e37e..9eb258a1eb35273d672b9786a3edd7ed3c93bd3e 100644 (file)
@@ -490,12 +490,37 @@ void isis_route_verify_merge(struct isis_area *area,
        for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
                for (rnode = route_top(tables[level - 1]); rnode;
                     rnode = route_next(rnode)) {
-                       if (rnode->info == NULL)
+                       struct isis_route_info *rinfo = rnode->info;
+                       if (!rinfo)
                                continue;
+
                        mrnode = route_node_get(merge, &rnode->p);
-                       if (mrnode->info != NULL) {
+                       struct isis_route_info *mrinfo = mrnode->info;
+                       if (mrinfo) {
                                route_unlock_node(mrnode);
-                               continue;
+                               if (CHECK_FLAG(mrinfo->flag,
+                                              ISIS_ROUTE_FLAG_ACTIVE)) {
+                                       /* Clear the ZEBRA_SYNCED flag on the
+                                        * L2 route when L1 wins, otherwise L2
+                                        * won't get reinstalled when L1
+                                        * disappears.
+                                        */
+                                       UNSET_FLAG(
+                                               rinfo->flag,
+                                               ISIS_ROUTE_FLAG_ZEBRA_SYNCED
+                                       );
+                                       continue;
+                               } else {
+                                       /* Clear the ZEBRA_SYNCED flag on the L1
+                                        * route when L2 wins, otherwise L1
+                                        * won't get reinstalled when it
+                                        * reappears.
+                                        */
+                                       UNSET_FLAG(
+                                               mrinfo->flag,
+                                               ISIS_ROUTE_FLAG_ZEBRA_SYNCED
+                                       );
+                               }
                        }
                        mrnode->info = rnode->info;
                }