]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Actually make ` --v6-with-v4-nexthops` it work
authorDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 2 Oct 2024 10:57:30 +0000 (13:57 +0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Wed, 2 Oct 2024 15:09:25 +0000 (15:09 +0000)
It was using `-v` which is actually a _version_.

Fixes: 0435b31bb8ed55377f83d0e19bc085abc3c71b44 ("bgpd: Allow bgp to specify if it will allow v6 routing with v4 nexthops")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 0495cac837ad0f6ff1082746c37e4a48c1068035)

bgpd/bgp_main.c
doc/user/bgp.rst

index 851c4880c37f2ee95e9c54e233292e324d9307ad..01649c88219d58d1ea82713a6dff264968fcae53 100644 (file)
@@ -62,18 +62,16 @@ DEFINE_HOOK(bgp_hook_vrf_update, (struct vrf *vrf, bool enabled),
            (vrf, enabled));
 
 /* bgpd options, we use GNU getopt library. */
-static const struct option longopts[] = {
-       { "bgp_port", required_argument, NULL, 'p' },
-       { "listenon", required_argument, NULL, 'l' },
-       { "no_kernel", no_argument, NULL, 'n' },
-       { "skip_runas", no_argument, NULL, 'S' },
-       { "ecmp", required_argument, NULL, 'e' },
-       { "int_num", required_argument, NULL, 'I' },
-       { "no_zebra", no_argument, NULL, 'Z' },
-       { "socket_size", required_argument, NULL, 's' },
-       { "v6-with-v4-nexthops", no_argument, NULL, 'v' },
-       { 0 }
-};
+static const struct option longopts[] = { { "bgp_port", required_argument, NULL, 'p' },
+                                         { "listenon", required_argument, NULL, 'l' },
+                                         { "no_kernel", no_argument, NULL, 'n' },
+                                         { "skip_runas", no_argument, NULL, 'S' },
+                                         { "ecmp", required_argument, NULL, 'e' },
+                                         { "int_num", required_argument, NULL, 'I' },
+                                         { "no_zebra", no_argument, NULL, 'Z' },
+                                         { "socket_size", required_argument, NULL, 's' },
+                                         { "v6-with-v4-nexthops", no_argument, NULL, 'x' },
+                                         { 0 } };
 
 /* signal definitions */
 void sighup(void);
@@ -418,11 +416,12 @@ int main(int argc, char **argv)
        int buffer_size = BGP_SOCKET_SNDBUF_SIZE;
        char *address;
        struct listnode *node;
+       bool v6_with_v4_nexthops = false;
 
        addresses->cmp = (int (*)(void *, void *))strcmp;
 
        frr_preinit(&bgpd_di, argc, argv);
-       frr_opt_add("p:l:SnZe:I:s:" DEPRECATED_OPTIONS, longopts,
+       frr_opt_add("p:l:SnZe:I:s:x" 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"
@@ -431,7 +430,7 @@ int main(int argc, char **argv)
                    "  -e, --ecmp               Specify ECMP to use.\n"
                    "  -I, --int_num            Set instance number (label-manager)\n"
                    "  -s, --socket_size        Set BGP peer socket send buffer size\n"
-                   "    , --v6-with-v4-nexthop Allow BGP to form v6 neighbors using v4 nexthops\n");
+                   "  -x, --v6-with-v4-nexthop Allow BGP to form v6 neighbors using v4 nexthops\n");
 
        /* Command line argument treatment. */
        while (1) {
@@ -493,8 +492,8 @@ int main(int argc, char **argv)
                case 's':
                        buffer_size = atoi(optarg);
                        break;
-               case 'v':
-                       bm->v6_with_v4_nexthops = true;
+               case 'x':
+                       v6_with_v4_nexthops = true;
                        break;
                default:
                        frr_help_exit(1);
@@ -506,6 +505,7 @@ int main(int argc, char **argv)
        /* BGP master init. */
        bgp_master_init(frr_init(), buffer_size, addresses);
        bm->port = bgp_port;
+       bm->v6_with_v4_nexthops = v6_with_v4_nexthops;
        if (bgp_port == 0)
                bgp_option_set(BGP_OPT_NO_LISTEN);
        if (no_fib_flag || no_zebra_flag)
index 99d2a8c355d9e9a7bbb4e775081e07f853122392..eaba92af8dff9c57136355374cc67721a4a8986f 100644 (file)
@@ -83,7 +83,7 @@ be specified (:ref:`common-invocation-options`).
    be done to see if this is helping or not at the scale you are running
    at.
 
-.. option:: --v6-with-v4-nexthops
+.. option:: -x, --v6-with-v4-nexthops
 
    Allow BGP to peer in the V6 afi, when the interface only has v4 addresses.
    This allows bgp to install the v6 routes with a v6 nexthop that has the