]> git.puffer.fish Git - mirror/frr.git/commitdiff
[bgpd] Fix crash on shutdown of peer
authorPaul Jakma <paul.jakma@sun.com>
Sun, 2 Jul 2006 11:01:50 +0000 (11:01 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Sun, 2 Jul 2006 11:01:50 +0000 (11:01 +0000)
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..

bgpd/ChangeLog
bgpd/bgp_fsm.c

index 5176e2b686195431933d35d438f8e140d5b458b5..a8a6c35002542fd47fbc8f6d02182046687b943d 100644 (file)
@@ -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
index f5f7892bbf18e6c372ab83616a6017030e86f5e2..770a7911960a8535140f61450b5092b6d9aea81e 100644 (file)
@@ -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))
     {