[bgpd] Bug #302 fixes. ClearingCompleted event gets flushed, leaving peers stuck in Clearing.
2006-10-14 Paul Jakma <paul.jakma@sun.com>
* bgp_fsm.h: Remove BGP_EVENT_FLUSH_ADD, dangerous and not
needed.
* bgp_fsm.c: (bgp_stop) Move BGP_EVENT_FLUSH to the top of the
of the function, otherwise it could flush a ClearingCompleted
event, bug #302.
* bgp_packet.c: Replace all BGP_EVENT_FLUSH_ADD with
BGP_EVENT_ADD, fixing bug #302.
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index cc2b2c3..ef8dfea 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -428,6 +428,9 @@
safi_t safi;
char orf_name[BUFSIZ];
+ /* Delete all existing events of the peer */
+ BGP_EVENT_FLUSH (peer);
+
/* Increment Dropped count. */
if (peer->status == Established)
{
@@ -499,9 +502,6 @@
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv);
- /* Delete all existing events of the peer */
- BGP_EVENT_FLUSH (peer);
-
/* Stream reset. */
peer->packet_size = 0;