]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Don't kill the global rtadv socket when a vrf is deleted
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 2 Apr 2020 15:16:50 +0000 (11:16 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 2 Apr 2020 15:38:26 +0000 (11:38 -0400)
The rtadv code has two types of sockets:
a) namespace -> Where each zvrf get's it's own socket
b) vrf lite -> Where we get 1 socket for everything

When we were terminating a vrf we were *always*
killing the (b) socket.  This is a mistake in
that other vrf's may need to be communicating.

Modify the code on vrf shutdown to only disable
that vrf's event processing and when we actually
terminate we shut the socket.

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

index 4673ec53e4b38d58ea9788404b156da467b3dc8d..306372ccdb841c3f7397954bcf22e8183b7eb05d 100644 (file)
@@ -174,6 +174,7 @@ static void sigint(void)
                work_queue_free_and_null(&zrouter.lsp_process_q);
 
        vrf_terminate();
+       rtadv_terminate();
 
        ns_walk_func(zebra_ns_early_shutdown);
        zebra_ns_notify_close();
index 60ac471b5adcfec510fbb1d9e6273e78daeea3f1..4a553a42695ae609a8492cce2d3b3ec39b5d85bf 100644 (file)
@@ -2371,20 +2371,26 @@ void rtadv_init(struct zebra_vrf *zvrf)
        }
 }
 
-void rtadv_terminate(struct zebra_vrf *zvrf)
+void rtadv_vrf_terminate(struct zebra_vrf *zvrf)
 {
        rtadv_event(zvrf, RTADV_STOP, 0);
        if (zvrf->rtadv.sock >= 0) {
                close(zvrf->rtadv.sock);
                zvrf->rtadv.sock = -1;
-       } else if (zrouter.rtadv_sock >= 0) {
-               close(zrouter.rtadv_sock);
-               zrouter.rtadv_sock = -1;
        }
+
        zvrf->rtadv.adv_if_count = 0;
        zvrf->rtadv.adv_msec_if_count = 0;
 }
 
+void rtadv_terminate(void)
+{
+       if (zrouter.rtadv_sock >= 0) {
+               close(zrouter.rtadv_sock);
+               zrouter.rtadv_sock = -1;
+       }
+}
+
 void rtadv_cmd_init(void)
 {
        hook_register(zebra_if_extra_info, nd_dump_vty);
index 64b28cbfd6febc93177cd6b9ad5baab1180b23d5..68a5bbcdbe331ffdb73bf6ff40968112517aa030 100644 (file)
@@ -153,7 +153,8 @@ typedef enum {
 } ipv6_nd_suppress_ra_status;
 
 extern void rtadv_init(struct zebra_vrf *zvrf);
-extern void rtadv_terminate(struct zebra_vrf *zvrf);
+extern void rtadv_vrf_terminate(struct zebra_vrf *zvrf);
+extern void rtadv_terminate(void);
 extern void rtadv_stop_ra(struct interface *ifp);
 extern void rtadv_stop_ra_all(void);
 extern void rtadv_cmd_init(void);
index dfa7d5ae923c9c254f21a90d2bb0b4783b081821..ee1e251a69900ce71778e368b56a6290e9ea927c 100644 (file)
@@ -178,7 +178,7 @@ static int zebra_vrf_disable(struct vrf *vrf)
        zebra_vxlan_vrf_disable(zvrf);
 
 #if defined(HAVE_RTADV)
-       rtadv_terminate(zvrf);
+       rtadv_vrf_terminate(zvrf);
 #endif
 
        /* Inform clients that the VRF is now inactive. This is a