Fix race condition that breaks BGP connections after reconfigure.
RFC says that only connections in OpenConfirm and Established state should participate in connection collision detection. The current implementation leads to race condition when both sides are trying to connect at the almost same time, then both sides receive OPEN message by different connections at the almost same time and close the other connection. Both connections are closed and the both sides end in start/idle or start/active state.
This commit is contained in:
parent
f0ad56f441
commit
e16466b379
1 changed files with 0 additions and 3 deletions
|
@ -510,12 +510,9 @@ bgp_rx_open(struct bgp_conn *conn, byte *pkt, int len)
|
||||||
switch (other->state)
|
switch (other->state)
|
||||||
{
|
{
|
||||||
case BS_IDLE:
|
case BS_IDLE:
|
||||||
break;
|
|
||||||
case BS_CONNECT:
|
case BS_CONNECT:
|
||||||
case BS_ACTIVE:
|
case BS_ACTIVE:
|
||||||
case BS_OPENSENT:
|
case BS_OPENSENT:
|
||||||
BGP_TRACE(D_EVENTS, "Connection collision, giving up the other connection");
|
|
||||||
bgp_close_conn(other);
|
|
||||||
break;
|
break;
|
||||||
case BS_OPENCONFIRM:
|
case BS_OPENCONFIRM:
|
||||||
if ((p->local_id < id) == (conn == &p->incoming_conn))
|
if ((p->local_id < id) == (conn == &p->incoming_conn))
|
||||||
|
|
Loading…
Reference in a new issue