diff options
author | Davide Guerri <d.guerri@caspur.it> | 2011-09-15 23:42:22 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2011-09-30 09:48:42 +0200 |
commit | 3a957aaef3ae512b217dd475a846a0ea35aae49c (patch) | |
tree | d92bc58e2bf1d07612ff7dbb67afedc019ec8719 /options.c | |
parent | 8ca19c014c149cf69257798afa6c75d1ff8f11a7 (diff) | |
download | openvpn-3a957aaef3ae512b217dd475a846a0ea35aae49c.tar.gz openvpn-3a957aaef3ae512b217dd475a846a0ea35aae49c.tar.xz openvpn-3a957aaef3ae512b217dd475a846a0ea35aae49c.zip |
New feauture: Add --stale-routes-check
This patch adds a stale-routes-check option that takes 2 parameters: a ageing
time (in seconds) and a check interval (in seconds). The latter defaults to the
former if it's not present. Internally, a new "check" is added in
multi_process_per_second_timers_dowork(). This check deletes stale routes and
it is inspired to the function multi_reap_range().
We're running a very large connectivity infrastructure based on openVPN (more
than 4000 different clients connected per day per server), so we can throughly
check this patch (or, of course, any variant of it).
Signed-off-by: Davide Guerri <d.guerri@caspur.it>
Reviewed-by: David Sommerseth <davids@redhat.com>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -455,6 +455,9 @@ static const char usage_message[] = "--connect-freq n s : Allow a maximum of n new connections per s seconds.\n" "--max-clients n : Allow a maximum of n simultaneously connected clients.\n" "--max-routes-per-client n : Allow a maximum of n internal routes per client.\n" + "--stale-routes-check n [t] : Remove routes with a last activity timestamp\n" + " older than n seconds. Run this check every t\n" + " seconds (defaults to n).\n" #if PORT_SHARE "--port-share host port [dir] : When run in TCP mode, proxy incoming HTTPS\n" " sessions to a web server at host:port. dir specifies an\n" @@ -781,6 +784,7 @@ init_options (struct options *o, const bool init_gc) o->tcp_queue_limit = 64; o->max_clients = 1024; o->max_routes_per_client = 256; + o->stale_routes_check_interval = 0; o->ifconfig_pool_persist_refresh_freq = 600; #endif #if P2MP @@ -2182,6 +2186,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne msg (M_USAGE, "--port-share requires TCP server mode (--mode server --proto tcp-server)"); #endif + if (options->stale_routes_check_interval) + msg (M_USAGE, "--stale-routes-check requires --mode server"); } #endif /* P2MP_SERVER */ @@ -4944,6 +4950,25 @@ add_option (struct options *options, } options->max_routes = max_routes; } + else if (streq (p[0], "stale-routes-check") && p[1]) + { + int ageing_time, check_interval; + + VERIFY_PERMISSION (OPT_P_GENERAL); + ageing_time = atoi (p[1]); + if (p[2]) + check_interval = atoi (p[2]); + else + check_interval = ageing_time; + + if (ageing_time < 1 || check_interval < 1) + { + msg (msglevel, "--stale-routes-check aging time and check interval must be >= 1"); + goto err; + } + options->stale_routes_ageing_time = ageing_time; + options->stale_routes_check_interval = check_interval; + } else if (streq (p[0], "route-gateway") && p[1]) { VERIFY_PERMISSION (OPT_P_ROUTE_EXTRAS); |