aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-10-16 01:46:24 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-10-16 01:46:24 +0000
commit7ef85434edf4b408405819453ca732b4e8a55049 (patch)
tree1bff2bdb49e87edc451ab40cf7c581c2e5dc5c62
parentVERSION 2.1_beta3 (diff)
downloadopenvpn-7ef85434edf4b408405819453ca732b4e8a55049.tar.xz
Fixed bug introduced in 2.1-beta3 where management
socket bind would fail. Pre-2.1-beta4 git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@635 e7ae566f-a301-0410-adde-c780ea21d3b5
-rw-r--r--ChangeLog5
-rw-r--r--configure.ac2
-rw-r--r--manage.c4
-rw-r--r--socket.c14
-rw-r--r--socket.h8
5 files changed, 21 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index abed740..ac71185 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@ Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
$Id$
+2005.10.xx -- Version 2.1-beta4
+
+* Fixed bug introduced in 2.1-beta3 where management
+ socket bind would fail.
+
2005.10.16 -- Version 2.1-beta3
* Added PKCS#11 support (Alon Bar-Lev).
diff --git a/configure.ac b/configure.ac
index 6b01f37..9befab2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
-AC_INIT([OpenVPN], [2.1_beta3], [openvpn-users@lists.sourceforge.net], [openvpn])
+AC_INIT([OpenVPN], [2.1_beta4], [openvpn-users@lists.sourceforge.net], [openvpn])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR(syshead.h)
diff --git a/manage.c b/manage.c
index ddded80..7be67fd 100644
--- a/manage.c
+++ b/manage.c
@@ -840,9 +840,7 @@ man_listen (struct management *man)
/*
* Bind socket
*/
- if (bind (man->connection.sd_top, (struct sockaddr *) &man->settings.local, sizeof (man->settings.local)))
- msg (M_SOCKERR, "MANAGEMENT: Cannot bind TCP socket on %s",
- print_sockaddr (&man->settings.local, &gc));
+ socket_bind (man->connection.sd_top, &man->settings.local, "MANAGEMENT");
/*
* Listen for connection
diff --git a/socket.c b/socket.c
index 75ae615..dd98f7c 100644
--- a/socket.c
+++ b/socket.c
@@ -685,16 +685,18 @@ socket_listen_accept (socket_descriptor_t sd,
return new_sd;
}
-static void
+void
socket_bind (socket_descriptor_t sd,
- struct openvpn_sockaddr *local)
+ struct openvpn_sockaddr *local,
+ const char *prefix)
{
struct gc_arena gc = gc_new ();
if (bind (sd, (struct sockaddr *) &local->sa, sizeof (local->sa)))
{
const int errnum = openvpn_errno_socket ();
- msg (M_FATAL, "TCP/UDP: Socket bind failed on local address %s: %s",
+ msg (M_FATAL, "%s: Socket bind failed on local address %s: %s",
+ prefix,
print_sockaddr (local, &gc),
strerror_ts (errnum, &gc));
}
@@ -746,7 +748,7 @@ socket_connect (socket_descriptor_t *sd,
*sd = create_socket_tcp ();
if (bind_local)
- socket_bind (*sd, local);
+ socket_bind (*sd, local, "TCP Client");
update_remote (remote_dynamic, remote, remote_changed);
}
@@ -818,10 +820,10 @@ resolve_bind_local (struct link_socket *sock)
{
#ifdef ENABLE_SOCKS
if (sock->socks_proxy && sock->info.proto == PROTO_UDPv4)
- socket_bind (sock->ctrl_sd, &sock->info.lsa->local);
+ socket_bind (sock->ctrl_sd, &sock->info.lsa->local, "SOCKS");
else
#endif
- socket_bind (sock->sd, &sock->info.lsa->local);
+ socket_bind (sock->sd, &sock->info.lsa->local, "TCP/UDP");
}
gc_free (&gc);
}
diff --git a/socket.h b/socket.h
index 5b7980a..d6681e3 100644
--- a/socket.h
+++ b/socket.h
@@ -80,14 +80,14 @@ typedef uint16_t packet_size_type;
/* OpenVPN sockaddr struct */
struct openvpn_sockaddr
{
- int dummy; /* JYFIXME */
+ int dummy; /* JYFIXME -- add offset to force a bug if sa not explicitly dereferenced */
struct sockaddr_in sa;
};
/* actual address of remote, based on source address of received packets */
struct link_socket_actual
{
- int dummy; /* JYFIXME */
+ int dummy; /* JYFIXME -- add offset to force a bug if dest not explicitly dereferenced */
struct openvpn_sockaddr dest;
#if ENABLE_IP_PKTINFO
struct in_pktinfo pi;
@@ -266,6 +266,10 @@ int socket_finalize (
struct link_socket *link_socket_new (void);
+void socket_bind (socket_descriptor_t sd,
+ struct openvpn_sockaddr *local,
+ const char *prefix);
+
/*
* Initialize link_socket object.
*/