diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 004bdd90a2..acb4272cd1 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -68,6 +68,9 @@ static const struct option longopts[] = { {"bgp_port", required_argument, NULL, 'p'}, {"listenon", required_argument, NULL, 'l'}, +#if CONFDATE > 20190521 + CPP_NOTICE("-r / --retain has reached deprecation EOL, remove") +#endif {"retain", no_argument, NULL, 'r'}, {"no_kernel", no_argument, NULL, 'n'}, {"skip_runas", no_argument, NULL, 'S'}, @@ -101,9 +104,6 @@ static struct quagga_signal_t bgp_signals[] = { }, }; -/* Route retain mode flag. */ -static int retain_mode = 0; - /* privileges */ static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN}; @@ -146,8 +146,7 @@ __attribute__((__noreturn__)) void sigint(void) assert(bm->terminating == false); bm->terminating = true; /* global flag that shutting down */ - if (!retain_mode) - bgp_terminate(); + bgp_terminate(); bgp_exit(0); @@ -324,6 +323,11 @@ FRR_DAEMON_INFO(bgpd, BGP, .vty_port = BGP_VTY_PORT, .privs = &bgpd_privs, ) +#if CONFDATE > 20190521 +CPP_NOTICE("-r / --retain has reached deprecation EOL, remove") +#endif +#define DEPRECATED_OPTIONS "r" + /* Main routine of bgpd. Treatment of argument and start bgp finite state machine is handled at here. */ int main(int argc, char **argv) @@ -338,10 +342,9 @@ int main(int argc, char **argv) frr_preinit(&bgpd_di, argc, argv); frr_opt_add( - "p:l:rSne:", longopts, + "p:l:Sne:" 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" - " -r, --retain When program terminates, retain added route by bgpd.\n" " -n, --no_kernel Do not install route to kernel.\n" " -S, --skip_runas Skip capabilities checks, and changing user and group IDs.\n" " -e, --ecmp Specify ECMP to use.\n"); @@ -350,6 +353,13 @@ int main(int argc, char **argv) while (1) { opt = frr_getopt(argc, argv, 0); + if (opt && opt < 128 && strchr(DEPRECATED_OPTIONS, opt)) { + fprintf(stderr, + "The -%c option no longer exists.\nPlease refer to the manual.\n", + opt); + continue; + } + if (opt == EOF) break; @@ -373,9 +383,6 @@ int main(int argc, char **argv) return 1; } break; - case 'r': - retain_mode = 1; - break; case 'l': bgp_address = optarg; /* listenon implies -n */ diff --git a/ripd/rip_main.c b/ripd/rip_main.c index 9a448e8958..0194e53128 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -39,6 +39,9 @@ #include "ripd/ripd.h" /* ripd options. */ +#if CONFDATE > 20190521 + CPP_NOTICE("-r / --retain has reached deprecation EOL, remove") +#endif static struct option longopts[] = {{"retain", no_argument, NULL, 'r'}, {0}}; /* ripd privileges */ @@ -58,9 +61,6 @@ struct zebra_privs_t ripd_privs = { .cap_num_p = 2, .cap_num_i = 0}; -/* Route retain mode flag. */ -int retain_mode = 0; - /* Master of threads. */ struct thread_master *master; @@ -85,8 +85,7 @@ static void sigint(void) { zlog_notice("Terminating on signal"); - if (!retain_mode) - rip_clean(); + rip_clean(); rip_zclient_stop(); frr_fini(); @@ -127,13 +126,17 @@ FRR_DAEMON_INFO(ripd, RIP, .vty_port = RIP_VTY_PORT, .privs = &ripd_privs, ) +#if CONFDATE > 20190521 +CPP_NOTICE("-r / --retain has reached deprecation EOL, remove") +#endif +#define DEPRECATED_OPTIONS "r" + /* Main routine of ripd. */ int main(int argc, char **argv) { frr_preinit(&ripd_di, argc, argv); - frr_opt_add( - "r", longopts, - " -r, --retain When program terminates, retain added route by ripd.\n"); + + frr_opt_add("" DEPRECATED_OPTIONS, longopts, ""); /* Command line option parse. */ while (1) { @@ -141,15 +144,19 @@ int main(int argc, char **argv) opt = frr_getopt(argc, argv, NULL); + if (opt && opt < 128 && strchr(DEPRECATED_OPTIONS, opt)) { + fprintf(stderr, + "The -%c option no longer exists.\nPlease refer to the manual.\n", + opt); + continue; + } + if (opt == EOF) break; switch (opt) { case 0: break; - case 'r': - retain_mode = 1; - break; default: frr_help_exit(1); break; diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 8ef27daaba..e4501d6f80 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -40,6 +40,9 @@ #include "ripngd/ripngd.h" /* RIPngd options. */ +#if CONFDATE > 20190521 + CPP_NOTICE("-r / --retain has reached deprecation EOL, remove") +#endif struct option longopts[] = {{"retain", no_argument, NULL, 'r'}, {0}}; /* ripngd privileges */ @@ -60,11 +63,6 @@ struct zebra_privs_t ripngd_privs = { .cap_num_i = 0}; -/* RIPngd program name */ - -/* Route retain mode flag. */ -int retain_mode = 0; - /* Master of threads. */ struct thread_master *master; @@ -88,8 +86,7 @@ static void sigint(void) { zlog_notice("Terminating on signal"); - if (!retain_mode) - ripng_clean(); + ripng_clean(); ripng_zebra_stop(); frr_fini(); @@ -130,28 +127,36 @@ FRR_DAEMON_INFO(ripngd, RIPNG, .vty_port = RIPNG_VTY_PORT, .privs = &ripngd_privs, ) +#if CONFDATE > 20190521 +CPP_NOTICE("-r / --retain has reached deprecation EOL, remove") +#endif +#define DEPRECATED_OPTIONS "r" + /* RIPngd main routine. */ int main(int argc, char **argv) { frr_preinit(&ripngd_di, argc, argv); - frr_opt_add( - "r", longopts, - " -r, --retain When program terminates, retain added route by ripd.\n"); + + frr_opt_add("" DEPRECATED_OPTIONS, longopts, ""); while (1) { int opt; opt = frr_getopt(argc, argv, NULL); + if (opt && opt < 128 && strchr(DEPRECATED_OPTIONS, opt)) { + fprintf(stderr, + "The -%c option no longer exists.\nPlease refer to the manual.\n", + opt); + continue; + } + if (opt == EOF) break; switch (opt) { case 0: break; - case 'r': - retain_mode = 1; - break; default: frr_help_exit(1); break;