Skip to content

Commit

Permalink
Merge pull request #16048 from FRRouting/mergify/bp/stable/9.1/pr-16022
Browse files Browse the repository at this point in the history
bgpd: Fix `match peer` when switching between IPv4/IPv6/interface (backport #16022)
  • Loading branch information
donaldsharp authored May 20, 2024
2 parents 488c106 + ad48857 commit f6b0597
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions bgpd/bgp_routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5200,27 +5200,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);
}
Expand Down

0 comments on commit f6b0597

Please sign in to comment.