diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-11-18 05:15:22 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-11-18 05:15:22 +0000 |
commit | ae3b37460b677ebd6f1ad12dab76055e7879fcaf (patch) | |
tree | 3dbc37295b45822f221c4bbb23ab7e1fd0d2a9ad /helper.c | |
parent | Cleaned up man page synopsis. (diff) | |
download | openvpn-ae3b37460b677ebd6f1ad12dab76055e7879fcaf.tar.xz |
Added --tcp-nodelay option: Macro that sets TCP_NODELAY socket
flag on the server as well as pushes it to connecting clients.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3513 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'helper.c')
-rw-r--r-- | helper.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -96,6 +96,14 @@ print_str_int (const char *str, const int i, struct gc_arena *gc) return BSTR (&out); } +static const char * +print_str (const char *str, struct gc_arena *gc) +{ + struct buffer out = alloc_buf_gc (128, gc); + buf_printf (&out, "%s", str); + return BSTR (&out); +} + static void helper_add_route (const in_addr_t network, const in_addr_t netmask, struct options *o) { @@ -438,3 +446,34 @@ helper_keepalive (struct options *o) } } } + +/* + * + * HELPER DIRECTIVE: + * + * tcp-nodelay + * + * EXPANDS TO: + * + * if mode server: + * socket-flags TCP_NODELAY + * push "socket-flags TCP_NODELAY" + */ +void +helper_tcp_nodelay (struct options *o) +{ +#if P2MP_SERVER + if (o->server_flags & SF_TCP_NODELAY_HELPER) + { + if (o->mode == MODE_SERVER) + { + o->sockflags |= SF_TCP_NODELAY; + push_option (o, print_str ("socket-flags TCP_NODELAY", &o->gc), M_USAGE); + } + else + { + ASSERT (0); + } + } +#endif +} |