2004-05-01 Paul Jakma <paul@dishone.st>

        * Revert the attempted clean-up of the dummy peer hack, reverts
          patchsets 435 (see 2004-02-17 below) and 456.
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index ac25f15..3d8e957 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -292,7 +292,7 @@
 
   peer->synctime = time (NULL);
 
-  BGP_WRITE_ON (peer->t_write, bgp_write, *peer->fd);
+  BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd);
 
   BGP_TIMER_ON (peer->t_routeadv, bgp_routeadv_timer,
 		peer->v_routeadv);
@@ -307,21 +307,6 @@
   peer->uptime = time (NULL);
 }
 
-void
-bgp_connection_stop (struct peer *peer)
-{
-  if (peer->fd_local >= 0)
-    {
-      close (peer->fd_local);
-      peer->fd_local = -1;
-    }
-  if (peer->fd_accept >= 0)
-    {
-      close (peer->fd_accept);
-      peer->fd_accept = -1;
-    }
-}
-
 /* Administrative BGP peer stop event. */
 int
 bgp_stop (struct peer *peer)
@@ -382,8 +367,12 @@
     stream_reset (peer->work);
   stream_fifo_clean (peer->obuf);
 
-  /* Close of connections. */
-  bgp_connection_stop (peer);
+  /* Close of file descriptor. */
+  if (peer->fd >= 0)
+    {
+      close (peer->fd);
+      peer->fd = -1;
+    }
 
   /* Connection information. */
   if (peer->su_local)
@@ -397,7 +386,7 @@
       XFREE (MTYPE_SOCKUNION, peer->su_remote);
       peer->su_remote = NULL;
     }
-    
+
   /* Clear remote router-id. */
   peer->remote_id.s_addr = 0;
 
@@ -488,13 +477,13 @@
 int
 bgp_connect_success (struct peer *peer)
 {
-  if (peer->fd_local < 0)
+  if (peer->fd < 0)
     {
       zlog_err ("bgp_connect_success peer's fd is negative value %d",
-                peer->fd_local);
+		peer->fd);
       return -1;
     }
-  BGP_READ_ON (peer->t_read, bgp_read, peer->fd_local);
+  BGP_READ_ON (peer->t_read, bgp_read, peer->fd);
 
   /* bgp_getsockname (peer); */
 
@@ -532,29 +521,29 @@
     {
     case connect_error:
       if (BGP_DEBUG (fsm, FSM))
-        plog_info (peer->log, "%s [FSM] Connect error", peer->host);
+	plog_info (peer->log, "%s [FSM] Connect error", peer->host);
       BGP_EVENT_ADD (peer, TCP_connection_open_failed);
       break;
     case connect_success:
       if (BGP_DEBUG (fsm, FSM))
-        plog_info (peer->log, "%s [FSM] Connect immediately success",
-                   peer->host);
+	plog_info (peer->log, "%s [FSM] Connect immediately success",
+		   peer->host);
       BGP_EVENT_ADD (peer, TCP_connection_open);
       break;
     case connect_in_progress:
       /* To check nonblocking connect, we wait until socket is
          readable or writable. */
       if (BGP_DEBUG (fsm, FSM))
-        plog_info (peer->log, "%s [FSM] Non blocking connect waiting result",
-                   peer->host);
-      if (*peer->fd < 0)
+	plog_info (peer->log, "%s [FSM] Non blocking connect waiting result",
+		   peer->host);
+      if (peer->fd < 0)
 	{
 	  zlog_err ("bgp_start peer's fd is negative value %d",
-		    *peer->fd);
+		    peer->fd);
 	  return -1;
 	}
-      BGP_READ_ON (peer->t_read, bgp_read, *peer->fd);
-      BGP_WRITE_ON (peer->t_write, bgp_write, *peer->fd);
+      BGP_READ_ON (peer->t_read, bgp_read, peer->fd);
+      BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd);
       break;
     }
   return 0;