diff options
author | Chris Hall <chris.hall@highwayman.com> | 2011-08-12 11:44:09 +0100 |
---|---|---|
committer | Chris Hall <chris.hall@highwayman.com> | 2011-08-12 11:44:09 +0100 |
commit | 7bd8653ef788a6395b07583d6766be8950598342 (patch) | |
tree | f4b7209b76ddb24c6ab8144608a2a46adc610528 /lib/vty_io.c | |
parent | 6bd3ef2441f6b45d96c69ee8183d2bec8173ddb5 (diff) | |
parent | 538cb284864c17de66152a5236db4cd80e3e7639 (diff) | |
download | quagga-7bd8653ef788a6395b07583d6766be8950598342.tar.bz2 quagga-7bd8653ef788a6395b07583d6766be8950598342.tar.xz |
Merge with main Quagga source as of 29-Jul-2011.ex17
Create euro_ix branch.
Update version to: 0.99.18ex17
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 'lib/vty_io.c')
-rw-r--r-- | lib/vty_io.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/lib/vty_io.c b/lib/vty_io.c index b0915559..74e32c75 100644 --- a/lib/vty_io.c +++ b/lib/vty_io.c @@ -35,6 +35,7 @@ #include "filter.h" #include "privs.h" #include "sockunion.h" +#include "sockopt.h" #include "network.h" #include <arpa/telnet.h> @@ -2064,7 +2065,7 @@ uty_serv_sock(const char* addr, unsigned short port) /* If not used the address... something wrong */ if (sa != NULL) - uzlog(NULL, LOG_ERR, "could not use address %s, to listen for VTY", addr); + zlog_err("could not use address %s, to listen for VTY", addr); /* Done */ return n ; @@ -2086,8 +2087,8 @@ static int uty_serv_sock_open(sa_family_t family, int type, int protocol, struct sockaddr* sa, unsigned short port) { - union sockunion su ; - int sock ; + union sockunion su[1] ; + int sock_fd ; int ret ; VTY_ASSERT_LOCKED() ; @@ -2095,55 +2096,52 @@ uty_serv_sock_open(sa_family_t family, int type, int protocol, /* Is there an address and is it for this family ? */ if ((sa != NULL) || (sa->sa_family == family)) /* Set up sockunion containing required family and address */ - sockunion_new_sockaddr(&su, sa) ; + sockunion_new_sockaddr(su, sa) ; else { /* no address or wrong family -- set up empty sockunion of * required family */ - sockunion_init_new(&su, family) ; + sockunion_init_new(su, family) ; sa = NULL ; } ; /* Open the socket and set its properties */ - sock = sockunion_socket(family, type, protocol) ; - if (sock < 0) + sock_fd = sockunion_socket(su, type, protocol) ; + if (sock_fd < 0) return -1 ; - ret = sockopt_reuseaddr (sock); + ret = setsockopt_reuseaddr (sock_fd); if (ret >= 0) - ret = sockopt_reuseport (sock); + ret = setsockopt_reuseport (sock_fd); if (ret >= 0) - ret = set_nonblocking(sock); + ret = set_nonblocking(sock_fd); -#if defined(HAVE_IPV6) && defined(IPV6_V6ONLY) - /* Want only IPV6 on ipv6 socket (not mapped addresses) +#ifdef HAVE_IPV6 + /* Want only IPv6 on AF_INET6 socket (not mapped addresses) * * This distinguishes 0.0.0.0 from :: -- without this, bind() will reject the * attempt to bind to :: after binding to 0.0.0.0. */ - if ((ret >= 0) && (sa->sa_family == AF_INET6)) - { - int on = 1; - ret = setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on)); - } + if ((ret >= 0) && (family == AF_INET6)) + ret = setsockopt_ipv6_v6only(sock_fd) ; #endif if (ret >= 0) - ret = sockunion_bind (sock, &su, port, sa) ; + ret = sockunion_bind (sock_fd, su, port, (sa == NULL)) ; if (ret >= 0) - ret = sockunion_listen (sock, 3); + ret = sockunion_listen (sock_fd, 3); if (ret < 0) { - close (sock); + close (sock_fd); return -1 ; } /* Socket is open -- set VTY Term listener going */ - uty_serv_start_listener(sock, VTY_TERM) ; + uty_serv_start_listener(sock_fd, VTY_TERM) ; /* Return OK and signal whether used address or not */ return (sa != NULL) ? 1 : 0 ; @@ -2364,7 +2362,7 @@ uty_accept_term(vty_listener listener) struct access_list* acl ; if ((acl = access_list_lookup (AFI_IP, vty_accesslist_name)) && - (access_list_apply (acl, p) == FILTER_DENY)) + (access_list_apply (acl, p) == FILTER_DENY)) ret = -1 ; } |