mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-08 15:52:32 +01:00
network: add network_bss_update
This will swap out a scan_bss object with a duplicate that may exist in a networks bss_list. The duplicate will be removed by since the object is owned by station it is assumed that it will be freed elsewhere.
This commit is contained in:
parent
97de24e694
commit
88d0a6a7c0
@ -672,6 +672,27 @@ bool network_bss_add(struct network *network, struct scan_bss *bss)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool match_addr(const void *a, const void *b)
|
||||
{
|
||||
const struct scan_bss *bss = a;
|
||||
|
||||
return memcmp(bss->addr, b, 6) == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Replaces an old scan_bss (if exists) in the bss list with a new bss object.
|
||||
* Note this BSS is *not* freed and must be by the caller. scan_bss objects are
|
||||
* shared between network/station but station technically owns them.
|
||||
*/
|
||||
bool network_bss_update(struct network *network, struct scan_bss *bss)
|
||||
{
|
||||
l_queue_remove_if(network->bss_list, match_addr, bss->addr);
|
||||
|
||||
l_queue_insert(network->bss_list, bss, scan_bss_rank_compare, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool network_bss_list_isempty(struct network *network)
|
||||
{
|
||||
return l_queue_isempty(network->bss_list);
|
||||
|
@ -55,6 +55,7 @@ void network_set_info(struct network *network, struct network_info *info);
|
||||
int network_autoconnect(struct network *network, struct scan_bss *bss);
|
||||
void network_connect_failed(struct network *network, bool in_handshake);
|
||||
bool network_bss_add(struct network *network, struct scan_bss *bss);
|
||||
bool network_bss_update(struct network *network, struct scan_bss *bss);
|
||||
bool network_bss_list_isempty(struct network *network);
|
||||
void network_bss_list_clear(struct network *network);
|
||||
struct scan_bss *network_bss_list_pop(struct network *network);
|
||||
|
Loading…
Reference in New Issue
Block a user