From dc46c0676fa55e6953b97ad8f5b7df33c31cdcfc Mon Sep 17 00:00:00 2001 From: james Date: Fri, 17 Feb 2006 07:43:32 +0000 Subject: Version 2.1_beta10 released git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@899 e7ae566f-a301-0410-adde-c780ea21d3b5 --- socket.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'socket.c') 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; -- cgit v1.2.3