Skip to content

Commit 165d1a2

Browse files
authored
Merge pull request #17069 from FRRouting/mergify/bp/stable/9.1/pr-17059
bgpd: Move some non BGP-specific route-map functions to lib (backport #17059)
2 parents 739b823 + 524ad5c commit 165d1a2

File tree

2 files changed

+73
-80
lines changed

2 files changed

+73
-80
lines changed

bgpd/bgp_routemap.c

-80
Original file line numberDiff line numberDiff line change
@@ -7218,43 +7218,6 @@ DEFUN_YANG (no_set_aggregator_as,
72187218
return nb_cli_apply_changes(vty, NULL);
72197219
}
72207220

7221-
DEFUN_YANG (match_ipv6_next_hop,
7222-
match_ipv6_next_hop_cmd,
7223-
"match ipv6 next-hop ACCESSLIST6_NAME",
7224-
MATCH_STR
7225-
IPV6_STR
7226-
"Match IPv6 next-hop address of route\n"
7227-
"IPv6 access-list name\n")
7228-
{
7229-
const char *xpath =
7230-
"./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
7231-
char xpath_value[XPATH_MAXLEN];
7232-
7233-
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
7234-
snprintf(xpath_value, sizeof(xpath_value),
7235-
"%s/rmap-match-condition/list-name", xpath);
7236-
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
7237-
argv[argc - 1]->arg);
7238-
7239-
return nb_cli_apply_changes(vty, NULL);
7240-
}
7241-
7242-
DEFUN_YANG (no_match_ipv6_next_hop,
7243-
no_match_ipv6_next_hop_cmd,
7244-
"no match ipv6 next-hop [ACCESSLIST6_NAME]",
7245-
NO_STR
7246-
MATCH_STR
7247-
IPV6_STR
7248-
"Match IPv6 next-hop address of route\n"
7249-
"IPv6 access-list name\n")
7250-
{
7251-
const char *xpath =
7252-
"./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
7253-
7254-
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
7255-
return nb_cli_apply_changes(vty, NULL);
7256-
}
7257-
72587221
DEFUN_YANG (match_ipv6_next_hop_address,
72597222
match_ipv6_next_hop_address_cmd,
72607223
"match ipv6 next-hop address X:X::X:X",
@@ -7312,45 +7275,6 @@ ALIAS_HIDDEN (no_match_ipv6_next_hop_address,
73127275
"Match IPv6 next-hop address of route\n"
73137276
"IPv6 address of next hop\n")
73147277

7315-
DEFUN_YANG (match_ipv6_next_hop_prefix_list,
7316-
match_ipv6_next_hop_prefix_list_cmd,
7317-
"match ipv6 next-hop prefix-list PREFIXLIST_NAME",
7318-
MATCH_STR
7319-
IPV6_STR
7320-
"Match IPv6 next-hop address of route\n"
7321-
"Match entries by prefix-list\n"
7322-
"IPv6 prefix-list name\n")
7323-
{
7324-
const char *xpath =
7325-
"./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
7326-
char xpath_value[XPATH_MAXLEN];
7327-
7328-
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
7329-
snprintf(xpath_value, sizeof(xpath_value),
7330-
"%s/rmap-match-condition/list-name", xpath);
7331-
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
7332-
argv[argc - 1]->arg);
7333-
7334-
return nb_cli_apply_changes(vty, NULL);
7335-
}
7336-
7337-
DEFUN_YANG (no_match_ipv6_next_hop_prefix_list,
7338-
no_match_ipv6_next_hop_prefix_list_cmd,
7339-
"no match ipv6 next-hop prefix-list [PREFIXLIST_NAME]",
7340-
NO_STR
7341-
MATCH_STR
7342-
IPV6_STR
7343-
"Match IPv6 next-hop address of route\n"
7344-
"Match entries by prefix-list\n"
7345-
"IPv6 prefix-list name\n")
7346-
{
7347-
const char *xpath =
7348-
"./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
7349-
7350-
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
7351-
return nb_cli_apply_changes(vty, NULL);
7352-
}
7353-
73547278
DEFPY_YANG (match_ipv4_next_hop,
73557279
match_ipv4_next_hop_cmd,
73567280
"match ip next-hop address A.B.C.D",
@@ -8023,12 +7947,8 @@ void bgp_route_map_init(void)
80237947
route_map_install_set(&route_set_ipv6_nexthop_peer_cmd);
80247948
route_map_install_match(&route_match_rpki_extcommunity_cmd);
80257949

8026-
install_element(RMAP_NODE, &match_ipv6_next_hop_cmd);
80277950
install_element(RMAP_NODE, &match_ipv6_next_hop_address_cmd);
8028-
install_element(RMAP_NODE, &match_ipv6_next_hop_prefix_list_cmd);
8029-
install_element(RMAP_NODE, &no_match_ipv6_next_hop_cmd);
80307951
install_element(RMAP_NODE, &no_match_ipv6_next_hop_address_cmd);
8031-
install_element(RMAP_NODE, &no_match_ipv6_next_hop_prefix_list_cmd);
80327952
install_element(RMAP_NODE, &match_ipv6_next_hop_old_cmd);
80337953
install_element(RMAP_NODE, &no_match_ipv6_next_hop_old_cmd);
80347954
install_element(RMAP_NODE, &match_ipv4_next_hop_cmd);

lib/routemap_cli.c

+73
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,74 @@ DEFPY_YANG(
417417
return nb_cli_apply_changes(vty, NULL);
418418
}
419419

420+
DEFUN_YANG (match_ipv6_next_hop,
421+
match_ipv6_next_hop_cmd,
422+
"match ipv6 next-hop ACCESSLIST6_NAME",
423+
MATCH_STR
424+
IPV6_STR
425+
"Match IPv6 next-hop address of route\n"
426+
"IPv6 access-list name\n")
427+
{
428+
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
429+
char xpath_value[XPATH_MAXLEN];
430+
431+
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
432+
snprintf(xpath_value, sizeof(xpath_value), "%s/rmap-match-condition/list-name", xpath);
433+
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, argv[argc - 1]->arg);
434+
435+
return nb_cli_apply_changes(vty, NULL);
436+
}
437+
438+
DEFUN_YANG (no_match_ipv6_next_hop,
439+
no_match_ipv6_next_hop_cmd,
440+
"no match ipv6 next-hop [ACCESSLIST6_NAME]",
441+
NO_STR
442+
MATCH_STR
443+
IPV6_STR
444+
"Match IPv6 next-hop address of route\n"
445+
"IPv6 access-list name\n")
446+
{
447+
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
448+
449+
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
450+
return nb_cli_apply_changes(vty, NULL);
451+
}
452+
453+
DEFUN_YANG (match_ipv6_next_hop_prefix_list,
454+
match_ipv6_next_hop_prefix_list_cmd,
455+
"match ipv6 next-hop prefix-list PREFIXLIST_NAME",
456+
MATCH_STR
457+
IPV6_STR
458+
"Match IPv6 next-hop address of route\n"
459+
"Match entries by prefix-list\n"
460+
"IPv6 prefix-list name\n")
461+
{
462+
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
463+
char xpath_value[XPATH_MAXLEN];
464+
465+
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
466+
snprintf(xpath_value, sizeof(xpath_value), "%s/rmap-match-condition/list-name", xpath);
467+
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, argv[argc - 1]->arg);
468+
469+
return nb_cli_apply_changes(vty, NULL);
470+
}
471+
472+
DEFUN_YANG (no_match_ipv6_next_hop_prefix_list,
473+
no_match_ipv6_next_hop_prefix_list_cmd,
474+
"no match ipv6 next-hop prefix-list [PREFIXLIST_NAME]",
475+
NO_STR
476+
MATCH_STR
477+
IPV6_STR
478+
"Match IPv6 next-hop address of route\n"
479+
"Match entries by prefix-list\n"
480+
"IPv6 prefix-list name\n")
481+
{
482+
const char *xpath = "./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
483+
484+
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
485+
return nb_cli_apply_changes(vty, NULL);
486+
}
487+
420488
DEFPY_YANG(
421489
match_ipv6_next_hop_type, match_ipv6_next_hop_type_cmd,
422490
"match ipv6 next-hop type <blackhole>$type",
@@ -1644,6 +1712,11 @@ void route_map_cli_init(void)
16441712
install_element(RMAP_NODE, &match_ipv6_next_hop_type_cmd);
16451713
install_element(RMAP_NODE, &no_match_ipv6_next_hop_type_cmd);
16461714

1715+
install_element(RMAP_NODE, &match_ipv6_next_hop_cmd);
1716+
install_element(RMAP_NODE, &match_ipv6_next_hop_prefix_list_cmd);
1717+
install_element(RMAP_NODE, &no_match_ipv6_next_hop_cmd);
1718+
install_element(RMAP_NODE, &no_match_ipv6_next_hop_prefix_list_cmd);
1719+
16471720
install_element(RMAP_NODE, &match_metric_cmd);
16481721
install_element(RMAP_NODE, &no_match_metric_cmd);
16491722

0 commit comments

Comments
 (0)