aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac2
-rw-r--r--init.c11
-rw-r--r--socket.c21
-rw-r--r--socket.h7
5 files changed, 36 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 19e29ac..cb7e31d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@ Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
$Id$
+2006.02.17 -- Version 2.1-beta10
+
+* Fixed --port-share breakage introduced in 2.1-beta9.
+
2006.02.16 -- Version 2.1-beta9
* Added --port-share option for allowing OpenVPN and HTTPS
diff --git a/configure.ac b/configure.ac
index 653913a..48337ca 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_beta9], [openvpn-users@lists.sourceforge.net], [openvpn])
+AC_INIT([OpenVPN], [2.1_beta10], [openvpn-users@lists.sourceforge.net], [openvpn])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR(syshead.h)
diff --git a/init.c b/init.c
index ab6a6c5..589cd03 100644
--- a/init.c
+++ b/init.c
@@ -1890,8 +1890,15 @@ do_link_socket_new (struct context *c)
* bind the TCP/UDP socket
*/
static void
-do_init_socket_1 (struct context *c, int mode)
+do_init_socket_1 (struct context *c, const int mode)
{
+ unsigned int sockflags = c->options.sockflags;
+
+#if PORT_SHARE
+ if (c->options.port_share_host && c->options.port_share_port)
+ sockflags |= SF_PORT_SHARE;
+#endif
+
link_socket_init_phase1 (c->c2.link_socket,
c->options.local,
c->c1.remote_list,
@@ -1921,7 +1928,7 @@ do_init_socket_1 (struct context *c, int mode)
c->options.mtu_discover_type,
c->options.rcvbuf,
c->options.sndbuf,
- c->options.sockflags);
+ sockflags);
}
/*
diff --git a/socket.c b/socket.c
index 0b866bd..6fd2673 100644
--- a/socket.c
+++ b/socket.c
@@ -884,13 +884,20 @@ socket_frame_init (const struct frame *frame, struct link_socket *sock)
if (link_socket_connection_oriented (sock))
{
#ifdef WIN32
- stream_buf_init (&sock->stream_buf, &sock->reads.buf_init);
+ stream_buf_init (&sock->stream_buf,
+ &sock->reads.buf_init,
+ sock->sockflags,
+ sock->info.proto);
#else
alloc_buf_sock_tun (&sock->stream_buf_data,
frame,
false,
FRAME_HEADROOM_MARKER_READ_STREAM);
- stream_buf_init (&sock->stream_buf, &sock->stream_buf_data);
+
+ stream_buf_init (&sock->stream_buf,
+ &sock->stream_buf_data,
+ sock->sockflags,
+ sock->info.proto);
#endif
}
}
@@ -1663,7 +1670,9 @@ stream_buf_reset (struct stream_buf *sb)
void
stream_buf_init (struct stream_buf *sb,
- struct buffer *buf)
+ struct buffer *buf,
+ const unsigned int sockflags,
+ const int proto)
{
sb->buf_init = *buf;
sb->maxlen = sb->buf_init.len;
@@ -1671,7 +1680,9 @@ stream_buf_init (struct stream_buf *sb,
sb->residual = alloc_buf (sb->maxlen);
sb->error = false;
#if PORT_SHARE
- sb->port_share_state = PS_ENABLED;
+ sb->port_share_state = ((sockflags & SF_PORT_SHARE) && (proto == PROTO_TCPv4_SERVER))
+ ? PS_ENABLED
+ : PS_DISABLED;
#endif
stream_buf_reset (sb);
@@ -1748,7 +1759,7 @@ stream_buf_added (struct stream_buf *sb,
{
if (!is_openvpn_protocol (&sb->buf))
{
- msg (D_STREAM_ERRORS, "Non-OpenVPN protocol detected");
+ msg (D_STREAM_ERRORS, "Non-OpenVPN client protocol detected");
sb->port_share_state = PS_FOREIGN;
sb->error = true;
return false;
diff --git a/socket.h b/socket.h
index 82b3626..f440659 100644
--- a/socket.h
+++ b/socket.h
@@ -207,6 +207,7 @@ struct link_socket
# define SF_USE_IP_PKTINFO (1<<0)
# define SF_TCP_NODELAY (1<<1)
+# define SF_PORT_SHARE (1<<2)
unsigned int sockflags;
/* for stream sockets */
@@ -658,7 +659,11 @@ link_socket_set_outgoing_addr (const struct buffer *buf,
* such as TCP.
*/
-void stream_buf_init (struct stream_buf *sb, struct buffer *buf);
+void stream_buf_init (struct stream_buf *sb,
+ struct buffer *buf,
+ const unsigned int sockflags,
+ const int proto);
+
void stream_buf_close (struct stream_buf* sb);
bool stream_buf_added (struct stream_buf *sb, int length_added);