]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pbrd: uninstall NHG route if not valid anymore
authorStephen Worley <sworley@cumulusnetworks.com>
Fri, 26 Jun 2020 18:16:25 +0000 (14:16 -0400)
committerStephen Worley <sworley@cumulusnetworks.com>
Thu, 9 Jul 2020 15:51:13 +0000 (11:51 -0400)
Withdraw route from RIB if we detect the NHG is not valid
anymore. We were seeing an issue where we would leave a route
in zebra's RIB if it was recursive despite it being removed
from the kernel due to an interface going down.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
pbrd/pbr_nht.c

index 98be958fce60050d57966180624e3b5bc137ac76..d7a6751ff1da09be8d25ab457de93bbd20417574 100644 (file)
@@ -852,12 +852,15 @@ static void pbr_nht_nexthop_update_lookup(struct hash_bucket *b, void *data)
         */
        pnhgc->valid = !!pnhi.valid;
 
-       if (pnhgc->valid) {
-               pbr_nexthop_group_cache_to_nexthop_group(&nhg, pnhgc);
+       pbr_nexthop_group_cache_to_nexthop_group(&nhg, pnhgc);
+
+       if (pnhgc->valid)
                pbr_nht_install_nexthop_group(pnhgc, nhg);
-               /* Don't need copied nexthops anymore */
-               nexthops_free(nhg.nexthop);
-       }
+       else
+               pbr_nht_uninstall_nexthop_group(pnhgc, nhg, 0);
+
+       /* Don't need copied nexthops anymore */
+       nexthops_free(nhg.nexthop);
 
        if (old_valid != pnhgc->valid)
                pbr_map_check_nh_group_change(pnhgc->name);