From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v4 04/11] blacklist: fix pruning to remove the entry if its expired
Date: Fri, 28 Mar 2025 07:42:46 -0700 [thread overview]
Message-ID: <20250328144253.421425-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20250328144253.421425-1-prestwoj@gmail.com>
When pruning the list check_if_expired was comparing to the maximum
amount of time a BSS can be blacklisted, not if the current time had
exceeded the expirationt time. This results in blacklist entries
hanging around longer than they should, which would result in them
poentially being blacklisted even longer if there was another reason
to blacklist in the future.
Instead on prune check the actual expiration and remove the entry if
its expired. Doing this removes the need to check any of the times
in blacklist_contains_bss since prune will remove any expired entries
correctly.
---
src/blacklist.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/src/blacklist.c b/src/blacklist.c
index 8ae474b3..2539c5e0 100644
--- a/src/blacklist.c
+++ b/src/blacklist.c
@@ -77,7 +77,7 @@ static bool check_if_expired(void *data, void *user_data)
struct blacklist_entry *entry = data;
uint64_t now = l_get_u64(user_data);
- if (l_time_diff(now, entry->added_time) > blacklist_max_timeout) {
+ if (l_time_after(now, entry->expire_time)) {
l_debug("Removing entry "MAC" on prune", MAC_STR(entry->addr));
l_free(entry);
return true;
@@ -157,9 +157,6 @@ void blacklist_add_bss(const uint8_t *addr, enum blacklist_reason reason)
bool blacklist_contains_bss(const uint8_t *addr, enum blacklist_reason reason)
{
- bool ret;
- uint64_t time_now;
- struct blacklist_entry *entry;
struct blacklist_search search = {
.addr = addr,
.reason = reason
@@ -167,16 +164,7 @@ bool blacklist_contains_bss(const uint8_t *addr, enum blacklist_reason reason)
blacklist_prune();
- entry = l_queue_find(blacklist, match_addr_and_reason, &search);
-
- if (!entry)
- return false;
-
- time_now = l_time_now();
-
- ret = l_time_after(time_now, entry->expire_time) ? false : true;
-
- return ret;
+ return l_queue_find(blacklist, match_addr_and_reason, &search) != NULL;
}
void blacklist_remove_bss(const uint8_t *addr, enum blacklist_reason reason)
--
2.34.1
next prev parent reply other threads:[~2025-03-28 14:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 14:42 [PATCH v4 01/11] station: always add BSS to network blacklist on failure James Prestwood
2025-03-28 14:42 ` [PATCH v4 02/11] auto-t: add test for disabling the timeout blacklist James Prestwood
2025-03-28 14:42 ` [PATCH v4 03/11] blacklist: include a blacklist reason when adding/finding James Prestwood
2025-03-28 14:42 ` James Prestwood [this message]
2025-03-28 14:42 ` [PATCH v4 05/11] blacklist: add new blacklist reason, ROAM_REQUESTED James Prestwood
2025-03-28 14:42 ` [PATCH v4 06/11] netdev: add netdev_get_low_signal_threshold James Prestwood
2025-03-28 14:42 ` [PATCH v4 07/11] station: roam blacklist BSS's, and consider when roaming James Prestwood
2025-04-01 16:08 ` Denis Kenzior
2025-03-28 14:42 ` [PATCH v4 08/11] station: roam blacklist AP even mid-roam James Prestwood
2025-03-28 14:42 ` [PATCH v4 09/11] auto-t: add tests for AP roam blacklisting James Prestwood
2025-03-28 14:42 ` [PATCH v4 10/11] doc: document InitialRoamRequestedTimeout James Prestwood
2025-03-28 14:42 ` [PATCH v4 11/11] netdev: fix invalid read after netdev_free James Prestwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250328144253.421425-4-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox