eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 88d0a6a7c07023293c1d57f304e0e39ac138bd80
parent 97de24e694797100e9c789aea69f64cc90789f2d
Author: James Prestwood <prestwoj@gmail.com>
Date:   Mon, 15 Mar 2021 12:15:27 -0700

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.

Diffstat:
Msrc/network.c | 21+++++++++++++++++++++
Msrc/network.h | 1+
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/src/network.c b/src/network.c @@ -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); diff --git a/src/network.h b/src/network.h @@ -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);