summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_peer_index.c
diff options
context:
space:
mode:
authorpaulo <paul@bayleaf.org.uk>2010-01-13 17:56:10 +0000
committerpaulo <paul@bayleaf.org.uk>2010-01-13 17:56:10 +0000
commit02e1b449d58345380db15b716391c20db55ed2d6 (patch)
tree0294e587a5fa352465c2cfb01f745b41ea40aac3 /bgpd/bgp_peer_index.c
parentff5b1c237fd67969ae5317763294bfbecaf655d0 (diff)
downloadquagga-02e1b449d58345380db15b716391c20db55ed2d6.tar.bz2
quagga-02e1b449d58345380db15b716391c20db55ed2d6.tar.xz
Knitting it all together. Still not got clean compile. Still lots of
TODOs.
Diffstat (limited to 'bgpd/bgp_peer_index.c')
-rw-r--r--bgpd/bgp_peer_index.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/bgpd/bgp_peer_index.c b/bgpd/bgp_peer_index.c
index 2967d11f..bad95d95 100644
--- a/bgpd/bgp_peer_index.c
+++ b/bgpd/bgp_peer_index.c
@@ -258,6 +258,37 @@ bgp_session_index_seek(union sockunion* su, int* p_found)
return accept ;
} ;
+/*------------------------------------------------------------------------------
+ * Set peer's session pointer.
+ *
+ * For use by the Routeing Engine. Locks the bgp_peer_index mutex so that the
+ * BGP Engine is not fooled when it looks up the session.
+ *
+ * Returns the old session pointer value.
+ *
+ * NB: it is a FATAL error to change the pointer if the current session is
+ * "active".
+ *
+ */
+
+bgp_session
+bgp_peer_new_session(bgp_peer peer, bgp_session new_session)
+{
+ bgp_session old_session ;
+
+ BGP_PEER_INDEX_LOCK() ; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
+
+ old_session = peer->session ;
+ peer->session = new_session ;
+
+ passert(!bgp_session_is_active(old_session)) ;
+
+ BGP_PEER_INDEX_UNLOCK() ; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
+
+ return old_session ;
+}
+
+
/*==============================================================================
* Extending the bgp_peer_id_table and adding free entries to it.
*/