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
This commit is contained in:
james 2005-10-16 01:46:24 +00:00
parent bf11793232
commit 7ef85434ed
5 changed files with 21 additions and 12 deletions

View File

@ -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).

View File

@ -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)

View File

@ -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

View File

@ -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);
}

View File

@ -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.
*/