summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2006-07-02 11:01:50 +0000
committerPaul Jakma <paul.jakma@sun.com>2006-07-02 11:01:50 +0000
commit33d5ab9ef197ce281859f12251df4e412c469c65 (patch)
treee33b0687ecc11d38b11bc53774e095298cc22c5e /bgpd
parent9a57dc69d2432b6633fc47b05d4ee475a29db361 (diff)
[bgpd] Fix crash on shutdown of peer
2006-07-02 Paul Jakma <paul.jakma@sun.com> * bgp_fsm.c: (bgp_{stop,start}) Move clear/free of certain bits of state from stop to start, as they may be used via peer references on clearing queues..
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/ChangeLog6
-rw-r--r--bgpd/bgp_fsm.c41
2 files changed, 28 insertions, 19 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index 5176e2b6..a8a6c350 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-02 Paul Jakma <paul.jakma@sun.com>
+
+ * bgp_fsm.c: (bgp_{stop,start}) Move clear/free of certain
+ bits of state from stop to start, as they may be used via
+ peer references on clearing queues..
+
2006-05-23 Paul Jakma <paul.jakma@sun.com>
* bgp_vty.c: (neighbor_update_source_cmd) Expand tab completion
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index f5f7892b..770a7911 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -511,25 +511,6 @@ bgp_stop (struct peer *peer)
peer->fd = -1;
}
- /* Connection information. */
- if (peer->su_local)
- {
- sockunion_free (peer->su_local);
- peer->su_local = NULL;
- }
-
- if (peer->su_remote)
- {
- sockunion_free (peer->su_remote);
- peer->su_remote = NULL;
- }
-
- /* Clear remote router-id. */
- peer->remote_id.s_addr = 0;
-
- /* Clear peer capability flag. */
- peer->cap = 0;
-
for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
{
@@ -644,6 +625,28 @@ bgp_start (struct peer *peer)
{
int status;
+ /* Scrub some information that might be left over from a previous,
+ * session
+ */
+ /* Connection information. */
+ if (peer->su_local)
+ {
+ sockunion_free (peer->su_local);
+ peer->su_local = NULL;
+ }
+
+ if (peer->su_remote)
+ {
+ sockunion_free (peer->su_remote);
+ peer->su_remote = NULL;
+ }
+
+ /* Clear remote router-id. */
+ peer->remote_id.s_addr = 0;
+
+ /* Clear peer capability flag. */
+ peer->cap = 0;
+
/* If the peer is passive mode, force to move to Active mode. */
if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSIVE))
{