diff options
-rw-r--r-- | bgpd/bgp_fsm.c | 10 | ||||
-rw-r--r-- | bgpd/bgp_notification.c | 13 | ||||
-rw-r--r-- | bgpd/bgp_notification.h | 3 | ||||
-rw-r--r-- | bgpd/bgp_session.c | 7 |
4 files changed, 27 insertions, 6 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index a3af93b7..88916948 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -481,7 +481,12 @@ bgp_fsm_disable_session(bgp_session session, bgp_notify notification) bgp_fsm_throw_exception(connection, bgp_session_eDisabled, notification, 0, bgp_fsm_eBGP_Stop) ; else - bgp_notify_free(notification) ; + { + /* Acknowledge the disable -- session is stopped. */ + bgp_session_event(session, bgp_session_eDisabled, NULL, 0, 0, 1) ; + + bgp_notify_free(notification) ; + } ; } ; /*------------------------------------------------------------------------------ @@ -1616,7 +1621,7 @@ bgp_fsm_event(bgp_connection connection, bgp_fsm_event_t event) */ if (connection->except <= bgp_session_max_event) bgp_session_event(session, connection->except, - connection->notification, + bgp_notify_take(&connection->notification), connection->err, connection->ordinal, (connection->state == bgp_fsm_sStopping)) ; @@ -2187,6 +2192,7 @@ bgp_fsm_catch(bgp_connection connection, bgp_fsm_state_t next_state) * When get Sent_NOTIFICATION_message, will set final "courtesy" timer, so * unless I/O fails, final end of process is HoldTimer expired (with * + * NB: leaves the notification sitting in the connection. */ static bgp_fsm_state_t bgp_fsm_send_notification(bgp_connection connection, bgp_fsm_state_t next_state) diff --git a/bgpd/bgp_notification.c b/bgpd/bgp_notification.c index 2343c785..50fe35a9 100644 --- a/bgpd/bgp_notification.c +++ b/bgpd/bgp_notification.c @@ -136,6 +136,19 @@ bgp_notify_unset(bgp_notify* p_notification) } ; /*------------------------------------------------------------------------------ + * Unset pointer to notification and free any existing notification structure. + * + * Does nothing if there is no structure. + */ +extern bgp_notify +bgp_notify_take(bgp_notify* p_notification) +{ + bgp_notify take = *p_notification ; /* take anything that's there */ + *p_notification = NULL ; + return take ; +} ; + +/*------------------------------------------------------------------------------ * Set pointer to notification * * Frees any existing notification at the destination. diff --git a/bgpd/bgp_notification.h b/bgpd/bgp_notification.h index f225b492..59887f91 100644 --- a/bgpd/bgp_notification.h +++ b/bgpd/bgp_notification.h @@ -129,6 +129,9 @@ bgp_notify_dup(bgp_notify notification) ; extern void bgp_notify_unset(bgp_notify* p_notification) ; +extern bgp_notify +bgp_notify_take(bgp_notify* p_notification) ; + extern void bgp_notify_set(bgp_notify* p_dst, bgp_notify src) ; diff --git a/bgpd/bgp_session.c b/bgpd/bgp_session.c index 0fe7a8dc..ac737faf 100644 --- a/bgpd/bgp_session.c +++ b/bgpd/bgp_session.c @@ -403,9 +403,6 @@ bgp_session_do_disable(mqueue_block mqb, mqb_flag_t flag) /* Get the FSM to send any notification and close connections */ bgp_fsm_disable_session(session, args->notification) ; - - /* Acknowledge the disable -- session is stopped. */ - bgp_session_event(session, bgp_session_eDisabled, NULL, 0, 0, 0) ; } ; mqb_free(mqb) ; @@ -413,6 +410,8 @@ bgp_session_do_disable(mqueue_block mqb, mqb_flag_t flag) /*============================================================================== * BGP Engine: send session event signal to Routeing Engine + * + * NB: is taking responsibility for the notification. */ extern void bgp_session_event(bgp_session session, bgp_session_event_t event, @@ -432,7 +431,7 @@ bgp_session_event(bgp_session session, bgp_session_event_t event, args = mqb_get_args(mqb) ; args->event = event ; - args->notification = bgp_notify_dup(notification) ; + args->notification = notification ; args->err = err ; args->ordinal = ordinal ; args->stopped = stopped, |