Browse code

sockets: Remove the limitation of --tcp-nodelay to be server-only

The assert(0) happening if trying to use --tcp-nodelay in a client
config is really not helpful at all. When this assert(0) was removed,
another warning appeared that this could only be used in server
configs. That itself is also quite silly, as clients can choose to
use --socket-flags TCP_NODELAY in the client config instead. This
behaviour does not help the user in any way.

This patch removes the server-only restriction and rather provides
a more helpful warning when using --tcp-nodelay on the client side.

Trac: 489
Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: 1418118764-17846-1-git-send-email-openvpn.list@topphemmelig.net
URL: http://article.gmane.org/gmane.network.openvpn.devel/9334

David Sommerseth authored on 2014/12/09 18:52:44
Showing 2 changed files
... ...
@@ -534,7 +534,7 @@ helper_tcp_nodelay (struct options *o)
534 534
 	}
535 535
       else
536 536
 	{
537
-	  ASSERT (0);
537
+	  o->sockflags |= SF_TCP_NODELAY;
538 538
 	}
539 539
     }
540 540
 #endif
... ...
@@ -2111,7 +2111,9 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
2111 2111
       if (options->ssl_flags & SSLF_OPT_VERIFY)
2112 2112
 	msg (M_USAGE, "--opt-verify requires --mode server");
2113 2113
       if (options->server_flags & SF_TCP_NODELAY_HELPER)
2114
-	msg (M_USAGE, "--tcp-nodelay requires --mode server");
2114
+	msg (M_WARN, "WARNING: setting tcp-nodelay on the client side will not "
2115
+             "affect the server. To have TCP_NODELAY in both direction use "
2116
+             "tcp-nodelay in the server configuration instead.");
2115 2117
       if (options->auth_user_pass_verify_script)
2116 2118
 	msg (M_USAGE, "--auth-user-pass-verify requires --mode server");
2117 2119
 #if PORT_SHARE