diff options
Diffstat (limited to 'bgpd/bgp_fsm.c')
-rw-r--r-- | bgpd/bgp_fsm.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 97c60b1c..2d06cb2a 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -481,7 +481,7 @@ bgp_fsm_disable_session(bgp_session session, bgp_notify notification) bgp_fsm_throw_exception(connection, bgp_session_eDisabled, notification, 0, bgp_fsm_BGP_Stop) ; else - bgp_notify_free(¬ification) ; + bgp_notify_free(notification) ; } ; /*------------------------------------------------------------------------------ @@ -621,8 +621,8 @@ bgp_fsm_connect_completed(bgp_connection connection, int err, { bgp_fsm_event(connection, bgp_fsm_TCP_connection_open) ; - connection->su_local = sockunion_dup(su_local) ; - connection->su_remote = sockunion_dup(su_remote) ; + sockunion_set_dup(&connection->su_local, su_local) ; + sockunion_set_dup(&connection->su_remote, su_remote) ; } else if ( (err == ECONNREFUSED) || (err == ECONNRESET) @@ -651,7 +651,7 @@ bgp_fsm_post_exception(bgp_connection connection, bgp_session_event_t except, if ( (connection->state != bgp_fsm_OpenSent) && (connection->state != bgp_fsm_OpenConfirm) && (connection->state != bgp_fsm_Established) ) - bgp_notify_free(¬ification) ; + bgp_notify_unset(¬ification) ; bgp_notify_set(&connection->notification, notification) ; @@ -1623,7 +1623,7 @@ bgp_fsm_event(bgp_connection connection, bgp_fsm_event_t event) /* Tidy up -- notification already cleared */ connection->except = bgp_session_null_event ; connection->err = 0 ; - bgp_notify_free(&connection->notification) ; /* if any */ + bgp_notify_unset(&connection->notification) ; /* if any */ } if (session != NULL) @@ -1823,21 +1823,30 @@ static bgp_fsm_action(bgp_fsm_fatal) /*------------------------------------------------------------------------------ * ConnectRetryTimer expired -- Connect/Active states. * + * If the connection failed, the connection will have been closed. For the + * secondary connection accept() will have been disabled. + * * For primary connection: * - * * close the existing connection (may already be closed if failed) + * * close the attempt to connect() (if still active) * * start the connect() attempt again * * For secondary connection: * - * * close the existing connection (easy, 'cos never opened !) * * re-enable accept (if has been cleared) and wait for same * + * If no accept() has been attempted, then accept will still be enabled, + * and re-enabling it will make no difference. + * + * NB: the connection remains in the current state, and the retry timer will + * still be running, because it automatically recharges. + * * NB: requires the session LOCKED */ static bgp_fsm_action(bgp_fsm_retry) { - bgp_connection_close(connection) ; + if (connection->ordinal == bgp_connection_primary) + bgp_connection_close_file(connection) ; bgp_fsm_post_exception(connection, bgp_session_eRetry, NULL, 0) ; |