zebra: Don't kill the global rtadv socket when a vrf is deleted

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>
This commit is contained in:
Donald Sharp 2020-04-02 11:16:50 -04:00
parent 78e9da668d
commit aab5893aa6
4 changed files with 14 additions and 6 deletions

View 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();

View File

@ -2371,18 +2371,24 @@ 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) {
}
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;
}
zvrf->rtadv.adv_if_count = 0;
zvrf->rtadv.adv_msec_if_count = 0;
}
void rtadv_cmd_init(void)

View 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);

View 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