summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-08-03 08:14:08 -0400
committerDonald Sharp <sharpd@nvidia.com>2023-08-03 08:25:20 -0400
commit0435b31bb8ed55377f83d0e19bc085abc3c71b44 (patch)
tree561de36e1be392990f873e826be9785ee2a4d7c0
parent95002ded3edc5694c7826558ed40b9dd0188c78c (diff)
bgpd: Allow bgp to specify if it will allow v6 routing with v4 nexthops
Add a `--v6-with-v4-nexthop` cli to bgp to allow it to peer with neighbors in the configuration where the interface has no v6 addresses at all and there is a v4 address that is usable as a v4 address embedded in a v6 address. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_main.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 074059c146..11917c6c4a 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -57,15 +57,17 @@
/* 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'},
- {0}};
+ { "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 }
+};
/* signal definitions */
void sighup(void);
@@ -387,16 +389,16 @@ int main(int argc, char **argv)
addresses->cmp = (int (*)(void *, void *))strcmp;
frr_preinit(&bgpd_di, argc, argv);
- frr_opt_add(
- "p:l:SnZe:I:s:" 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"
- " -I, --int_num Set instance number (label-manager)\n"
- " -s, --socket_size Set BGP peer socket send buffer size\n");
+ frr_opt_add("p:l:SnZe:I:s:" 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"
+ " -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");
/* Command line argument treatment. */
while (1) {
@@ -458,6 +460,9 @@ int main(int argc, char **argv)
case 's':
buffer_size = atoi(optarg);
break;
+ case 'v':
+ bm->v6_with_v4_nexthops = true;
+ break;
default:
frr_help_exit(1);
}