summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_errors.c6
-rw-r--r--bgpd/bgp_errors.h1
-rw-r--r--bgpd/bgp_fsm.c14
-rw-r--r--bgpd/bgpd.c18
4 files changed, 39 insertions, 0 deletions
diff --git a/bgpd/bgp_errors.c b/bgpd/bgp_errors.c
index bd42901c2..7cebd0e48 100644
--- a/bgpd/bgp_errors.c
+++ b/bgpd/bgp_errors.c
@@ -463,6 +463,12 @@ static struct log_ref ferr_bgp_err[] = {
.suggestion = "Gather log files from the router and open an issue, Restart FRR"
},
{
+ .code = EC_BGP_DOPPELGANGER_CONFIG,
+ .title = "BGP has detected a configuration overwrite during peer collision resolution",
+ .description = "As part of BGP startup, the peer and ourselves can start connections to each other at the same time. During this process BGP received additional configuration, but it was only applied to one of the two nascent connections. Depending on the result of collision detection and resolution this configuration might be lost. To remedy this, after performing collision detection and resolution the peer session has been reset in order to apply the new configuration.",
+ .suggestion = "Gather data and open a Issue so that this developmental escape can be fixed, the peer should have been reset",
+ },
+ {
.code = END_FERR,
}
};
diff --git a/bgpd/bgp_errors.h b/bgpd/bgp_errors.h
index 853f2da22..13bd318e2 100644
--- a/bgpd/bgp_errors.h
+++ b/bgpd/bgp_errors.h
@@ -99,6 +99,7 @@ enum bgp_log_refs {
EC_BGP_CAPABILITY_VENDOR,
EC_BGP_CAPABILITY_UNKNOWN,
EC_BGP_INVALID_NEXTHOP_LENGTH,
+ EC_BGP_DOPPELGANGER_CONFIG,
};
extern void bgp_error_init(void);
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 384d2bca8..65b8b5bd2 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -125,6 +125,20 @@ static struct peer *peer_xfer_conn(struct peer *from_peer)
if (!peer || !CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
return from_peer;
+ /*
+ * Let's check that we are not going to loose known configuration
+ * state based upon doppelganger rules.
+ */
+ FOREACH_AFI_SAFI (afi, safi) {
+ if (from_peer->afc[afi][safi] != peer->afc[afi][safi]) {
+ flog_err(
+ EC_BGP_DOPPELGANGER_CONFIG,
+ "from_peer->afc[%d][%d] is not the same as what we are overwriting",
+ afi, safi);
+ return NULL;
+ }
+ }
+
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s: peer transfer %p fd %d -> %p fd %d)",
from_peer->host, from_peer, from_peer->fd, peer,
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index e4dedc242..fcb7eca0f 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1802,6 +1802,7 @@ static void peer_group2peer_config_copy_af(struct peer_group *group,
static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
{
int active;
+ struct peer *other;
if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
flog_err(EC_BGP_PEER_GROUP, "%s was called for peer-group %s",
@@ -1852,6 +1853,23 @@ static int peer_activate_af(struct peer *peer, afi_t afi, safi_t safi)
bgp_notify_send(peer, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
+ /*
+ * If we are turning on a AFI/SAFI locally and we've
+ * started bringing a peer up, we need to tell
+ * the other peer to restart because we might loose
+ * configuration here because when the doppelganger
+ * gets to a established state due to how
+ * we resolve we could just overwrite the afi/safi
+ * activation.
+ */
+ other = peer->doppelganger;
+ if (other
+ && (other->status == OpenSent
+ || other->status == OpenConfirm)) {
+ other->last_reset = PEER_DOWN_AF_ACTIVATE;
+ bgp_notify_send(other, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
return 0;