Added config options 'mtu' and 'output-buffer'.

This commit is contained in:
Nikos Mavrogiannopoulos
2013-10-20 17:45:51 +02:00
parent 137dfed158
commit 988116bbeb
8 changed files with 29 additions and 4 deletions
+3
View File
@@ -5,6 +5,9 @@
the suggested values and ignores the other. the suggested values and ignores the other.
- Reduce limit of output buffer on DTLS socket to reduce latency (following - Reduce limit of output buffer on DTLS socket to reduce latency (following
similar openconnect change). similar openconnect change).
- Added config option "output-buffer" to allow selecting between high throughput
or low latency.
- Enabled config option "mtu".
* Version 0.1.6 (released 2013-09-02) * Version 0.1.6 (released 2013-09-02)
+5
View File
@@ -161,6 +161,11 @@ ping-leases = false
# Leave empty to assign the default MTU of the device # Leave empty to assign the default MTU of the device
# mtu = # mtu =
# The number of packets (of MTU size) that are available in
# the output buffer. The default is low to improve latency.
# Setting it higher will improve throughput.
output-buffer = 10
route = 192.168.1.0/255.255.255.0 route = 192.168.1.0/255.255.255.0
#route = 192.168.5.0/255.255.255.0 #route = 192.168.5.0/255.255.255.0
+3
View File
@@ -202,6 +202,9 @@ unsigned j;
READ_STRING("tls-priorities", config->priorities, 0); READ_STRING("tls-priorities", config->priorities, 0);
READ_STRING("chroot-dir", config->chroot_dir, 0); READ_STRING("chroot-dir", config->chroot_dir, 0);
READ_NUMERIC("mtu", config->default_mtu, 0);
READ_NUMERIC("output-buffer", config->output_buffer, 0);
READ_NUMERIC("cookie-validity", config->cookie_validity, 1); READ_NUMERIC("cookie-validity", config->cookie_validity, 1);
READ_NUMERIC("auth-timeout", config->auth_timeout, 0); READ_NUMERIC("auth-timeout", config->auth_timeout, 0);
READ_NUMERIC("max-clients", config->max_clients, 0); READ_NUMERIC("max-clients", config->max_clients, 0);
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* DO NOT EDIT THIS FILE (ocserv-args.c) * DO NOT EDIT THIS FILE (ocserv-args.c)
* *
* It has been AutoGen-ed October 5, 2013 at 09:36:46 AM by AutoGen 5.17 * It has been AutoGen-ed October 20, 2013 at 05:44:06 PM by AutoGen 5.17
* From the definitions ocserv-args.def * From the definitions ocserv-args.def
* and the template file options * and the template file options
* *
+5
View File
@@ -249,6 +249,11 @@ ping-leases = false
# Unset to assign the default MTU of the device # Unset to assign the default MTU of the device
# mtu = # mtu =
# The number of packets (of MTU size) that are available in
# the output buffer. The default is low to improve latency.
# Setting it higher will improve throughput.
output-buffer = 10
# Routes to be forwarded to the client. If you need the # Routes to be forwarded to the client. If you need the
# client to forward routes to the server, you may use the connect # client to forward routes to the server, you may use the connect
# and disconnect scripts. # and disconnect scripts.
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* DO NOT EDIT THIS FILE (ocserv-args.h) * DO NOT EDIT THIS FILE (ocserv-args.h)
* *
* It has been AutoGen-ed October 5, 2013 at 09:36:46 AM by AutoGen 5.17 * It has been AutoGen-ed October 20, 2013 at 05:44:06 PM by AutoGen 5.17
* From the definitions ocserv-args.def * From the definitions ocserv-args.def
* and the template file options * and the template file options
* *
+3
View File
@@ -112,6 +112,9 @@ struct cfg_st {
unsigned force_cert_auth; /* always require client certificate */ unsigned force_cert_auth; /* always require client certificate */
unsigned rate_limit_ms; /* if non zero force a connection every rate_limit milliseconds */ unsigned rate_limit_ms; /* if non zero force a connection every rate_limit milliseconds */
unsigned ping_leases; /* non zero if we need to ping prior to leasing */ unsigned ping_leases; /* non zero if we need to ping prior to leasing */
unsigned output_buffer;
unsigned default_mtu;
char *connect_script; char *connect_script;
char *disconnect_script; char *disconnect_script;
+8 -2
View File
@@ -912,6 +912,10 @@ socklen_t sl;
); );
SEND_ERR(ret); SEND_ERR(ret);
if (ws->config->default_mtu > 0) {
vinfo.mtu = ws->config->default_mtu;
}
mtu_overhead = CSTP_OVERHEAD; mtu_overhead = CSTP_OVERHEAD;
ws->conn_mtu = vinfo.mtu - mtu_overhead; ws->conn_mtu = vinfo.mtu - mtu_overhead;
if (req->cstp_mtu > 0) { if (req->cstp_mtu > 0) {
@@ -979,8 +983,10 @@ socklen_t sl;
tls_printf(ws->session, "X-DTLS-MTU: %u\r\n", dtls_mtu); tls_printf(ws->session, "X-DTLS-MTU: %u\r\n", dtls_mtu);
oclog(ws, LOG_INFO, "suggesting DTLS MTU %u", dtls_mtu); oclog(ws, LOG_INFO, "suggesting DTLS MTU %u", dtls_mtu);
sndbuf = ws->conn_mtu * 4; if (ws->config->output_buffer > 0) {
setsockopt( ws->udp_fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)); sndbuf = ws->conn_mtu * ws->config->output_buffer;
setsockopt( ws->udp_fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf));
}
} else } else
dtls_mtu = 0; dtls_mtu = 0;