]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: When shutting down actually close the socket
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 9 Feb 2019 21:38:34 +0000 (16:38 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 27 Mar 2019 20:19:28 +0000 (16:19 -0400)
When shutting down and we have a very large table to shutdown
and after we've intentionally closed all the client connections
close the zebra zserv client socket.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/main.c
zebra/zserv.c
zebra/zserv.h

index c605050c57fe37ae2e70665573bfebc0cd974c49..184e798bd070f1484804082a8df794dc14d46774 100644 (file)
@@ -153,7 +153,9 @@ static void sigint(void)
        for (ALL_LIST_ELEMENTS(zrouter.client_list, ln, nn, client))
                zserv_close_client(client);
 
+       zserv_close();
        list_delete_all_node(zrouter.client_list);
+
        zebra_ptm_finish();
 
        if (retain_mode)
index 6532491cefe5821c3a774108cdb4f349bfcf1b05..f5bb3aabb767428bccadcc61c4d33745784d2c39 100644 (file)
@@ -773,6 +773,18 @@ static int zserv_accept(struct thread *thread)
        return 0;
 }
 
+void zserv_close(void)
+{
+       /*
+        * On shutdown, let's close the socket down
+        * so that long running processes of killing the
+        * routing table doesn't leave us in a bad
+        * state where a client tries to reconnect
+        */
+       close(zsock);
+       zsock = -1;
+}
+
 void zserv_start(char *path)
 {
        int ret;
index c4c3e1328b5bb04974ce4bbad46dab0feaad07b8..86863d961c2bf961f87dd727f172b65027a6ce9c 100644 (file)
@@ -183,6 +183,13 @@ extern unsigned int multipath_num;
  */
 extern void zserv_init(void);
 
+/*
+ * Stop the Zebra API server.
+ *
+ * closes the socket
+ */
+extern void zserv_close(void);
+
 /*
  * Start Zebra API server.
  *