Skip to content

Commit 02e556b

Browse files
authored
Merge pull request #17067 from FRRouting/mergify/bp/stable/10.1/pr-17059
bgpd: Move some non BGP-specific route-map functions to lib (backport #17059)
2 parents 7ecf4f2 + 6685763 commit 02e556b

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
@@ -7236,43 +7236,6 @@ DEFUN_YANG (no_set_aggregator_as,
72367236
return nb_cli_apply_changes(vty, NULL);
72377237
}
72387238

7239-
DEFUN_YANG (match_ipv6_next_hop,
7240-
match_ipv6_next_hop_cmd,
7241-
"match ipv6 next-hop ACCESSLIST6_NAME",
7242-
MATCH_STR
7243-
IPV6_STR
7244-
"Match IPv6 next-hop address of route\n"
7245-
"IPv6 access-list name\n")
7246-
{
7247-
const char *xpath =
7248-
"./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
7249-
char xpath_value[XPATH_MAXLEN];
7250-
7251-
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
7252-
snprintf(xpath_value, sizeof(xpath_value),
7253-
"%s/rmap-match-condition/list-name", xpath);
7254-
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
7255-
argv[argc - 1]->arg);
7256-
7257-
return nb_cli_apply_changes(vty, NULL);
7258-
}
7259-
7260-
DEFUN_YANG (no_match_ipv6_next_hop,
7261-
no_match_ipv6_next_hop_cmd,
7262-
"no match ipv6 next-hop [ACCESSLIST6_NAME]",
7263-
NO_STR
7264-
MATCH_STR
7265-
IPV6_STR
7266-
"Match IPv6 next-hop address of route\n"
7267-
"IPv6 access-list name\n")
7268-
{
7269-
const char *xpath =
7270-
"./match-condition[condition='frr-route-map:ipv6-next-hop-list']";
7271-
7272-
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
7273-
return nb_cli_apply_changes(vty, NULL);
7274-
}
7275-
72767239
DEFUN_YANG (match_ipv6_next_hop_address,
72777240
match_ipv6_next_hop_address_cmd,
72787241
"match ipv6 next-hop address X:X::X:X",
@@ -7330,45 +7293,6 @@ ALIAS_HIDDEN (no_match_ipv6_next_hop_address,
73307293
"Match IPv6 next-hop address of route\n"
73317294
"IPv6 address of next hop\n")
73327295

7333-
DEFUN_YANG (match_ipv6_next_hop_prefix_list,
7334-
match_ipv6_next_hop_prefix_list_cmd,
7335-
"match ipv6 next-hop prefix-list PREFIXLIST_NAME",
7336-
MATCH_STR
7337-
IPV6_STR
7338-
"Match IPv6 next-hop address of route\n"
7339-
"Match entries by prefix-list\n"
7340-
"IPv6 prefix-list name\n")
7341-
{
7342-
const char *xpath =
7343-
"./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
7344-
char xpath_value[XPATH_MAXLEN];
7345-
7346-
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
7347-
snprintf(xpath_value, sizeof(xpath_value),
7348-
"%s/rmap-match-condition/list-name", xpath);
7349-
nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
7350-
argv[argc - 1]->arg);
7351-
7352-
return nb_cli_apply_changes(vty, NULL);
7353-
}
7354-
7355-
DEFUN_YANG (no_match_ipv6_next_hop_prefix_list,
7356-
no_match_ipv6_next_hop_prefix_list_cmd,
7357-
"no match ipv6 next-hop prefix-list [PREFIXLIST_NAME]",
7358-
NO_STR
7359-
MATCH_STR
7360-
IPV6_STR
7361-
"Match IPv6 next-hop address of route\n"
7362-
"Match entries by prefix-list\n"
7363-
"IPv6 prefix-list name\n")
7364-
{
7365-
const char *xpath =
7366-
"./match-condition[condition='frr-route-map:ipv6-next-hop-prefix-list']";
7367-
7368-
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
7369-
return nb_cli_apply_changes(vty, NULL);
7370-
}
7371-
73727296
DEFPY_YANG (match_ipv4_next_hop,
73737297
match_ipv4_next_hop_cmd,
73747298
"match ip next-hop address A.B.C.D",
@@ -8041,12 +7965,8 @@ void bgp_route_map_init(void)
80417965
route_map_install_set(&route_set_ipv6_nexthop_peer_cmd);
80427966
route_map_install_match(&route_match_rpki_extcommunity_cmd);
80437967

8044-
install_element(RMAP_NODE, &match_ipv6_next_hop_cmd);
80457968
install_element(RMAP_NODE, &match_ipv6_next_hop_address_cmd);
8046-
install_element(RMAP_NODE, &match_ipv6_next_hop_prefix_list_cmd);
8047-
install_element(RMAP_NODE, &no_match_ipv6_next_hop_cmd);
80487969
install_element(RMAP_NODE, &no_match_ipv6_next_hop_address_cmd);
8049-
install_element(RMAP_NODE, &no_match_ipv6_next_hop_prefix_list_cmd);
80507970
install_element(RMAP_NODE, &match_ipv6_next_hop_old_cmd);
80517971
install_element(RMAP_NODE, &no_match_ipv6_next_hop_old_cmd);
80527972
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",
@@ -1665,6 +1733,11 @@ void route_map_cli_init(void)
16651733
install_element(RMAP_NODE, &match_ipv6_next_hop_type_cmd);
16661734
install_element(RMAP_NODE, &no_match_ipv6_next_hop_type_cmd);
16671735

1736+
install_element(RMAP_NODE, &match_ipv6_next_hop_cmd);
1737+
install_element(RMAP_NODE, &match_ipv6_next_hop_prefix_list_cmd);
1738+
install_element(RMAP_NODE, &no_match_ipv6_next_hop_cmd);
1739+
install_element(RMAP_NODE, &no_match_ipv6_next_hop_prefix_list_cmd);
1740+
16681741
install_element(RMAP_NODE, &match_metric_cmd);
16691742
install_element(RMAP_NODE, &no_match_metric_cmd);
16701743

0 commit comments

Comments
 (0)