summaryrefslogtreecommitdiff
path: root/proto/bgp/bgp.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2019-04-08 16:39:22 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2019-04-08 16:56:56 +0200
commit4a50c8bd0310053a3dcab45c8dde0362348c0503 (patch)
tree46f0b922b4a28c63f36cad87f7f6499bbaf52cb3 /proto/bgp/bgp.c
parent23ee6b1cd6dc597876d91db9a015f7a633764808 (diff)
BGP: Handle corner cases in event ordering
When BGP connection is opened, it may happen that rx hook (with remote OPEN) is called before tx hook (for local OPEN). Therefore, we need to do internal changes (like setting local_caps) synchronously with OPENSENT transition and we need to ensure that OPEN is sent before KEEPALIVE.
Diffstat (limited to 'proto/bgp/bgp.c')
-rw-r--r--proto/bgp/bgp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 92f41ef6..c332a836 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -892,6 +892,7 @@ bgp_send_open(struct bgp_conn *conn)
conn->sk->rx_hook = bgp_rx;
conn->sk->tx_hook = bgp_tx;
tm_stop(conn->connect_timer);
+ bgp_prepare_capabilities(conn);
bgp_schedule_packet(conn, NULL, PKT_OPEN);
bgp_conn_set_state(conn, BS_OPENSENT);
bgp_start_timer(conn->hold_timer, conn->bgp->cf->initial_hold_time);