]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_main.c
bgpd: Allow shortened 'no set large-community' and 'no set large-comm-list'
[mirror_frr.git] / bgpd / bgp_main.c
index d888090e60f7b95012c16f898bb67a4771df1dca..47e7c1686fab5e97a7c4fd378de0799224d9b825 100644 (file)
@@ -77,6 +77,7 @@ static const struct option longopts[] = {
        {"no_kernel", no_argument, NULL, 'n'},
        {"skip_runas", no_argument, NULL, 'S'},
        {"ecmp", required_argument, NULL, 'e'},
+       {"int_num", required_argument, NULL, 'I'},
        {0}};
 
 /* signal definitions */
@@ -136,7 +137,7 @@ void sighup(void)
        zlog_info("bgpd restarting!");
 
        /* Reload config file. */
-       vty_read_config(bgpd_di.config_file, config_default);
+       vty_read_config(NULL, bgpd_di.config_file, config_default);
 
        /* Try to return to normal operation. */
 }
@@ -233,7 +234,10 @@ static __attribute__((__noreturn__)) void bgp_exit(int status)
        bgp_zebra_destroy();
 
        bf_free(bm->rd_idspace);
-       list_delete_and_null(&bm->bgp);
+       list_delete(&bm->bgp);
+
+       bgp_lp_finish();
+
        memset(bm, 0, sizeof(*bm));
 
        frr_fini();
@@ -347,13 +351,17 @@ static void bgp_vrf_terminate(void)
        vrf_terminate();
 }
 
+static const struct frr_yang_module_info *bgpd_yang_modules[] = {
+};
+
 FRR_DAEMON_INFO(bgpd, BGP, .vty_port = BGP_VTY_PORT,
 
                .proghelp = "Implementation of the BGP routing protocol.",
 
                .signals = bgp_signals, .n_signals = array_size(bgp_signals),
 
-               .privs = &bgpd_privs, )
+               .privs = &bgpd_privs, .yang_modules = bgpd_yang_modules,
+               .n_yang_modules = array_size(bgpd_yang_modules), )
 
 #if CONFDATE > 20190521
 CPP_NOTICE("-r / --retain has reached deprecation EOL, remove")
@@ -370,16 +378,20 @@ int main(int argc, char **argv)
        int bgp_port = BGP_PORT_DEFAULT;
        char *bgp_address = NULL;
        int no_fib_flag = 0;
+       int no_zebra_flag = 0;
        int skip_runas = 0;
+       int instance = 0;
 
        frr_preinit(&bgpd_di, argc, argv);
        frr_opt_add(
-               "p:l:Sne:" DEPRECATED_OPTIONS, longopts,
+               "p:l:Sne:I:" DEPRECATED_OPTIONS, longopts,
                "  -p, --bgp_port     Set BGP listen port number (0 means do not listen).\n"
                "  -l, --listenon     Listen on specified address (implies -n)\n"
                "  -n, --no_kernel    Do not install route to kernel.\n"
+               "  -Z, --no_zebra     Do not communicate with Zebra.\n"
                "  -S, --skip_runas   Skip capabilities checks, and changing user and group IDs.\n"
-               "  -e, --ecmp         Specify ECMP to use.\n");
+               "  -e, --ecmp         Specify ECMP to use.\n"
+               "  -I, --int_num      Set instance number (label-manager)\n");
 
        /* Command line argument treatment. */
        while (1) {
@@ -423,9 +435,18 @@ int main(int argc, char **argv)
                case 'n':
                        no_fib_flag = 1;
                        break;
+               case 'Z':
+                       no_zebra_flag = 1;
+                       break;
                case 'S':
                        skip_runas = 1;
                        break;
+               case 'I':
+                       instance = atoi(optarg);
+                       if (instance > (unsigned short)-1)
+                               zlog_err("Instance %i out of range (0..%u)",
+                                        instance, (unsigned short)-1);
+                       break;
                default:
                        frr_help_exit(1);
                        break;
@@ -440,15 +461,16 @@ int main(int argc, char **argv)
        if (bgp_port == 0)
                bgp_option_set(BGP_OPT_NO_LISTEN);
        bm->address = bgp_address;
-       if (no_fib_flag)
+       if (no_fib_flag || no_zebra_flag)
                bgp_option_set(BGP_OPT_NO_FIB);
-
+       if (no_zebra_flag)
+               bgp_option_set(BGP_OPT_NO_ZEBRA);
        bgp_error_init();
        /* Initializations. */
        bgp_vrf_init();
 
        /* BGP related initialization.  */
-       bgp_init();
+       bgp_init((unsigned short)instance);
 
        snprintf(bgpd_di.startinfo, sizeof(bgpd_di.startinfo), ", bgp@%s:%d",
                 (bm->address ? bm->address : "<all>"), bm->port);