$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
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)
* 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,
c->options.mtu_discover_type,
c->options.rcvbuf,
c->options.sndbuf,
- c->options.sockflags);
+ sockflags);
}
/*
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
}
}
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;
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);
{
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;
# 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 */
* 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);