aboutsummaryrefslogtreecommitdiff
path: root/helper.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-11-18 05:15:22 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2008-11-18 05:15:22 +0000
commitae3b37460b677ebd6f1ad12dab76055e7879fcaf (patch)
tree3dbc37295b45822f221c4bbb23ab7e1fd0d2a9ad /helper.c
parentCleaned up man page synopsis. (diff)
downloadopenvpn-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.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/helper.c b/helper.c
index 2abb417..a8bbea0 100644
--- a/helper.c
+++ b/helper.c
@@ -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
+}