From 05e68acc7598bce8859ab15581950f219c40e7dd Mon Sep 17 00:00:00 2001 From: Babis Chalios Date: Tue, 4 Aug 2020 15:19:25 +0200 Subject: bgpd: fix invocation of bgpTrapBackwardTransition The bgpTrapBackwardTransition callback was being called only during bgp_stop and only under the condition that peer status was Established. The MIB defines that the event should be generated for every transition of the BGP FSM from a higher to a lower state. Signed-off-by: Babis Chalios --- bgpd/bgp_fsm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bgpd/bgp_fsm.c') diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 28e93c409..81025543b 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1105,6 +1105,10 @@ void bgp_fsm_change_status(struct peer *peer, int status) peer->ostatus = peer->status; peer->status = status; + /* Fire backward transition hook if that's the case */ + if (peer->ostatus > peer->status) + hook_call(peer_backward_transition, peer); + /* Save event that caused status change. */ peer->last_major_event = peer->cur_event; @@ -1268,8 +1272,6 @@ int bgp_stop(struct peer *peer) peer->host); update_group_remove_peer_afs(peer); - hook_call(peer_backward_transition, peer); - /* Reset peer synctime */ peer->synctime = 0; } -- cgit v1.2.3