mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-04-14 13:37:52 +02:00
blacklist: add new blacklist reason, ROAM_REQUESTED
This adds a new (less severe) blacklist reason as well as an option to configure the timeout. This blacklist reason will be used in cases where a BSS has requested IWD roam elsewhere. At that time a new blacklist entry will be added which will be used along with some other criteria to determine if IWD should connect/roam to that BSS again. Now that we have multiple blacklist reasons there may be situations where a blacklist entry already exists but with a different reason. This is going to be handled by the reason severity. Since we have just two reasons we will treat a connection failure as most severe and a roam requested as less severe. This leaves us with two possible situations: 1. BSS is roam blacklisted, then gets connection blacklisted: The reason will be "promoted" to connection blacklisted. 2. BSS is connection blacklisted, then gets roam blacklisted: The blacklist request will be ignored
This commit is contained in:
parent
1caad4ca88
commit
258482d509
@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
static uint64_t blacklist_multiplier;
|
static uint64_t blacklist_multiplier;
|
||||||
static uint64_t blacklist_initial_timeout;
|
static uint64_t blacklist_initial_timeout;
|
||||||
|
static uint64_t blacklist_roam_initial_timeout;
|
||||||
static uint64_t blacklist_max_timeout;
|
static uint64_t blacklist_max_timeout;
|
||||||
|
|
||||||
struct blacklist_entry {
|
struct blacklist_entry {
|
||||||
@ -66,6 +67,8 @@ static uint64_t get_reason_timeout(enum blacklist_reason reason)
|
|||||||
switch (reason) {
|
switch (reason) {
|
||||||
case BLACKLIST_REASON_CONNECT_FAILED:
|
case BLACKLIST_REASON_CONNECT_FAILED:
|
||||||
return blacklist_initial_timeout;
|
return blacklist_initial_timeout;
|
||||||
|
case BLACKLIST_REASON_ROAM_REQUESTED:
|
||||||
|
return blacklist_roam_initial_timeout;
|
||||||
default:
|
default:
|
||||||
l_warn("Unhandled blacklist reason: %u", reason);
|
l_warn("Unhandled blacklist reason: %u", reason);
|
||||||
return 0;
|
return 0;
|
||||||
@ -132,8 +135,25 @@ void blacklist_add_bss(const uint8_t *addr, enum blacklist_reason reason)
|
|||||||
entry = l_queue_find(blacklist, match_addr, addr);
|
entry = l_queue_find(blacklist, match_addr, addr);
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
uint64_t offset = l_time_diff(entry->added_time,
|
uint64_t offset;
|
||||||
entry->expire_time);
|
|
||||||
|
if (reason < entry->reason) {
|
||||||
|
l_debug("Promoting "MAC" blacklist to reason %u",
|
||||||
|
MAC_STR(addr), reason);
|
||||||
|
/* Reset this to the new timeout and reason */
|
||||||
|
entry->reason = reason;
|
||||||
|
entry->added_time = l_time_now();
|
||||||
|
entry->expire_time = l_time_offset(entry->added_time,
|
||||||
|
timeout);
|
||||||
|
return;
|
||||||
|
} else if (reason > entry->reason) {
|
||||||
|
l_debug("Ignoring blacklist extension of "MAC", "
|
||||||
|
"current blacklist status is more severe!",
|
||||||
|
MAC_STR(addr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = l_time_diff(entry->added_time, entry->expire_time);
|
||||||
|
|
||||||
offset *= blacklist_multiplier;
|
offset *= blacklist_multiplier;
|
||||||
|
|
||||||
@ -196,6 +216,14 @@ static int blacklist_init(void)
|
|||||||
/* For easier user configuration the timeout values are in seconds */
|
/* For easier user configuration the timeout values are in seconds */
|
||||||
blacklist_initial_timeout *= L_USEC_PER_SEC;
|
blacklist_initial_timeout *= L_USEC_PER_SEC;
|
||||||
|
|
||||||
|
if (!l_settings_get_uint64(config, "Blacklist",
|
||||||
|
"InitialRoamRequestedTimeout",
|
||||||
|
&blacklist_roam_initial_timeout))
|
||||||
|
blacklist_roam_initial_timeout = BLACKLIST_DEFAULT_TIMEOUT;
|
||||||
|
|
||||||
|
/* For easier user configuration the timeout values are in seconds */
|
||||||
|
blacklist_roam_initial_timeout *= L_USEC_PER_SEC;
|
||||||
|
|
||||||
if (!l_settings_get_uint64(config, "Blacklist",
|
if (!l_settings_get_uint64(config, "Blacklist",
|
||||||
"Multiplier",
|
"Multiplier",
|
||||||
&blacklist_multiplier))
|
&blacklist_multiplier))
|
||||||
|
@ -26,6 +26,13 @@ enum blacklist_reason {
|
|||||||
* connect to it via autoconnect
|
* connect to it via autoconnect
|
||||||
*/
|
*/
|
||||||
BLACKLIST_REASON_CONNECT_FAILED,
|
BLACKLIST_REASON_CONNECT_FAILED,
|
||||||
|
/*
|
||||||
|
* This type of blacklist is added when a BSS requests IWD roams
|
||||||
|
* elsewhere. This is to aid in preventing IWD from roaming/connecting
|
||||||
|
* back to that BSS in the future unless there are no other "good"
|
||||||
|
* candidates to connect to.
|
||||||
|
*/
|
||||||
|
BLACKLIST_REASON_ROAM_REQUESTED,
|
||||||
};
|
};
|
||||||
|
|
||||||
void blacklist_add_bss(const uint8_t *addr, enum blacklist_reason reason);
|
void blacklist_add_bss(const uint8_t *addr, enum blacklist_reason reason);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user