Commit 48b15ef1 authored by Ondřej Zajíček's avatar Ondřej Zajíček

Fixes stuck connection during BGP session shutdown.

If TX buffers were full during BGP session shutdown
then a protocol waited indefinitely to be able to
send notification packet to close the session.
parent 354496ac
......@@ -384,10 +384,12 @@ bgp_conn_enter_close_state(struct bgp_conn *conn)
int os = conn->state;
bgp_conn_set_state(conn, BS_CLOSE);
conn->sk->rx_hook = NULL;
/* Timeout for CLOSE state, if we cannot send notification soon then we just hangup */
bgp_start_timer(conn->hold_timer, 10);
......@@ -478,9 +480,18 @@ static void
bgp_hold_timeout(timer *t)
struct bgp_conn *conn = t->data;
struct bgp_proto *p = conn->bgp;
DBG("BGP: Hold timeout\n");
/* We are already closing the connection - just do hangup */
if (conn->state == BS_CLOSE)
BGP_TRACE(D_EVENTS, "Connection stalled");
/* If there is something in input queue, we are probably congested
and perhaps just not processed BGP packets in time. */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment