From: Xiao Liang Date: Mon, 27 Sep 2021 02:23:37 +0000 (+0800) Subject: staticd: Don't register existing nexthop to zebra X-Git-Tag: pim6-testing-20220430~287^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=f1d6b7e36e7e50c94ac180dcd594154b8c5812b4;p=matthieu%2Ffrr.git staticd: Don't register existing nexthop to zebra Zebra sends a nexthop-update message on registeration, which will cause existing routes to be reconfigured even no changes actually happened. Don't register the nexthop again if it's already done. Signed-off-by: Xiao Liang --- diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index b75e1a1cdf..cdbd37b5d4 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -302,12 +302,14 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg) static_nht_hash_alloc); nhtd->refcount++; - DEBUGD(&static_dbg_route, - "Registered nexthop(%pFX) for %pRN %d", &p, rn, - nhtd->nh_num); - if (nhtd->refcount > 1 && nhtd->nh_num) { - static_nht_update(&rn->p, nhtd->nh, nhtd->nh_num, afi, - nh->nh_vrf_id); + if (nhtd->refcount > 1) { + DEBUGD(&static_dbg_route, + "Already registered nexthop(%pFX) for %pRN %d", + &p, rn, nhtd->nh_num); + if (nhtd->nh_num) + static_nht_update(&rn->p, nhtd->nh, + nhtd->nh_num, afi, + nh->nh_vrf_id); return; } } else { @@ -323,6 +325,9 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg) static_nht_hash_free(nhtd); } + DEBUGD(&static_dbg_route, "%s nexthop(%pFX) for %pRN", + reg ? "Registering" : "Unregistering", &p, rn); + if (zclient_send_rnh(zclient, cmd, &p, false, false, nh->nh_vrf_id) == ZCLIENT_SEND_FAILURE) zlog_warn("%s: Failure to send nexthop to zebra", __func__);