From: Stephen Worley Date: Fri, 26 Jun 2020 18:16:25 +0000 (-0400) Subject: pbrd: uninstall NHG route if not valid anymore X-Git-Tag: base_7.5~180^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=6db1188f0e3f3ad407cf45a7190800c00ca6bb26;p=matthieu%2Ffrr.git pbrd: uninstall NHG route if not valid anymore 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 --- diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 98be958fce..d7a6751ff1 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -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);