mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 07:37:29 +00:00
zebra: Allow runtime determination of v6 RR semantics
The linux kernel is getting the same Route Replace semantics for v6 that v4 uses. Allow the end-user to know if their kernel has this ability and if so to specify it so zebra can take advantage of this. Why not do auto-detection? Because you would have to write code in zebra to add a route then add the same route again with different nexthops to see if which semantics it is using. It sure is easier to just add a cli that allows the user to do it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
29be7d92cc
commit
6b093863ec
51
zebra/main.c
51
zebra/main.c
@ -75,24 +75,29 @@ int allow_delete = 0;
|
|||||||
/* Don't delete kernel route. */
|
/* Don't delete kernel route. */
|
||||||
int keep_kernel_mode = 0;
|
int keep_kernel_mode = 0;
|
||||||
|
|
||||||
|
bool v6_rr_semantics = false;
|
||||||
|
|
||||||
#ifdef HAVE_NETLINK
|
#ifdef HAVE_NETLINK
|
||||||
/* Receive buffer size for netlink socket */
|
/* Receive buffer size for netlink socket */
|
||||||
uint32_t nl_rcvbufsize = 4194304;
|
uint32_t nl_rcvbufsize = 4194304;
|
||||||
#endif /* HAVE_NETLINK */
|
#endif /* HAVE_NETLINK */
|
||||||
|
|
||||||
|
#define OPTION_V6_RR_SEMANTICS 2000
|
||||||
/* Command line options. */
|
/* Command line options. */
|
||||||
struct option longopts[] = {{"batch", no_argument, NULL, 'b'},
|
struct option longopts[] = {
|
||||||
{"allow_delete", no_argument, NULL, 'a'},
|
{"batch", no_argument, NULL, 'b'},
|
||||||
{"keep_kernel", no_argument, NULL, 'k'},
|
{"allow_delete", no_argument, NULL, 'a'},
|
||||||
{"socket", required_argument, NULL, 'z'},
|
{"keep_kernel", no_argument, NULL, 'k'},
|
||||||
{"ecmp", required_argument, NULL, 'e'},
|
{"socket", required_argument, NULL, 'z'},
|
||||||
{"label_socket", no_argument, NULL, 'l'},
|
{"ecmp", required_argument, NULL, 'e'},
|
||||||
{"retain", no_argument, NULL, 'r'},
|
{"label_socket", no_argument, NULL, 'l'},
|
||||||
|
{"retain", no_argument, NULL, 'r'},
|
||||||
#ifdef HAVE_NETLINK
|
#ifdef HAVE_NETLINK
|
||||||
{"vrfwnetns", no_argument, NULL, 'n'},
|
{"vrfwnetns", no_argument, NULL, 'n'},
|
||||||
{"nl-bufsize", required_argument, NULL, 's'},
|
{"nl-bufsize", required_argument, NULL, 's'},
|
||||||
|
{"v6-rr-semantics", no_argument, NULL, OPTION_V6_RR_SEMANTICS},
|
||||||
#endif /* HAVE_NETLINK */
|
#endif /* HAVE_NETLINK */
|
||||||
{0}};
|
{0}};
|
||||||
|
|
||||||
zebra_capabilities_t _caps_p[] = {
|
zebra_capabilities_t _caps_p[] = {
|
||||||
ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN, ZCAP_NET_RAW,
|
ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN, ZCAP_NET_RAW,
|
||||||
@ -224,21 +229,22 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
longopts,
|
longopts,
|
||||||
" -b, --batch Runs in batch mode\n"
|
" -b, --batch Runs in batch mode\n"
|
||||||
" -a, --allow_delete Allow other processes to delete zebra routes\n"
|
" -a, --allow_delete Allow other processes to delete zebra routes\n"
|
||||||
" -z, --socket Set path of zebra socket\n"
|
" -z, --socket Set path of zebra socket\n"
|
||||||
" -e, --ecmp Specify ECMP to use.\n"
|
" -e, --ecmp Specify ECMP to use.\n"
|
||||||
" -l, --label_socket Socket to external label manager\n"
|
" -l, --label_socket Socket to external label manager\n"
|
||||||
" -k, --keep_kernel Don't delete old routes which installed by zebra.\n"
|
" -k, --keep_kernel Don't delete old routes which installed by zebra.\n"
|
||||||
" -r, --retain When program terminates, retain added route by zebra.\n"
|
" -r, --retain When program terminates, retain added route by zebra.\n"
|
||||||
#ifdef HAVE_NETLINK
|
#ifdef HAVE_NETLINK
|
||||||
" -n, --vrfwnetns Set VRF with NetNS\n"
|
" -n, --vrfwnetns Set VRF with NetNS\n"
|
||||||
" -s, --nl-bufsize Set netlink receive buffer size\n"
|
" -s, --nl-bufsize Set netlink receive buffer size\n"
|
||||||
|
" --v6-rr-semantics Use v6 RR semantics\n"
|
||||||
#endif /* HAVE_NETLINK */
|
#endif /* HAVE_NETLINK */
|
||||||
#if defined(HANDLE_ZAPI_FUZZING)
|
#if defined(HANDLE_ZAPI_FUZZING)
|
||||||
" -c <file> Bypass normal startup use this file for tetsting of zapi"
|
" -c <file> Bypass normal startup use this file for tetsting of zapi"
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int opt = frr_getopt(argc, argv, NULL);
|
int opt = frr_getopt(argc, argv, NULL);
|
||||||
@ -292,6 +298,9 @@ int main(int argc, char **argv)
|
|||||||
logicalrouter_configure_backend(
|
logicalrouter_configure_backend(
|
||||||
LOGICALROUTER_BACKEND_OFF);
|
LOGICALROUTER_BACKEND_OFF);
|
||||||
break;
|
break;
|
||||||
|
case OPTION_V6_RR_SEMANTICS:
|
||||||
|
v6_rr_semantics = true;
|
||||||
|
break;
|
||||||
#endif /* HAVE_NETLINK */
|
#endif /* HAVE_NETLINK */
|
||||||
#if defined(HANDLE_ZAPI_FUZZING)
|
#if defined(HANDLE_ZAPI_FUZZING)
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -456,4 +456,5 @@ extern void static_config_install_delayed_routes(struct zebra_vrf *zvrf);
|
|||||||
|
|
||||||
extern pid_t pid;
|
extern pid_t pid;
|
||||||
|
|
||||||
|
extern bool v6_rr_semantics;
|
||||||
#endif /*_ZEBRA_RIB_H */
|
#endif /*_ZEBRA_RIB_H */
|
||||||
|
@ -1696,7 +1696,7 @@ void kernel_route_rib(struct route_node *rn, struct prefix *p,
|
|||||||
assert(old || new);
|
assert(old || new);
|
||||||
|
|
||||||
if (new) {
|
if (new) {
|
||||||
if (p->family == AF_INET)
|
if (p->family == AF_INET || v6_rr_semantics)
|
||||||
ret = netlink_route_multipath(RTM_NEWROUTE, p, src_p,
|
ret = netlink_route_multipath(RTM_NEWROUTE, p, src_p,
|
||||||
new, (old) ? 1 : 0);
|
new, (old) ? 1 : 0);
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user