count bandwidth in kb/sec to avoid overflows on high bandwidth.

This commit is contained in:
Nikos Mavrogiannopoulos
2013-11-05 20:32:23 +01:00
parent 0759125652
commit 615e16cc41
6 changed files with 47 additions and 33 deletions
+6 -4
View File
@@ -86,8 +86,8 @@ static struct cfg_options available_options[] = {
{ .name = "min-reauth-time", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "max-same-clients", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "rx-per-sec", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "tx-per-sec", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "rx-data-per-sec", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "tx-data-per-sec", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "run-as-user", .type = OPTION_STRING, .mandatory = 0 },
{ .name = "run-as-group", .type = OPTION_STRING, .mandatory = 0 },
@@ -319,8 +319,10 @@ unsigned prefix = 0;
READ_NUMERIC("mtu", config->default_mtu);
READ_NUMERIC("output-buffer", config->output_buffer);
READ_NUMERIC("rx-per-sec", config->rx_per_sec);
READ_NUMERIC("tx-per-sec", config->tx_per_sec);
READ_NUMERIC("rx-data-per-sec", config->rx_per_sec);
READ_NUMERIC("tx-data-per-sec", config->tx_per_sec);
config->rx_per_sec /= 1000; /* in kb */
config->tx_per_sec /= 1000;
READ_NUMERIC("cookie-validity", config->cookie_validity);
READ_NUMERIC("auth-timeout", config->auth_timeout);