bgpd: Respect enforce-first-as command for peer-groups according to the defaults

This was missed for peer-groups. Moved this default handling from peer_create()
to peer_new() which is also used by peer_group_get().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2023-12-08 13:00:08 +02:00
parent c659e1c349
commit ec2375e089

View File

@ -1493,6 +1493,9 @@ 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))
SET_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS);
/* Initialize per peer bgp GR FSM */ /* Initialize per peer bgp GR FSM */
bgp_peer_gr_init(peer); bgp_peer_gr_init(peer);
@ -1920,9 +1923,6 @@ struct peer *peer_create(union sockunion *su, const char *conf_if,
} }
} }
if (CHECK_FLAG(bgp->flags, BGP_FLAG_ENFORCE_FIRST_AS))
SET_FLAG(peer->flags, PEER_FLAG_ENFORCE_FIRST_AS);
/* auto shutdown if configured */ /* auto shutdown if configured */
if (bgp->autoshutdown) if (bgp->autoshutdown)
peer_flag_set(peer, PEER_FLAG_SHUTDOWN); peer_flag_set(peer, PEER_FLAG_SHUTDOWN);