diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-03-26 10:23:18 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2019-05-07 15:49:39 +0200 |
commit | 7bcadbaefe8d8e76b8ac054823f0039e1d8e8003 (patch) | |
tree | 7941a65d23a5515bb1abbd79410dee0cbbeadf39 /bfdd/bfdd.c | |
parent | bfdd: add vrf framework (diff) | |
download | frr-7bcadbaefe8d8e76b8ac054823f0039e1d8e8003.tar.xz frr-7bcadbaefe8d8e76b8ac054823f0039e1d8e8003.zip |
bfdd: socket handling per vrf context
sockets are created foreach network namespace context enabled.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bfdd/bfdd.c')
-rw-r--r-- | bfdd/bfdd.c | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/bfdd/bfdd.c b/bfdd/bfdd.c index d352f1103..fe4408bc8 100644 --- a/bfdd/bfdd.c +++ b/bfdd/bfdd.c @@ -34,6 +34,7 @@ DEFINE_MTYPE(BFDD, BFDD_LABEL, "long-lived label memory"); DEFINE_MTYPE(BFDD, BFDD_CONTROL, "long-lived control socket memory"); DEFINE_MTYPE(BFDD, BFDD_SESSION_OBSERVER, "Session observer"); DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data"); +DEFINE_MTYPE(BFDD, BFDD_VRF, "BFD VRF"); /* Master of threads. */ struct thread_master *master; @@ -85,12 +86,7 @@ static void sigterm_handler(void) /* Shutdown and free all protocol related memory. */ bfd_shutdown(); - /* Close all descriptors. */ - socket_close(&bglobal.bg_echo); - socket_close(&bglobal.bg_shop); - socket_close(&bglobal.bg_mhop); - socket_close(&bglobal.bg_shop6); - socket_close(&bglobal.bg_mhop6); + bfd_vrf_terminate(); /* Terminate and free() FRR related memory. */ frr_fini(); @@ -155,13 +151,6 @@ static void bg_init(void) { TAILQ_INIT(&bglobal.bg_bcslist); TAILQ_INIT(&bglobal.bg_obslist); - - bglobal.bg_shop = bp_udp_shop(); - bglobal.bg_mhop = bp_udp_mhop(); - bglobal.bg_shop6 = bp_udp6_shop(); - bglobal.bg_mhop6 = bp_udp6_mhop(); - bglobal.bg_echo = bp_echo_socket(); - bglobal.bg_echov6 = bp_echov6_socket(); } int main(int argc, char *argv[]) @@ -213,19 +202,6 @@ int main(int argc, char *argv[]) /* Initialize zebra connection. */ bfdd_zclient_init(&bfdd_privs); - /* Add descriptors to the event loop. */ - thread_add_read(master, bfd_recv_cb, NULL, bglobal.bg_shop, - &bglobal.bg_ev[0]); - thread_add_read(master, bfd_recv_cb, NULL, bglobal.bg_mhop, - &bglobal.bg_ev[1]); - thread_add_read(master, bfd_recv_cb, NULL, bglobal.bg_shop6, - &bglobal.bg_ev[2]); - thread_add_read(master, bfd_recv_cb, NULL, bglobal.bg_mhop6, - &bglobal.bg_ev[3]); - thread_add_read(master, bfd_recv_cb, NULL, bglobal.bg_echo, - &bglobal.bg_ev[4]); - thread_add_read(master, bfd_recv_cb, NULL, bglobal.bg_echov6, - &bglobal.bg_ev[5]); thread_add_read(master, control_accept, NULL, bglobal.bg_csock, &bglobal.bg_csockev); |