summaryrefslogtreecommitdiff
path: root/zebra/zserv.c
diff options
context:
space:
mode:
authorSantosh P K <sapk@vmware.com>2020-01-09 08:39:50 -0800
committerSantosh P K <sapk@vmware.com>2020-01-30 10:26:04 -0800
commit851140a7bb5a978d4ef59ffa532c99767004a0b8 (patch)
tree89cd4f2c679c39d02c7a53217408712f9687d879 /zebra/zserv.c
parent8062cbe2d04ddc76b8ad3d90e3393753461fd41e (diff)
zebra: Handling of connection disconnect and connect with GR.
Zebra will have special handling for clients with GR enabled. When client disconnects with GR enabled, then a stale client will be created and its RIB will be retained till stale timer or client comes up and updated its RIB. Co-authored-by: Santosh P K <sapk@vmware.com> Co-authored-by: Soman K S <somanks@vmware.com> Signed-off-by: Santosh P K <sapk@vmware.com>
Diffstat (limited to 'zebra/zserv.c')
-rw-r--r--zebra/zserv.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index aeef3f4e49..2a5352a1da 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -568,11 +568,14 @@ static void zserv_client_free(struct zserv *client)
close(client->sock);
- nroutes = rib_score_proto(client->proto, client->instance);
- zlog_notice(
- "client %d disconnected %lu %s routes removed from the rib",
- client->sock, nroutes,
- zebra_route_string(client->proto));
+ if (!client->gr_instance_count) {
+ nroutes = rib_score_proto(client->proto,
+ client->instance);
+ zlog_notice(
+ "client %d disconnected %lu %s routes removed from the rib",
+ client->sock, nroutes,
+ zebra_route_string(client->proto));
+ }
client->sock = -1;
}
@@ -603,7 +606,25 @@ static void zserv_client_free(struct zserv *client)
}
vrf_bitmap_free(client->ridinfo);
- XFREE(MTYPE_TMP, client);
+ /*
+ * If any instance are graceful restart enabled,
+ * client is not deleted
+ */
+ if (!client->gr_instance_count) {
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug("%s: Deleting client %s", __func__,
+ zebra_route_string(client->proto));
+ XFREE(MTYPE_TMP, client);
+ } else {
+ /* Handle cases where client has GR instance. */
+ if (IS_ZEBRA_DEBUG_EVENT)
+ zlog_debug("%s: client %s restart enabled", __func__,
+ zebra_route_string(client->proto));
+ if (zebra_gr_client_disconnect(client) < 0)
+ zlog_err(
+ "%s: GR enabled but could not handle disconnect event",
+ __func__);
+ }
}
void zserv_close_client(struct zserv *client)