summaryrefslogtreecommitdiffstats
path: root/socket.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-17 07:43:32 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-02-17 07:43:32 +0000
commitdc46c0676fa55e6953b97ad8f5b7df33c31cdcfc (patch)
tree163157aa18e8f7ac5e0bf7beb93f54872e830be0 /socket.c
parent651a01f91323949b131a099b2755d07a7a79b662 (diff)
downloadopenvpn-dc46c0676fa55e6953b97ad8f5b7df33c31cdcfc.tar.gz
openvpn-dc46c0676fa55e6953b97ad8f5b7df33c31cdcfc.tar.xz
openvpn-dc46c0676fa55e6953b97ad8f5b7df33c31cdcfc.zip
Version 2.1_beta10 released
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@899 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c21
1 files changed, 16 insertions, 5 deletions
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;