Message ID | 20250226185548.49127-1-prestwoj@gmail.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | blacklist: allow configuration to disable the blacklist | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
prestwoj/iwd-alpine-ci-fetch | success | Fetch PR |
prestwoj/iwd-alpine-ci-setupell | success | Prep - Setup ELL |
prestwoj/iwd-ci-gitlint | success | GitLint |
prestwoj/iwd-ci-fetch | success | Fetch PR |
prestwoj/iwd-ci-setupell | success | Prep - Setup ELL |
prestwoj/iwd-ci-incremental_build | success | Incremental build not run PASS |
prestwoj/iwd-alpine-ci-makedistcheck | success | Make Distcheck |
prestwoj/iwd-alpine-ci-incremental_build | success | Incremental build not run PASS |
prestwoj/iwd-ci-build | success | Build - Configure |
prestwoj/iwd-alpine-ci-build | success | Build - Configure |
prestwoj/iwd-alpine-ci-makecheckvalgrind | success | Make Check w/Valgrind |
prestwoj/iwd-alpine-ci-makecheck | success | Make Check |
prestwoj/iwd-ci-makecheckvalgrind | success | Make Check w/Valgrind |
prestwoj/iwd-ci-clang | success | clang PASS |
prestwoj/iwd-ci-makecheck | success | Make Check |
prestwoj/iwd-ci-makedistcheck | success | Make Distcheck |
prestwoj/iwd-ci-testrunner | success | test-runner PASS |
On 2/26/25 12:55 PM, James Prestwood wrote: > Certain use cases may not need or want this feature so allowing it to > be disabled is a much cleaner way than doing something like setting > the timeouts very low. > > Now [Blacklist].InitialTimeout can be set to zero which will prevent > any blacklisting. > > In addition some other small changes were added: > - Warn if the multiplier is 0, and set to 1 if so. > - Warn if the initial timeout exceeds the maximum timeout. > - Log if the blacklist is disabled > - Use L_USEC_PER_SEC instead of magic numbers. > --- > src/blacklist.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) > Applied, thanks. Regards, -Denis
diff --git a/src/blacklist.c b/src/blacklist.c index 04e4b8e3..21f85a75 100644 --- a/src/blacklist.c +++ b/src/blacklist.c @@ -91,6 +91,9 @@ void blacklist_add_bss(const uint8_t *addr) { struct blacklist_entry *entry; + if (!blacklist_initial_timeout) + return; + blacklist_prune(); entry = l_queue_find(blacklist, match_addr, addr); @@ -162,19 +165,31 @@ static int blacklist_init(void) blacklist_initial_timeout = BLACKLIST_DEFAULT_TIMEOUT; /* For easier user configuration the timeout values are in seconds */ - blacklist_initial_timeout *= 1000000; + blacklist_initial_timeout *= L_USEC_PER_SEC; if (!l_settings_get_uint64(config, "Blacklist", "Multiplier", &blacklist_multiplier)) blacklist_multiplier = BLACKLIST_DEFAULT_MULTIPLIER; + if (blacklist_multiplier == 0) { + l_warn("[Blacklist].Multiplier cannot be zero, setting to 1"); + blacklist_multiplier = 1; + } + if (!l_settings_get_uint64(config, "Blacklist", "MaximumTimeout", &blacklist_max_timeout)) blacklist_max_timeout = BLACKLIST_DEFAULT_MAX_TIMEOUT; - blacklist_max_timeout *= 1000000; + blacklist_max_timeout *= L_USEC_PER_SEC; + + if (blacklist_initial_timeout > blacklist_max_timeout) + l_warn("[Blacklist].InitialTimeout exceeded " + "[Blacklist].MaximumTimeout!"); + + if (!blacklist_initial_timeout) + l_debug("initial timeout was zero, blacklist will be disabled"); blacklist = l_queue_new();