From a580357a871c862d52a1d4c933edcc694b746848 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 1 Aug 2018 19:38:41 +0000 Subject: [PATCH] zebra: ensure cleanup of rib on client close Socket should be closed in zserv_client_free() and nowhere else. Credit to Mark Stapp for catching this one. Signed-off-by: Quentin Young --- zebra/zserv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/zebra/zserv.c b/zebra/zserv.c index fa501b187d..4960ba03a6 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -576,6 +576,7 @@ static void zserv_client_free(struct zserv *client) unsigned long nroutes; close(client->sock); + nroutes = rib_score_proto(client->proto, client->instance); zlog_notice( "client %d disconnected. %lu %s routes removed from the rib", @@ -621,12 +622,6 @@ void zserv_close_client(struct zserv *client) zlog_debug("Closing client '%s'", zebra_route_string(client->proto)); - /* if file descriptor is still open, close it */ - if (client->sock > 0) { - close(client->sock); - client->sock = -1; - } - thread_cancel_event(zebrad.master, client); THREAD_OFF(client->t_cleanup); -- 2.39.5