summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_connection.c
diff options
context:
space:
mode:
authorChris Hall <GMCH@hestia.halldom.com>2010-01-08 00:51:19 +0000
committerChris Hall <GMCH@hestia.halldom.com>2010-01-08 00:51:19 +0000
commit6b5024b3c14b0acf5d4ec05f7ea78a7323c96d59 (patch)
tree89956e840ea5de81b5b564732032d93b95638af0 /bgpd/bgp_connection.c
parent18874dc91124118a678984241b18953beb8bb9d9 (diff)
downloadquagga-6b5024b3c14b0acf5d4ec05f7ea78a7323c96d59.tar.bz2
quagga-6b5024b3c14b0acf5d4ec05f7ea78a7323c96d59.tar.xz
Continuing work-in-progress
modified: bgpd/Makefile.am modified: bgpd/bgp.h modified: bgpd/bgp_common.h modified: bgpd/bgp_connection.c modified: bgpd/bgp_connection.h modified: bgpd/bgp_engine.h modified: bgpd/bgp_fsm.c modified: bgpd/bgp_network.c modified: bgpd/bgp_network.h new file: bgpd/bgp_peer_index.c new file: bgpd/bgp_peer_index.h modified: bgpd/bgp_session.c modified: bgpd/bgp_session.h modified: lib/memtypes.c modified: lib/mqueue.h
Diffstat (limited to 'bgpd/bgp_connection.c')
-rw-r--r--bgpd/bgp_connection.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/bgpd/bgp_connection.c b/bgpd/bgp_connection.c
index 8517ccc0..445d6d18 100644
--- a/bgpd/bgp_connection.c
+++ b/bgpd/bgp_connection.c
@@ -441,7 +441,7 @@ bgp_connection_open(bgp_connection connection, int fd)
/* If this is the secondary connection, do not accept any more. */
if (connection->ordinal == bgp_connection_secondary)
- session->accept = 0 ;
+ bgp_connection_disable_accept(connection) ;
/* Set the file going */
qps_add_file(p_bgp_engine->selection, &connection->qf, fd, connection) ;
@@ -465,6 +465,26 @@ bgp_connection_open(bgp_connection connection, int fd)
} ;
/*------------------------------------------------------------------------------
+ * Enable connection for accept()
+ *
+ */
+extern void
+bgp_connection_enable_accept(bgp_connection connection)
+{
+ connection->session->index_entry->accept = connection->session ;
+} ;
+
+/*------------------------------------------------------------------------------
+ * Disable connection for accept()
+ *
+ */
+extern void
+bgp_connection_disable_accept(bgp_connection connection)
+{
+ connection->session->index_entry->accept = NULL ;
+} ;
+
+/*------------------------------------------------------------------------------
* Close connection.
*
* * if there is an fd, close it
@@ -473,6 +493,7 @@ bgp_connection_open(bgp_connection connection, int fd)
* * unset any timers
* * reset all buffering to empty
* * empties the pending queue -- destroying all messages
+ * * for secondary connection: disable accept
*
* The following remain:
*
@@ -505,9 +526,13 @@ bgp_connection_close(bgp_connection connection)
if (fd != fd_undef)
shutdown(fd, SHUT_RDWR) ;
+ /* If this is the secondary connection, do not accept any more. */
+ if (connection->ordinal == bgp_connection_secondary)
+ bgp_connection_disable_accept(connection) ;
+
/* forget any addresses */
- sockunion_clear(&connection->su_local) ;
- sockunion_clear(&connection->su_remote) ;
+ sockunion_clear(connection->su_local) ;
+ sockunion_clear(connection->su_remote) ;
/* Unset all the timers */
qtimer_unset(&connection->hold_timer) ;