Merge pull request #16981 from FRRouting/mergify/bp/stable/9.1/pr-16971

bgpd: Actually make ` --v6-with-v4-nexthops` it work (backport #16971)
This commit is contained in:
Donatas Abraitis 2024-10-07 11:27:43 +03:00 committed by GitHub
commit 6375c032bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 17 deletions

View File

@ -56,8 +56,7 @@
#endif #endif
/* bgpd options, we use GNU getopt library. */ /* bgpd options, we use GNU getopt library. */
static const struct option longopts[] = { static const struct option longopts[] = { { "bgp_port", required_argument, NULL, 'p' },
{ "bgp_port", required_argument, NULL, 'p' },
{ "listenon", required_argument, NULL, 'l' }, { "listenon", required_argument, NULL, 'l' },
{ "no_kernel", no_argument, NULL, 'n' }, { "no_kernel", no_argument, NULL, 'n' },
{ "skip_runas", no_argument, NULL, 'S' }, { "skip_runas", no_argument, NULL, 'S' },
@ -65,9 +64,8 @@ static const struct option longopts[] = {
{ "int_num", required_argument, NULL, 'I' }, { "int_num", required_argument, NULL, 'I' },
{ "no_zebra", no_argument, NULL, 'Z' }, { "no_zebra", no_argument, NULL, 'Z' },
{ "socket_size", required_argument, NULL, 's' }, { "socket_size", required_argument, NULL, 's' },
{ "v6-with-v4-nexthops", no_argument, NULL, 'v' }, { "v6-with-v4-nexthops", no_argument, NULL, 'x' },
{ 0 } { 0 } };
};
/* signal definitions */ /* signal definitions */
void sighup(void); void sighup(void);
@ -385,11 +383,12 @@ int main(int argc, char **argv)
int buffer_size = BGP_SOCKET_SNDBUF_SIZE; int buffer_size = BGP_SOCKET_SNDBUF_SIZE;
char *address; char *address;
struct listnode *node; struct listnode *node;
bool v6_with_v4_nexthops = false;
addresses->cmp = (int (*)(void *, void *))strcmp; addresses->cmp = (int (*)(void *, void *))strcmp;
frr_preinit(&bgpd_di, argc, argv); 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" " -p, --bgp_port Set BGP listen port number (0 means do not listen).\n"
" -l, --listenon Listen on specified address (implies -n)\n" " -l, --listenon Listen on specified address (implies -n)\n"
" -n, --no_kernel Do not install route to kernel.\n" " -n, --no_kernel Do not install route to kernel.\n"
@ -398,7 +397,7 @@ int main(int argc, char **argv)
" -e, --ecmp Specify ECMP to use.\n" " -e, --ecmp Specify ECMP to use.\n"
" -I, --int_num Set instance number (label-manager)\n" " -I, --int_num Set instance number (label-manager)\n"
" -s, --socket_size Set BGP peer socket send buffer size\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. */ /* Command line argument treatment. */
while (1) { while (1) {
@ -460,8 +459,8 @@ int main(int argc, char **argv)
case 's': case 's':
buffer_size = atoi(optarg); buffer_size = atoi(optarg);
break; break;
case 'v': case 'x':
bm->v6_with_v4_nexthops = true; v6_with_v4_nexthops = true;
break; break;
default: default:
frr_help_exit(1); frr_help_exit(1);
@ -473,6 +472,7 @@ int main(int argc, char **argv)
/* BGP master init. */ /* BGP master init. */
bgp_master_init(frr_init(), buffer_size, addresses); bgp_master_init(frr_init(), buffer_size, addresses);
bm->port = bgp_port; bm->port = bgp_port;
bm->v6_with_v4_nexthops = v6_with_v4_nexthops;
if (bgp_port == 0) if (bgp_port == 0)
bgp_option_set(BGP_OPT_NO_LISTEN); bgp_option_set(BGP_OPT_NO_LISTEN);
if (no_fib_flag || no_zebra_flag) if (no_fib_flag || no_zebra_flag)

View File

@ -86,7 +86,7 @@ be specified (:ref:`common-invocation-options`).
be done to see if this is helping or not at the scale you are running be done to see if this is helping or not at the scale you are running
at. 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. 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 This allows bgp to install the v6 routes with a v6 nexthop that has the