Merge pull request #17705 from opensourcerouting/fix/enforce-first-as_peer-group

bgpd: Fix enforce-first-as per peer-group removal
This commit is contained in:
Jafar Al-Gharaibeh 2024-12-21 22:54:50 -06:00 committed by GitHub
commit 79be632713
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 7 deletions

View File

@ -18783,7 +18783,11 @@ static void bgp_config_write_peer_global(struct vty *vty, struct bgp *bgp,
/* enforce-first-as */ /* enforce-first-as */
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS)) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS)) {
if (!peergroup_flag_check(peer, PEER_FLAG_ENFORCE_FIRST_AS)) /* The `no` form is printed because by default this enforcing
* is enabled, thus we need to print it inverted.
* See peer_new().
*/
if (peergroup_flag_check(peer, PEER_FLAG_ENFORCE_FIRST_AS))
vty_out(vty, " no neighbor %s enforce-first-as\n", addr); vty_out(vty, " no neighbor %s enforce-first-as\n", addr);
} else { } else {
if (peergroup_flag_check(peer, PEER_FLAG_ENFORCE_FIRST_AS)) if (peergroup_flag_check(peer, PEER_FLAG_ENFORCE_FIRST_AS))

View File

@ -1560,8 +1560,13 @@ struct peer *peer_new(struct bgp *bgp)
SET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN); SET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS)) /* By default this is enabled, thus we need to mark it as
peer_flag_set(peer, PEER_FLAG_ENFORCE_FIRST_AS); * inverted in order to display correctly in the configuration.
*/
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS)) {
SET_FLAG(peer->flags_invert, PEER_FLAG_ENFORCE_FIRST_AS);
SET_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS);
}
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY)) if (CHECK_FLAG(bgp->flags, BGP_FLAG_SOFT_VERSION_CAPABILITY))
peer_flag_set(peer, PEER_FLAG_CAPABILITY_SOFT_VERSION); peer_flag_set(peer, PEER_FLAG_CAPABILITY_SOFT_VERSION);

View File

@ -2,10 +2,12 @@
router bgp 65001 router bgp 65001
bgp router-id 10.10.10.1 bgp router-id 10.10.10.1
no bgp ebgp-requires-policy no bgp ebgp-requires-policy
no bgp enforce-first-as neighbor pg peer-group
neighbor 2001:db8:1::1 remote-as external neighbor pg remote-as external
neighbor 2001:db8:1::1 timers 3 10 neighbor pg timers 1 3
neighbor 2001:db8:1::1 timers connect 1 neighbor pg timers connect 1
no neighbor pg enforce-first-as
neighbor 2001:db8:1::1 peer-group pg
address-family ipv6 unicast address-family ipv6 unicast
redistribute connected redistribute connected
neighbor 2001:db8:1::1 activate neighbor 2001:db8:1::1 activate