diff options
author | Chris Hall <chris.hall@highwayman.com> | 2011-08-12 15:06:06 +0100 |
---|---|---|
committer | Chris Hall <chris.hall@highwayman.com> | 2011-08-12 15:06:06 +0100 |
commit | cec1fae79110dffa900c0c5f38c3d3b48f5b0db6 (patch) | |
tree | 408055322e19098b98766168624f1b96865ac73b /bgpd/bgp_connection.c | |
parent | 228e06bad624a33090da4a09f32f8fed84a7e15c (diff) | |
parent | 7bd8653ef788a6395b07583d6766be8950598342 (diff) | |
download | quagga-ex18p.tar.bz2 quagga-ex18p.tar.xz |
Merge branch 'euro_ix' of /git/quagga.euro-ix into pipeworkex18p
Merge with euro_ix branch v0.99.18ex17.
Update version to: 0.99.18ex18p
Of particular note:
* includes support for GTSM:
neighbor ... ttl-security hops X
no neighbor ... ttl-security hops X
where X is 1-254. For usual case of immediately connected
peer, X == 1.
Cannot set ttl-security while ebgp-multihop is set, and
vice-versa.
If underlying O/S does not support GTSM, then will set ttl
as per ebgp-multihop.
In passing, have fixed various bugs in the main Quagga branch.
* initial support for draft-ietf-idr-optional-transitive
Does not yet support "neighbor-complete" flag.
* main Quagga now uses TCP_CORK and permanent non-blocking
Do not beleive TCP_CORK to be necessary for euro_ix code...
which has a different buffering strategy.
The euro_ix code already runs sockets permanently non-blocking.
* various fixes to attribute intern/unintern
Trying to remove memory leaks. Nobody seems convinced that
this has been perfected, yet.
* fixes for ospfd and ospf6d issues.
Up to date with master branch up to:
commit 538cb284864c17de66152a5236db4cd80e3e7639
Merge: 036a6e6 8ced4e8
Author: Paul Jakma <paul@quagga.net>
Date: Fri Jul 29 18:21:50 2011 +0100
Diffstat (limited to 'bgpd/bgp_connection.c')
-rw-r--r-- | bgpd/bgp_connection.c | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/bgpd/bgp_connection.c b/bgpd/bgp_connection.c index cdd37848..24c86230 100644 --- a/bgpd/bgp_connection.c +++ b/bgpd/bgp_connection.c @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +#include <zebra.h> #include "misc.h" @@ -130,6 +131,7 @@ bgp_connection_init_new(bgp_connection connection, bgp_session session, * * notification NULL -- none received or sent * * err no error, so far * * cap_suppress do not suppress capabilities + * * gtsm false -- no minttl set, yet * * su_local NULL -- no address, yet * * su_remote NULL -- no address, yet * * hold_timer_interval none -- set when connection is opened @@ -156,8 +158,6 @@ bgp_connection_init_new(bgp_connection connection, bgp_session session, connection->p_mutex = session->mutex ; connection->lock_count = 0 ; /* no question about it */ - connection->paf = AF_UNSPEC ; - connection->ordinal = ordinal ; connection->accepted = (ordinal == bgp_connection_secondary) ; @@ -317,7 +317,7 @@ bgp_connection_make_primary(bgp_connection connection) extern void bgp_connection_exit(bgp_connection connection) { - bgp_connection_close_down(connection) ; /* make sure */ + bgp_connection_close(connection, false) ; /* false => not keep timers */ assert(connection->state == bgp_fsm_sStopping) ; @@ -343,7 +343,7 @@ bgp_connection_free(bgp_connection connection) /* Make sure is closed, so no active file, no timers, pending queue is empty, * not on the connection queue, etc. */ - bgp_connection_close_down(connection) ; + bgp_connection_close(connection, false) ; /* false => not keep timers */ /* Free any components which still exist */ connection->qf = qps_file_free(connection->qf) ; @@ -586,7 +586,7 @@ bgp_connection_add_pending(bgp_connection connection, mqueue_block mqb, * Sets: * * * if secondary connection, turn off accept() - * * sets the qfile and fd ready for use -- disabled in all modes + * * sets the qfile and sock_fd ready for use -- disabled in all modes * * clears err -- must be OK so far * * discards any open_state * * copies hold_timer_interval and keep_alive_timer_interval from session @@ -609,28 +609,23 @@ bgp_connection_add_pending(bgp_connection connection, mqueue_block mqb, * NB: requires the session to be LOCKED. */ extern void -bgp_connection_open(bgp_connection connection, int fd, int family) +bgp_connection_open(bgp_connection connection, int sock_fd) { bgp_session session = connection->session ; - /* Make sure that there is no file and that buffers are clear, etc. */ - /* If this is the secondary connection, do not accept any more. */ - bgp_connection_close(connection) ; /* FSM deals with timers */ + /* Make sure that there is no file and that buffers are clear, etc. + * If this is the secondary connection, do not accept any more. + * The FSM deals with the timers. + */ + bgp_connection_close(connection, true) ; /* true => keep timers */ /* Set the file going */ - qps_add_file(bgp_nexus->selection, connection->qf, fd, connection) ; + qps_add_file(bgp_nexus->selection, connection->qf, sock_fd, connection) ; connection->err = 0 ; /* so far, so good */ bgp_open_state_unset(&connection->open_recv) ; - /* Note the address family for the socket. - * - * This is the real family -- so is IPv6 independent of whether one or - * both addresses are actually mapped IPv4. - */ - connection->paf = family ; - /* Copy the original hold_timer_interval and keepalive_timer_interval * Assume these have sensible initial values. * @@ -758,7 +753,7 @@ bgp_connection_query_accept(bgp_session session) /*------------------------------------------------------------------------------ * Close connection. * - * * if there is an fd, close it + * * if there is an sock_fd, close it * * if qfile is active, remove it * * forget any addresses * * reset all stream buffers to empty @@ -774,7 +769,7 @@ bgp_connection_query_accept(bgp_session session) * * * state of the connection * * links to and from the session - * * the timers remain initialised (but may have been unset) + * * the timers remain initialised -- and remain on or are unset * * the buffers remain (but reset) * * logging and host string * * any open_state that has been received @@ -792,19 +787,19 @@ bgp_connection_query_accept(bgp_session session) * NB: requires the session to be LOCKED. */ extern void -bgp_connection_full_close(bgp_connection connection, int unset_timers) +bgp_connection_close(bgp_connection connection, bool keep_timers) { - int fd ; + int sock_fd ; /* Close connection's file, if any. */ qps_remove_file(connection->qf) ; - fd = qps_file_unset_fd(connection->qf) ; - if (fd != fd_undef) - close(fd) ; + sock_fd = qps_file_unset_fd(connection->qf) ; + if (sock_fd != fd_undef) + close(sock_fd) ; /* If required, unset the timers. */ - if (unset_timers) + if (!keep_timers) { qtimer_unset(connection->hold_timer) ; qtimer_unset(connection->keepalive_timer) ; @@ -830,7 +825,8 @@ bgp_connection_full_close(bgp_connection connection, int unset_timers) * This is done when the connection is about to be fully closed, but need to * send a NOTIFICATION message before finally closing. * - * * if there is an fd, shutdown(, SHUT_RD) and disable the qfile for reading + * * if there is an sock_fd, shutdown(, SHUT_RD) and disable the qfile for + * reading * * reset all read buffering to empty * * discard all output except any partially written message * * empty the pending queue @@ -851,18 +847,18 @@ extern bool bgp_connection_part_close(bgp_connection connection) { bgp_wbuffer wb = &connection->wbuff ; - int fd ; + int sock_fd ; uint8_t* p ; bgp_size_t mlen ; /* Check that have a usable file descriptor */ - fd = qps_file_fd(connection->qf) ; + sock_fd = qps_file_fd(connection->qf) ; - if (fd == fd_undef) + if (sock_fd == fd_undef) return false ; /* Shutdown the read side of this connection */ - shutdown(fd, SHUT_RD) ; + shutdown(sock_fd, SHUT_RD) ; qps_disable_modes(connection->qf, qps_read_mbit) ; /* Stop all buffering activity, except for write buffer. */ |