From 746541a0217b3db7f78873604676de2f7a166331 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 6 Dec 2024 08:25:09 +0200 Subject: [PATCH] bgpd: Check if as_type is not specified when peer is a peer-group member Fixes this sequences: ``` neighbor pg4 peer-group neighbor 127.0.0.4 peer-group pg4 neighbor 127.0.0.4 remote-as 65004 neighbor pg5 peer-group neighbor 127.0.0.5 peer-group pg5 neighbor 127.0.0.5 remote-as internal ``` Fixes: 0dfe256 ("bgpd: Implement neighbor X remote-as auto") Signed-off-by: Donatas Abraitis (cherry picked from commit 2797506a5ea6d9de8fd7ee217879c15ee9c5acd6) --- bgpd/bgpd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index e08e72e01cbc..c452040f8ddc 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -2195,8 +2195,7 @@ int peer_remote_as(struct bgp *bgp, union sockunion *su, const char *conf_if, /* When this peer is a member of peer-group. */ if (peer->group) { /* peer-group already has AS number/internal/external */ - if (peer->group->conf->as - || peer->group->conf->as_type) { + if (peer->group->conf->as || peer->group->conf->as_type != AS_UNSPECIFIED) { /* Return peer group's AS number. */ *as = peer->group->conf->as; return BGP_ERR_PEER_GROUP_MEMBER;