]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: ensure cleanup of rib on client close
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 1 Aug 2018 19:38:41 +0000 (19:38 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 1 Aug 2018 19:41:47 +0000 (19:41 +0000)
Socket should be closed in zserv_client_free() and nowhere else.

Credit to Mark Stapp for catching this one.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zebra/zserv.c

index fa501b187d3ac7e328715e9a6119e5a9672275ba..4960ba03a60ca1a31a7401dac6422c1e7970d19a 100644 (file)
@@ -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);