diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-01-11 17:07:07 -0500 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-01-11 17:07:07 -0500 |
| commit | 89898ced5fd06b57912227af2275c41592c30f0a (patch) | |
| tree | e7ae9bc6c1089bb3351c20b5600bf87cdce735da | |
| parent | c1240044fbf081bb7407b1449d3954e4b63fec9f (diff) | |
bgpd: preserve admin shutdown on peer-group add
When a peer configured with administrative shutdown is added to a peer
group, the administrative shutdown status is discarded and the peer will
enter the BGP FSM. This is not what we want. Preserve the flag instead.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| -rw-r--r-- | bgpd/bgpd.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index d76d5b0b7e..2e660c20eb 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -866,8 +866,7 @@ static void peer_af_flag_reset(struct peer *peer, afi_t afi, safi_t safi) /* peer global config reset */ static void peer_global_config_reset(struct peer *peer) { - - int v6only; + int saved_flags = 0; peer->change_local_as = 0; peer->ttl = (peer_sort(peer) == BGP_PEER_IBGP ? MAXTTL : 1); @@ -885,13 +884,11 @@ static void peer_global_config_reset(struct peer *peer) else peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; - /* This is a per-peer specific flag and so we must preserve it */ - v6only = CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); - + /* These are per-peer specific flags and so we must preserve them */ + saved_flags |= CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); + saved_flags |= CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN); peer->flags = 0; - - if (v6only) - SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); + SET_FLAG(peer->flags, saved_flags); peer->config = 0; peer->holdtime = 0; @@ -2342,7 +2339,7 @@ static void peer_group2peer_config_copy(struct peer_group *group, struct peer *peer) { struct peer *conf; - int v6only; + int saved_flags = 0; conf = group->conf; @@ -2360,14 +2357,11 @@ static void peer_group2peer_config_copy(struct peer_group *group, /* GTSM hops */ peer->gtsm_hops = conf->gtsm_hops; - /* this flag is per-neighbor and so has to be preserved */ - v6only = CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); - - /* peer flags apply */ + /* These are per-peer specific flags and so we must preserve them */ + saved_flags |= CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); + saved_flags |= CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN); peer->flags = conf->flags; - - if (v6only) - SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); + SET_FLAG(peer->flags, saved_flags); /* peer config apply */ peer->config = conf->config; |
