summaryrefslogtreecommitdiff
path: root/zebra/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/main.c')
-rw-r--r--zebra/main.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/zebra/main.c b/zebra/main.c
index 19b16936d9..b0a19c5aa5 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -34,6 +34,7 @@
#include "privs.h"
#include "sigevent.h"
#include "vrf.h"
+#include "logicalrouter.h"
#include "libfrr.h"
#include "zebra/rib.h"
@@ -47,6 +48,7 @@
#include "zebra/redistribute.h"
#include "zebra/zebra_mpls.h"
#include "zebra/label_manager.h"
+#include "zebra/zebra_netns_notify.h"
#define ZEBRA_PTM_SUPPORT
@@ -85,6 +87,7 @@ struct option longopts[] = {{"batch", no_argument, NULL, 'b'},
{"label_socket", no_argument, NULL, 'l'},
{"retain", no_argument, NULL, 'r'},
#ifdef HAVE_NETLINK
+ {"vrfwnetns", no_argument, NULL, 'n'},
{"nl-bufsize", required_argument, NULL, 's'},
#endif /* HAVE_NETLINK */
{0}};
@@ -122,7 +125,6 @@ static void sigint(void)
{
struct vrf *vrf;
struct zebra_vrf *zvrf;
- struct zebra_ns *zns;
zlog_notice("Terminating on signal");
@@ -137,19 +139,19 @@ static void sigint(void)
if (zvrf)
SET_FLAG(zvrf->flags, ZEBRA_VRF_RETAIN);
}
+ if (zebrad.lsp_process_q)
+ work_queue_free_and_null(&zebrad.lsp_process_q);
vrf_terminate();
- zns = zebra_ns_lookup(NS_DEFAULT);
- zebra_ns_disable(0, (void **)&zns);
+ ns_walk_func(zebra_ns_disabled);
+ zebra_ns_notify_close();
access_list_reset();
prefix_list_reset();
route_map_finish();
list_delete_and_null(&zebrad.client_list);
- work_queue_free(zebrad.ribq);
- if (zebrad.lsp_process_q)
- work_queue_free(zebrad.lsp_process_q);
+ work_queue_free_and_null(&zebrad.ribq);
meta_queue_free(zebrad.mq);
frr_fini();
@@ -205,12 +207,15 @@ int main(int argc, char **argv)
char *fuzzing = NULL;
#endif
+ vrf_configure_backend(VRF_BACKEND_VRF_LITE);
+ logicalrouter_configure_backend(LOGICALROUTER_BACKEND_NETNS);
+
frr_preinit(&zebra_di, argc, argv);
frr_opt_add(
"bakz:e:l:r"
#ifdef HAVE_NETLINK
- "s:"
+ "s:n"
#endif
#if defined(HANDLE_ZAPI_FUZZING)
"c:"
@@ -225,6 +230,7 @@ int main(int argc, char **argv)
" -k, --keep_kernel Don't delete old routes which installed by zebra.\n"
" -r, --retain When program terminates, retain added route by zebra.\n"
#ifdef HAVE_NETLINK
+ " -n, --vrfwnetns Set VRF with NetNS\n"
" -s, --nl-bufsize Set netlink receive buffer size\n"
#endif /* HAVE_NETLINK */
#if defined(HANDLE_ZAPI_FUZZING)
@@ -279,6 +285,11 @@ int main(int argc, char **argv)
case 's':
nl_rcvbufsize = atoi(optarg);
break;
+ case 'n':
+ vrf_configure_backend(VRF_BACKEND_NETNS);
+ logicalrouter_configure_backend(
+ LOGICALROUTER_BACKEND_OFF);
+ break;
#endif /* HAVE_NETLINK */
#if defined(HANDLE_ZAPI_FUZZING)
case 'c':
@@ -321,8 +332,8 @@ int main(int argc, char **argv)
zebra_mpls_vty_init();
zebra_pw_vty_init();
- /* For debug purpose. */
- /* SET_FLAG (zebra_debug_event, ZEBRA_DEBUG_EVENT); */
+/* For debug purpose. */
+/* SET_FLAG (zebra_debug_event, ZEBRA_DEBUG_EVENT); */
#if defined(HANDLE_ZAPI_FUZZING)
if (fuzzing) {
@@ -340,9 +351,6 @@ int main(int argc, char **argv)
*/
frr_config_fork();
- /* Clean up rib -- before fork (?) */
- /* rib_weed_tables (); */
-
/* After we have successfully acquired the pidfile, we can be sure
* about being the only copy of zebra process, which is submitting
* changes to the FIB.