]> git.puffer.fish Git - matthieu/frr.git/commitdiff
*: remove -r from daemons except zebra
authorQuentin Young <qlyoung@cumulusnetworks.com>
Wed, 16 May 2018 21:07:54 +0000 (21:07 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 21 May 2018 19:09:49 +0000 (19:09 +0000)
This option is only implemented by 4 daemons:
- BGPD
- RIPD
- RIPNGD
- Zebra

Manpages and documentation say that the option causes routes to not be
uninstalled from zebra when the daemon terminates. This is true for RIPD
and RIPNGD. This is not true for BGPD; in that daemon it only prevents
transmission of Cease / Peer Unconfig NOTIFICATION messages to peers.

Moreover, when any daemon disconnects from Zebra, all of its routes are
uninstalled from Zebra and the kernel regardless of this option,
rendering the option largely vestigial.

It is still useful in Zebra, where it prevents all routes from being
uninstalled when Zebra shuts down, so it is left there.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_main.c
ripd/rip_main.c
ripngd/ripng_main.c

index 004bdd90a24fa8f6355d02b9311a107bec7937e7..acb4272cd1ff4179cb5ec876b3f1dcde90135904 100644 (file)
@@ -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 */
index 9a448e895890fdc9dd18e0362eacaa18d5aa944e..0194e5312802d5a2a48226158352c41d4a9cb16e 100644 (file)
@@ -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;
index 8ef27daabaacf8ae93d12b2052a0fe69679f7bdf..e4501d6f80aa5d1687c01e9e6dea86fb69b08be0 100644 (file)
@@ -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;