summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2010-02-28 14:40:57 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-04-27 23:07:36 +0200
commitd6f9707b7a1d96944c6d9ab273cf676cb8f58bc0 (patch)
treef5399533ce4812d83b83c11a9c95e30fe24725ed
parentd32a306f4fbe534c35bb487624c55ea5c572daca (diff)
downloadopenvpn-d6f9707b7a1d96944c6d9ab273cf676cb8f58bc0.tar.gz
openvpn-d6f9707b7a1d96944c6d9ab273cf676cb8f58bc0.tar.xz
openvpn-d6f9707b7a1d96944c6d9ab273cf676cb8f58bc0.zip
Allow 'lport 0' setup for random port binding
I am running a multihomed host where 'local <extip>' must be specified for proper operation. Unfortunately, this implies 'lport 1194' or another static port. This causes problems with stateful firewalls which register the host/port pairs in the internal connection tracking table. On ungraceful reconnects, the new TCP connection will have same the host/port pairs but unexpected sequence numbers. The new connection will be assumed as invalid hence and be dropped. It would be nice when local port can be configured to be bound to a random port number. After reading code, | else if (streq (p[0], "lport") && p[1]) | ... | port = atoi (p[1]); |- if (!legal_ipv4_port (port)) |+ if (port != 0 && !legal_ipv4_port (port)) | { in options.c seems to be the only required change. This has been discussed here: <http://thread.gmane.org/gmane.network.openvpn.user/28622> Signed-off-by: David Sommerseth <dazo@users.sourceforge.net> Acked-by: Gert Doering <gert@greenie.muc.de>
-rw-r--r--options.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/options.c b/options.c
index 812c3de..7e0034e 100644
--- a/options.c
+++ b/options.c
@@ -4077,7 +4077,7 @@ add_option (struct options *options,
VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
port = atoi (p[1]);
- if (!legal_ipv4_port (port))
+ if ((port != 0) && !legal_ipv4_port (port))
{
msg (msglevel, "Bad local port number: %s", p[1]);
goto err;