diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2021-09-03 09:44:38 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2021-09-07 12:53:38 -0400 | 
| commit | a1f35d7e7c7e528d23c831adeab100d6fc088b47 (patch) | |
| tree | ac28afe2c1547d9efa3227509a6c88a70798b4c4 /zebra/router-id.c | |
| parent | 0114135890141e50c25d66d24e803ad4e23fc465 (diff) | |
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 <sharpd@nvidia.com>
Diffstat (limited to 'zebra/router-id.c')
| -rw-r--r-- | zebra/router-id.c | 15 | 
1 files 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;  }  | 
