From a1f35d7e7c7e528d23c831adeab100d6fc088b47 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 3 Sep 2021 09:44:38 -0400 Subject: [PATCH] zebra: If we hand set the router-id only update everyone if it changes When we hand set the router-id, but we have choosen a router-id that is already the `winner` there is no point in updating anyone with this data. Signed-off-by: Donald Sharp --- zebra/router-id.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/zebra/router-id.c b/zebra/router-id.c index 689b9787ee..ac81d537d0 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -120,10 +120,12 @@ int router_id_get(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf) static int router_id_set(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf) { - struct prefix p2; + struct prefix after, before; struct listnode *node; struct zserv *client; + router_id_get(afi, &before, zvrf); + switch (afi) { case AFI_IP: zvrf->rid_user_assigned.u.prefix4.s_addr = p->u.prefix4.s_addr; @@ -135,10 +137,17 @@ static int router_id_set(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf) return -1; } - router_id_get(afi, &p2, zvrf); + router_id_get(afi, &after, zvrf); + + /* + * If we've been told that the router-id is exactly the same + * do we need to really do anything here? + */ + if (prefix_same(&before, &after)) + return 0; for (ALL_LIST_ELEMENTS_RO(zrouter.client_list, node, client)) - zsend_router_id_update(client, afi, &p2, zvrf->vrf->vrf_id); + zsend_router_id_update(client, afi, &after, zvrf->vrf->vrf_id); return 0; } -- 2.39.5