diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2024-05-20 15:20:12 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-20 15:20:12 -0400 | 
| commit | 1608b27c5c59793cbe99ccc9c0e123bb19cdb735 (patch) | |
| tree | e3e41a081aebca0651b179a286cefbeb80a398d5 | |
| parent | 90165b9daec66aec0b2ada6d95e3d28830b0641f (diff) | |
| parent | 8b6ba461200d29bdb07fe4ef4833921d29d2e6ec (diff) | |
Merge pull request #16047 from FRRouting/mergify/bp/stable/10.0/pr-16022
bgpd: Fix `match peer` when switching between IPv4/IPv6/interface (backport #16022)
| -rw-r--r-- | bgpd/bgp_routemap.c | 38 | 
1 files changed, 17 insertions, 21 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d5cf6c42be..dbc3d6445d 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -5219,27 +5219,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);  }  | 
