summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-05-16 19:49:56 +0200
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-05-16 19:49:56 +0200
commitedfc03614f0c5e14cffde25afae111908cb3bf30 (patch)
treec5f1313004d44ecc8abf5019ff64ca30d3da5214 /bgpd
parentMerge pull request #16014 from pguibert6WIND/nexthop_rework (diff)
downloadfrr-edfc03614f0c5e14cffde25afae111908cb3bf30.tar.xz
frr-edfc03614f0c5e14cffde25afae111908cb3bf30.zip
bgpd: Fix `match peer` when switching between IPv4/IPv6/interface
Without this patch we MUST follow this sequence: ``` no match peer 10.0.0.1 match peer 2a01::1 ``` Otherwise, both IPv4/IPv6 values are set/compiled, thus when printing the configuration in show running, we see the first one (IPv4). Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_routemap.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index df5c2557b..dc26a1f5d 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -5234,27 +5234,23 @@ DEFPY_YANG (match_peer,
nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
- if (addrv4_str) {
- snprintf(
- xpath_value, sizeof(xpath_value),
- "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address",
- xpath);
- nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
- addrv4_str);
- } else if (addrv6_str) {
- snprintf(
- xpath_value, sizeof(xpath_value),
- "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address",
- xpath);
- nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY,
- addrv6_str);
- } else {
- snprintf(
- xpath_value, sizeof(xpath_value),
- "%s/rmap-match-condition/frr-bgp-route-map:peer-interface",
- xpath);
- nb_cli_enqueue_change(vty, xpath_value, NB_OP_MODIFY, intf);
- }
+ snprintf(xpath_value, sizeof(xpath_value),
+ "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address",
+ xpath);
+ nb_cli_enqueue_change(vty, xpath_value,
+ addrv4_str ? NB_OP_MODIFY : NB_OP_DESTROY,
+ addrv4_str);
+ snprintf(xpath_value, sizeof(xpath_value),
+ "%s/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address",
+ xpath);
+ nb_cli_enqueue_change(vty, xpath_value,
+ addrv6_str ? NB_OP_MODIFY : NB_OP_DESTROY,
+ addrv6_str);
+ snprintf(xpath_value, sizeof(xpath_value),
+ "%s/rmap-match-condition/frr-bgp-route-map:peer-interface",
+ xpath);
+ nb_cli_enqueue_change(vty, xpath_value,
+ intf ? NB_OP_MODIFY : NB_OP_DESTROY, intf);
return nb_cli_apply_changes(vty, NULL);
}