summaryrefslogtreecommitdiff
path: root/bgpd/bgp_packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_packet.c')
-rw-r--r--bgpd/bgp_packet.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 2a2c9bdba9..62be7ffbf7 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -1116,10 +1116,10 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
s = stream_new(peer->max_packet_size);
/* Make BGP update packet. */
- if (CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_RCV))
- bgp_packet_set_marker(s, BGP_MSG_ROUTE_REFRESH_NEW);
- else
- bgp_packet_set_marker(s, BGP_MSG_ROUTE_REFRESH_OLD);
+ if (!CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_RCV))
+ return;
+
+ bgp_packet_set_marker(s, BGP_MSG_ROUTE_REFRESH_NEW);
/* Encode Route Refresh message. */
stream_putw(s, pkt_afi);
@@ -2702,6 +2702,19 @@ static int bgp_notify_receive(struct peer_connection *connection,
inner.subcode == BGP_NOTIFY_OPEN_UNSUP_PARAM)
UNSET_FLAG(peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
+ /* Resend the next OPEN message with a global AS number if we received
+ * a `Bad Peer AS` notification. This is only valid if `dual-as` is
+ * configured.
+ */
+ if (inner.code == BGP_NOTIFY_OPEN_ERR &&
+ inner.subcode == BGP_NOTIFY_OPEN_BAD_PEER_AS &&
+ CHECK_FLAG(peer->flags, PEER_FLAG_DUAL_AS)) {
+ if (peer->change_local_as != peer->bgp->as)
+ peer->change_local_as = peer->bgp->as;
+ else
+ peer->change_local_as = peer->local_as;
+ }
+
/* If Graceful-Restart N-bit (Notification) is exchanged,
* and it's not a Hard Reset, let's retain the routes.
*/