diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2009-09-17 23:43:37 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2009-09-17 23:43:37 +0000 |
commit | 673f583f76358b57e7f610084d3cb28bb2a9c4a2 (patch) | |
tree | 6d9c8bdd75055e42049937f69bdbcf9368eaab89 /options.c | |
parent | Modified client to send a PUSH_REQUEST message to server 1 second (diff) | |
download | openvpn-673f583f76358b57e7f610084d3cb28bb2a9c4a2.tar.xz |
The maximum number of "route" directives (specified in the config
file or pulled from a server) can now be configured via the new
"max-routes" directive.
Previously, the limit was set to 100 and fixed by a compile-time
constant. Now the limit is dynamic and can be modified by the
"max-routes" directive. If max-routes is not specified, the default
limit is 100.
Note that this change does not address the maximum size of the
pushed options string sent from server to client, which is still
controlled by the TLS_CHANNEL_BUF_SIZE compile-time constant.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@4967 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -170,6 +170,8 @@ static const char usage_message[] = " netmask default: 255.255.255.255\n" " gateway default: taken from --route-gateway or --ifconfig\n" " Specify default by leaving blank or setting to \"nil\".\n" + "--max-routes n : Specify the maximum number of routes that may be defined\n" + " or pulled from a server.\n" "--route-gateway gw|'dhcp' : Specify a default gateway for use with --route.\n" "--route-metric m : Specify a default metric for use with --route.\n" "--route-delay n [w] : Delay n seconds after connection initiation before\n" @@ -680,6 +682,7 @@ init_options (struct options *o, const bool init_gc) o->mtu_discover_type = -1; o->mssfix = MSSFIX_DEFAULT; o->route_delay_window = 30; + o->max_routes = MAX_ROUTES_DEFAULT; o->resolve_retry_seconds = RESOLV_RETRY_INFINITE; #ifdef ENABLE_OCC o->occ = true; @@ -1075,7 +1078,7 @@ void rol_check_alloc (struct options *options) { if (!options->routes) - options->routes = new_route_option_list (&options->gc); + options->routes = new_route_option_list (options->max_routes, &options->gc); } #ifdef ENABLE_DEBUG @@ -1264,6 +1267,7 @@ show_settings (const struct options *o) SHOW_BOOL (route_delay_defined); SHOW_BOOL (route_nopull); SHOW_BOOL (route_gateway_via_dhcp); + SHOW_INT (max_routes); SHOW_BOOL (allow_pull_fqdn); if (o->routes) print_route_options (o->routes, D_SHOW_PARMS); @@ -2160,7 +2164,7 @@ pre_pull_save (struct options *o) o->pre_pull->foreign_option_index = o->foreign_option_index; if (o->routes) { - o->pre_pull->routes = *o->routes; + o->pre_pull->routes = clone_route_option_list(o->routes, &o->gc); o->pre_pull->routes_defined = true; } } @@ -2179,7 +2183,7 @@ pre_pull_restore (struct options *o) if (pp->routes_defined) { rol_check_alloc (o); - *o->routes = pp->routes; + copy_route_option_list (o->routes, pp->routes); } else o->routes = NULL; @@ -4343,6 +4347,19 @@ add_option (struct options *options, } add_route_to_option_list (options->routes, p[1], p[2], p[3], p[4]); } + else if (streq (p[0], "max-routes") && p[1]) + { + int max_routes; + + VERIFY_PERMISSION (OPT_P_GENERAL); + max_routes = atoi (p[1]); + if (max_routes < 0 || max_routes > 100000000) + { + msg (msglevel, "--max-routes parameter is out of range"); + goto err; + } + options->max_routes = max_routes; + } else if (streq (p[0], "route-gateway") && p[1]) { VERIFY_PERMISSION (OPT_P_ROUTE_EXTRAS); |