mirror of
https://github.com/openNDS/openNDS.git
synced 2026-05-04 03:01:32 -04:00
Add - disable rate quotas by setting bucket ratio to zero
Signed-off-by: Rob White <rob@blue-wave.net>
This commit is contained in:
22
src/auth.c
22
src/auth.c
@@ -440,9 +440,14 @@ fw_refresh_client_list(void)
|
||||
uprate
|
||||
);
|
||||
action = ENABLE;
|
||||
iptables_download_ratelimit_enable(cp1, action);
|
||||
//bit 0 is not set so toggle it to signify rate limiting is on
|
||||
cp1->rate_exceeded = cp1->rate_exceeded^1;
|
||||
|
||||
if (config->download_bucket_ratio > 0) {
|
||||
iptables_download_ratelimit_enable(cp1, action);
|
||||
//bit 0 is not set so toggle it to signify rate limiting is on
|
||||
cp1->rate_exceeded = cp1->rate_exceeded^1;
|
||||
} else {
|
||||
debug(LOG_INFO, "Download RATE limiting is disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,9 +489,14 @@ fw_refresh_client_list(void)
|
||||
);
|
||||
|
||||
action = ENABLE;
|
||||
iptables_upload_ratelimit_enable(cp1, action);
|
||||
//bit 1 is not set so toggle it to signify rate limiting is on
|
||||
cp1->rate_exceeded = cp1->rate_exceeded^2;
|
||||
|
||||
if (config->upload_bucket_ratio > 0) {
|
||||
iptables_upload_ratelimit_enable(cp1, action);
|
||||
//bit 1 is not set so toggle it to signify rate limiting is on
|
||||
cp1->rate_exceeded = cp1->rate_exceeded^2;
|
||||
} else {
|
||||
debug(LOG_INFO, "Upload RATE limiting is disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -822,13 +822,13 @@ setup_from_config(void)
|
||||
|
||||
// Check down/up bucket ratios rates are not less than minimum value of 1
|
||||
if (config->download_bucket_ratio < 1) {
|
||||
debug(LOG_WARNING, "Download bucket ratio setting of %llu is below the required minimum. Setting to 1.", config->download_bucket_ratio);
|
||||
config->download_bucket_ratio = 1;
|
||||
debug(LOG_WARNING, "Download bucket ratio setting of %llu disables rate limiting.", config->download_bucket_ratio);
|
||||
config->download_bucket_ratio = 0;
|
||||
}
|
||||
|
||||
if (config->upload_bucket_ratio < 1) {
|
||||
debug(LOG_WARNING, "Upload bucket ratio setting of %llu is below the required minimum. Setting to 1.", config->upload_bucket_ratio);
|
||||
config->upload_bucket_ratio = 1;
|
||||
debug(LOG_WARNING, "Upload bucket ratio setting of %llu disables rate limiting.", config->upload_bucket_ratio);
|
||||
config->upload_bucket_ratio = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user