diff options
| author | Santosh P K <sapk@vmware.com> | 2020-02-20 10:50:14 -0800 | 
|---|---|---|
| committer | Santosh P K <sapk@vmware.com> | 2020-02-21 06:26:48 -0800 | 
| commit | 6f4aee61a2e741b8ba6f91b5922ddafafda5b587 (patch) | |
| tree | 464cda7f3595a74a51d91d8f38de47ea737caf29 /zebra/zebra_gr.c | |
| parent | f294fac22d152ca1a31c3d87939c3a6f58ec0ce0 (diff) | |
Zebra: Zebra gr dynamic client handling.
When a client connects to zebra with GR capabilities and
then restarts, it might disconnect again even before hello is
sent leading zebra cores.
GR should be supported only for dynamic neighbor who are capable
of restarting.
Signed-off-by: Santosh P K <sapk@vmware.com>
Diffstat (limited to 'zebra/zebra_gr.c')
| -rw-r--r-- | zebra/zebra_gr.c | 49 | 
1 files changed, 28 insertions, 21 deletions
diff --git a/zebra/zebra_gr.c b/zebra/zebra_gr.c index e8c7304f44..6d3829110e 100644 --- a/zebra/zebra_gr.c +++ b/zebra/zebra_gr.c @@ -265,30 +265,31 @@ void zebra_gr_client_reconnect(struct zserv *client)  	}  	/* Copy the timers */ -	if (old_client) { -		client->gr_instance_count = old_client->gr_instance_count; -		client->restart_time = old_client->restart_time; - -		LOG_GR("%s : old client %s, gr_instance_count %d", __func__, -		       zebra_route_string(old_client->proto), -		       old_client->gr_instance_count); - -		if (TAILQ_FIRST(&old_client->gr_info_queue)) { -			TAILQ_CONCAT(&client->gr_info_queue, -				     &old_client->gr_info_queue, gr_info); -			TAILQ_INIT(&old_client->gr_info_queue); -		} +	if (!old_client) +		return; -		TAILQ_FOREACH (info, &client->gr_info_queue, gr_info) { -			info->stale_client_ptr = client; -			info->stale_client = false; -		} +	client->gr_instance_count = old_client->gr_instance_count; +	client->restart_time = old_client->restart_time; + +	LOG_GR("%s : old client %s, gr_instance_count %d", __func__, +	       zebra_route_string(old_client->proto), +	       old_client->gr_instance_count); + +	if (TAILQ_FIRST(&old_client->gr_info_queue)) { +		TAILQ_CONCAT(&client->gr_info_queue, &old_client->gr_info_queue, +			     gr_info); +		TAILQ_INIT(&old_client->gr_info_queue); +	} -		/* Delete the stale client */ -		listnode_delete(zrouter.stale_client_list, old_client); -		/* Delete old client */ -		XFREE(MTYPE_TMP, old_client); +	TAILQ_FOREACH (info, &client->gr_info_queue, gr_info) { +		info->stale_client_ptr = client; +		info->stale_client = false;  	} + +	/* Delete the stale client */ +	listnode_delete(zrouter.stale_client_list, old_client); +	/* Delete old client */ +	XFREE(MTYPE_TMP, old_client);  }  /* @@ -425,6 +426,12 @@ void zread_client_capabilities(ZAPI_HANDLER_ARGS)  		return;  	} +	/* GR only for dynamic clients */ +	if (client->proto <= ZEBRA_ROUTE_CONNECT) { +		LOG_GR("%s: GR capabilities for client %s not supported", +		       __func__, zebra_route_string(client->proto)); +		return; +	}  	/* Call the capabilities handler */  	zebra_client_capabilities_handler(client, &api);  }  | 
