diff options
-rw-r--r-- | bgpd/bgp_connection.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_engine.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_engine.h | 10 | ||||
-rw-r--r-- | bgpd/bgp_main.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_network.c | 1 | ||||
-rw-r--r-- | bgpd/bgp_peer.c | 53 | ||||
-rw-r--r-- | bgpd/bgp_peer_index.c | 5 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 3 | ||||
-rw-r--r-- | bgpd/bgp_session.c | 11 | ||||
-rw-r--r-- | bgpd/bgpd.c | 5 | ||||
-rw-r--r-- | bgpd/bgpd.h | 4 |
11 files changed, 55 insertions, 47 deletions
diff --git a/bgpd/bgp_connection.c b/bgpd/bgp_connection.c index 9d937033..690b2903 100644 --- a/bgpd/bgp_connection.c +++ b/bgpd/bgp_connection.c @@ -19,14 +19,14 @@ * Boston, MA 02111-1307, USA. */ +#include "bgpd/bgp_connection.h" + #include <zebra.h> #include "bgpd/bgpd.h" - #include "bgpd/bgp_fsm.h" #include "bgpd/bgp_engine.h" #include "bgpd/bgp_session.h" -#include "bgpd/bgp_connection.h" #include "bgpd/bgp_notification.h" #include "bgpd/bgp_msg_read.h" diff --git a/bgpd/bgp_engine.c b/bgpd/bgp_engine.c index f963d0d9..b1207ebc 100644 --- a/bgpd/bgp_engine.c +++ b/bgpd/bgp_engine.c @@ -62,8 +62,6 @@ * */ -extern qpn_nexus bgp_nexus ; - /*============================================================================== * Start the BGP Engine Thread. * diff --git a/bgpd/bgp_engine.h b/bgpd/bgp_engine.h index 46a82093..7673328c 100644 --- a/bgpd/bgp_engine.h +++ b/bgpd/bgp_engine.h @@ -22,24 +22,16 @@ #ifndef _QUAGGA_BGP_ENGINE_H #define _QUAGGA_BGP_ENGINE_H -#include "bgpd/bgp_common.h" +#include "bgpd/bgpd.h" #include "lib/mqueue.h" -#include "lib/qpthreads.h" -#include "lib/qtimers.h" -#include "lib/qpselect.h" #include "lib/qpnexus.h" -#include "lib/sockunion.h" - #ifndef Inline #define Inline static inline #endif -extern qpn_nexus cli_nexus; -extern qpn_nexus bgp_nexus; -extern qpn_nexus routing_nexus; /*============================================================================== * diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index 319da31c..91ce0dbf 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -50,6 +50,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_debug.h" #include "bgpd/bgp_filter.h" #include "bgpd/bgp_network.h" +#include "bgpd/bgp_engine.h" /* bgpd options, we use GNU getopt library. */ static const struct option longopts[] = @@ -117,9 +118,6 @@ static int retain_mode = 0; /* Master of threads. */ struct thread_master *master; -qpn_nexus cli_nexus = NULL; -qpn_nexus bgp_nexus = NULL; -qpn_nexus routing_nexus = NULL; /* Manually specified configuration file name. */ char *config_file = NULL; diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index 10b3eba8..25d82ae3 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -518,7 +518,6 @@ bgp_accept_action(qps_file qf, void* file_info) static int bgp_bind(bgp_connection connection) ; static int bgp_update_source (bgp_connection connection) ; -static bgp_fsm_event_t bgp_sex_connect_error(int err) ; /*------------------------------------------------------------------------------ * Open BGP Connection -- connect() to the other end diff --git a/bgpd/bgp_peer.c b/bgpd/bgp_peer.c index f9abb3c1..7607014e 100644 --- a/bgpd/bgp_peer.c +++ b/bgpd/bgp_peer.c @@ -21,24 +21,15 @@ * Boston, MA 02111-1307, USA. */ -#include <zebra.h> +#include "bgpd/bgp_peer.h" -#include "linklist.h" -#include "prefix.h" -#include "vty.h" -#include "sockunion.h" -#include "thread.h" -#include "log.h" -#include "stream.h" -#include "memory.h" -#include "plist.h" -#include "mqueue.h" -#include "workqueue.h" +#include <zebra.h> -#include "bgpd/bgpd.h" -#include "bgpd/bgp_peer.h" +#include "bgpd/bgp_common.h" +#include "bgpd/bgp_session.h" +#include "bgpd/bgp_engine.h" #include "bgpd/bgp_peer_index.h" - +#include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" #include "bgpd/bgp_debug.h" #include "bgpd/bgp_fsm.h" @@ -49,8 +40,17 @@ #include "bgpd/bgp_open.h" #include "bgpd/bgp_advertise.h" -#include "bgpd/bgp_engine.h" -#include "bgpd/bgp_session.h" +#include "linklist.h" +#include "prefix.h" +#include "vty.h" +#include "sockunion.h" +#include "thread.h" +#include "log.h" +#include "stream.h" +#include "memory.h" +#include "plist.h" +#include "mqueue.h" +#include "workqueue.h" #ifdef HAVE_SNMP #include "bgpd/bgp_snmp.h" @@ -298,7 +298,8 @@ bgp_session_has_disabled(bgp_peer peer) session->state = bgp_session_sDisabled ; - /* TODO: here should revoke session in Peering Engine message queue */ + /* Immediately discard any other messages for this session. */ + mqueue_revoke(routing_nexus->queue, session) ; /* does the session need to be re-enabled? */ if (session->defer_enable) @@ -741,12 +742,12 @@ peer_create (union sockunion *su, struct bgp *bgp, as_t local_as, if (! active && peer_active (peer)) bgp_timer_set (peer); - /* session */ - peer->session = bgp_session_init_new(peer->session, peer); - /* register */ bgp_peer_index_register(peer, &peer->su); + /* session */ + peer->session = bgp_session_init_new(peer->session, peer); + return peer; } @@ -796,7 +797,8 @@ peer_delete (struct peer *peer) */ peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE; bgp_peer_stop (peer); - bgp_fsm_change_status (peer, Deleted); + /* TODO: Deleted status */ + /* bgp_fsm_change_status (peer, Deleted); */ /* Password configuration */ if (peer->password) @@ -969,8 +971,11 @@ peer_nsf_stop (struct peer *peer) void bgp_peer_reenable(bgp_peer peer, bgp_notify notification) { - bgp_peer_disable(peer, notification); - bgp_peer_enable(peer); /* may defer if still stopping */ + if (bgp_session_is_active(peer->session)) + { + bgp_peer_disable(peer, notification); + bgp_peer_enable(peer); /* may defer if still stopping */ + } } /* enable the peer */ diff --git a/bgpd/bgp_peer_index.c b/bgpd/bgp_peer_index.c index 6bcb3be2..73ab8950 100644 --- a/bgpd/bgp_peer_index.c +++ b/bgpd/bgp_peer_index.c @@ -104,7 +104,7 @@ bgp_peer_index_init(void* parent) bgp_peer_id_table_free_head = NULL ; bgp_peer_id_last = bgp_peer_id_unit - 1 ; - bgp_peer_id_table_free_ids(1, bgp_peer_id_unit) ; + bgp_peer_id_table_free_ids(1, bgp_peer_id_last) ; } ; /*------------------------------------------------------------------------------ @@ -144,6 +144,7 @@ bgp_peer_index_register(bgp_peer peer, union sockunion* su) /* Initialise the entry -- the id is already set */ entry->peer = peer ; + peer->index_entry = entry; entry->accept = NULL ; assert(entry->id == (entry - bgp_peer_id_table)) ; @@ -152,7 +153,7 @@ bgp_peer_index_register(bgp_peer peer, union sockunion* su) BGP_PEER_INDEX_UNLOCK() ; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ - passert(entry != NULL) ; + passert(entry == NULL) ; /* Must be new entry */ } ; /*------------------------------------------------------------------------------ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index b3e498cb..39aab2c3 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -2724,7 +2724,8 @@ bgp_clear_node_complete (struct work_queue *wq) struct peer *peer = wq->spec.data; /* Tickle FSM to start moving again */ - BGP_EVENT_ADD (peer, Clearing_Completed); + /* TODO: Clearing status */ + /* BGP_EVENT_ADD (peer, Clearing_Completed); */ peer_unlock (peer); /* bgp_clear_route */ } diff --git a/bgpd/bgp_session.c b/bgpd/bgp_session.c index 6fa7479a..4363344e 100644 --- a/bgpd/bgp_session.c +++ b/bgpd/bgp_session.c @@ -19,8 +19,8 @@ * Boston, MA 02111-1307, USA. */ -#include "bgpd/bgp_common.h" #include "bgpd/bgp_session.h" +#include "bgpd/bgp_common.h" #include "bgpd/bgp_peer.h" #include "bgpd/bgp_engine.h" #include "bgpd/bgp_peer_index.h" @@ -258,9 +258,14 @@ bgp_session_enable(bgp_peer peer) /* take copies of host and password */ XFREE(MTYPE_BGP_SESSION, session->host); - session->host = XSTRDUP(MTYPE_BGP_SESSION, peer->host); + session->host = (peer->host != NULL) + ? XSTRDUP(MTYPE_BGP_SESSION, peer->host) + : NULL; + XFREE(MTYPE_BGP_SESSION, session->password); - session->password = XSTRDUP(MTYPE_BGP_SESSION, peer->password); + session->password = (peer->password != NULL) + ? XSTRDUP(MTYPE_BGP_SESSION, peer->password) + : NULL; session->idle_hold_timer_interval = peer->v_start ; session->connect_retry_timer_interval = peer->v_connect ; diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index d7baa608..8161868a 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -72,6 +72,11 @@ extern struct in_addr router_id_zebra; /* BGP process wide configuration pointer to export. */ struct bgp_master *bm; +/* BGP process wide nexus. */ +qpn_nexus cli_nexus = NULL; +qpn_nexus bgp_nexus = NULL; +qpn_nexus routing_nexus = NULL; + /* BGP community-list. */ struct community_list_handler *bgp_clist; diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index acf99074..bab5215b 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -399,6 +399,10 @@ extern struct bgp_master *bm; extern struct thread_master *master; +extern qpn_nexus cli_nexus; +extern qpn_nexus bgp_nexus; +extern qpn_nexus routing_nexus; + /* Prototypes. */ extern void bgp_terminate (void); extern void bgp_reset (void); |