git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@899 e7ae566f-a301-0410-adde-c780ea21d3b5
james authored on 2006/02/17 16:43:32... | ... |
@@ -3,6 +3,10 @@ Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net> |
3 | 3 |
|
4 | 4 |
$Id$ |
5 | 5 |
|
6 |
+2006.02.17 -- Version 2.1-beta10 |
|
7 |
+ |
|
8 |
+* Fixed --port-share breakage introduced in 2.1-beta9. |
|
9 |
+ |
|
6 | 10 |
2006.02.16 -- Version 2.1-beta9 |
7 | 11 |
|
8 | 12 |
* Added --port-share option for allowing OpenVPN and HTTPS |
... | ... |
@@ -25,7 +25,7 @@ dnl Process this file with autoconf to produce a configure script. |
25 | 25 |
|
26 | 26 |
AC_PREREQ(2.50) |
27 | 27 |
|
28 |
-AC_INIT([OpenVPN], [2.1_beta9], [openvpn-users@lists.sourceforge.net], [openvpn]) |
|
28 |
+AC_INIT([OpenVPN], [2.1_beta10], [openvpn-users@lists.sourceforge.net], [openvpn]) |
|
29 | 29 |
AM_CONFIG_HEADER(config.h) |
30 | 30 |
AC_CONFIG_SRCDIR(syshead.h) |
31 | 31 |
|
... | ... |
@@ -1890,8 +1890,15 @@ do_link_socket_new (struct context *c) |
1890 | 1890 |
* bind the TCP/UDP socket |
1891 | 1891 |
*/ |
1892 | 1892 |
static void |
1893 |
-do_init_socket_1 (struct context *c, int mode) |
|
1893 |
+do_init_socket_1 (struct context *c, const int mode) |
|
1894 | 1894 |
{ |
1895 |
+ unsigned int sockflags = c->options.sockflags; |
|
1896 |
+ |
|
1897 |
+#if PORT_SHARE |
|
1898 |
+ if (c->options.port_share_host && c->options.port_share_port) |
|
1899 |
+ sockflags |= SF_PORT_SHARE; |
|
1900 |
+#endif |
|
1901 |
+ |
|
1895 | 1902 |
link_socket_init_phase1 (c->c2.link_socket, |
1896 | 1903 |
c->options.local, |
1897 | 1904 |
c->c1.remote_list, |
... | ... |
@@ -1921,7 +1928,7 @@ do_init_socket_1 (struct context *c, int mode) |
1921 | 1921 |
c->options.mtu_discover_type, |
1922 | 1922 |
c->options.rcvbuf, |
1923 | 1923 |
c->options.sndbuf, |
1924 |
- c->options.sockflags); |
|
1924 |
+ sockflags); |
|
1925 | 1925 |
} |
1926 | 1926 |
|
1927 | 1927 |
/* |
... | ... |
@@ -884,13 +884,20 @@ socket_frame_init (const struct frame *frame, struct link_socket *sock) |
884 | 884 |
if (link_socket_connection_oriented (sock)) |
885 | 885 |
{ |
886 | 886 |
#ifdef WIN32 |
887 |
- stream_buf_init (&sock->stream_buf, &sock->reads.buf_init); |
|
887 |
+ stream_buf_init (&sock->stream_buf, |
|
888 |
+ &sock->reads.buf_init, |
|
889 |
+ sock->sockflags, |
|
890 |
+ sock->info.proto); |
|
888 | 891 |
#else |
889 | 892 |
alloc_buf_sock_tun (&sock->stream_buf_data, |
890 | 893 |
frame, |
891 | 894 |
false, |
892 | 895 |
FRAME_HEADROOM_MARKER_READ_STREAM); |
893 |
- stream_buf_init (&sock->stream_buf, &sock->stream_buf_data); |
|
896 |
+ |
|
897 |
+ stream_buf_init (&sock->stream_buf, |
|
898 |
+ &sock->stream_buf_data, |
|
899 |
+ sock->sockflags, |
|
900 |
+ sock->info.proto); |
|
894 | 901 |
#endif |
895 | 902 |
} |
896 | 903 |
} |
... | ... |
@@ -1663,7 +1670,9 @@ stream_buf_reset (struct stream_buf *sb) |
1663 | 1663 |
|
1664 | 1664 |
void |
1665 | 1665 |
stream_buf_init (struct stream_buf *sb, |
1666 |
- struct buffer *buf) |
|
1666 |
+ struct buffer *buf, |
|
1667 |
+ const unsigned int sockflags, |
|
1668 |
+ const int proto) |
|
1667 | 1669 |
{ |
1668 | 1670 |
sb->buf_init = *buf; |
1669 | 1671 |
sb->maxlen = sb->buf_init.len; |
... | ... |
@@ -1671,7 +1680,9 @@ stream_buf_init (struct stream_buf *sb, |
1671 | 1671 |
sb->residual = alloc_buf (sb->maxlen); |
1672 | 1672 |
sb->error = false; |
1673 | 1673 |
#if PORT_SHARE |
1674 |
- sb->port_share_state = PS_ENABLED; |
|
1674 |
+ sb->port_share_state = ((sockflags & SF_PORT_SHARE) && (proto == PROTO_TCPv4_SERVER)) |
|
1675 |
+ ? PS_ENABLED |
|
1676 |
+ : PS_DISABLED; |
|
1675 | 1677 |
#endif |
1676 | 1678 |
stream_buf_reset (sb); |
1677 | 1679 |
|
... | ... |
@@ -1748,7 +1759,7 @@ stream_buf_added (struct stream_buf *sb, |
1748 | 1748 |
{ |
1749 | 1749 |
if (!is_openvpn_protocol (&sb->buf)) |
1750 | 1750 |
{ |
1751 |
- msg (D_STREAM_ERRORS, "Non-OpenVPN protocol detected"); |
|
1751 |
+ msg (D_STREAM_ERRORS, "Non-OpenVPN client protocol detected"); |
|
1752 | 1752 |
sb->port_share_state = PS_FOREIGN; |
1753 | 1753 |
sb->error = true; |
1754 | 1754 |
return false; |
... | ... |
@@ -207,6 +207,7 @@ struct link_socket |
207 | 207 |
|
208 | 208 |
# define SF_USE_IP_PKTINFO (1<<0) |
209 | 209 |
# define SF_TCP_NODELAY (1<<1) |
210 |
+# define SF_PORT_SHARE (1<<2) |
|
210 | 211 |
unsigned int sockflags; |
211 | 212 |
|
212 | 213 |
/* for stream sockets */ |
... | ... |
@@ -658,7 +659,11 @@ link_socket_set_outgoing_addr (const struct buffer *buf, |
658 | 658 |
* such as TCP. |
659 | 659 |
*/ |
660 | 660 |
|
661 |
-void stream_buf_init (struct stream_buf *sb, struct buffer *buf); |
|
661 |
+void stream_buf_init (struct stream_buf *sb, |
|
662 |
+ struct buffer *buf, |
|
663 |
+ const unsigned int sockflags, |
|
664 |
+ const int proto); |
|
665 |
+ |
|
662 | 666 |
void stream_buf_close (struct stream_buf* sb); |
663 | 667 |
bool stream_buf_added (struct stream_buf *sb, int length_added); |
664 | 668 |
|