eiwd

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

commit e83070e074aa0b29f53dd87b2d2b86b3183ccbea
parent 6463fa256101ba19fda6737c8b2a206bba3ea4b4
Author: James Prestwood <prestwoj@gmail.com>
Date:   Thu, 28 Sep 2023 05:41:26 -0700

scan: filter user-disabled bands for periodic scans.

To support user-disabled bands periodic scans need to specify a
frequency list filtered by any bands that are disabled. This was
needed in scan.c since periodic scans don't provide a frequency
list in the scan request.

If no bands are disabled the allowed freqs API should still
result in the same scan behavior as if a frequency list is left
out i.e. IWD just filters the frequencies as opposed to the kernel.

Diffstat:
Msrc/scan.c | 36++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/scan.c b/src/scan.c @@ -987,9 +987,43 @@ static void scan_periodic_destroy(void *user_data) sc->sp.id = 0; } +static struct scan_freq_set *scan_periodic_get_freqs(struct scan_context *sc) +{ + uint32_t band_mask = 0; + struct scan_freq_set *freqs; + const struct scan_freq_set *supported = + wiphy_get_supported_freqs(sc->wiphy); + + if (RANK_2G_FACTOR) + band_mask |= BAND_FREQ_2_4_GHZ; + if (RANK_5G_FACTOR) + band_mask |= BAND_FREQ_5_GHZ; + if (RANK_6G_FACTOR) + band_mask |= BAND_FREQ_6_GHZ; + + freqs = scan_freq_set_clone(supported, band_mask); + if (scan_freq_set_isempty(freqs)) { + scan_freq_set_free(freqs); + freqs = NULL; + } + + return freqs; +} + static bool scan_periodic_queue(struct scan_context *sc) { struct scan_parameters params = {}; + struct scan_freq_set *freqs = scan_periodic_get_freqs(sc); + + /* + * If this happens its due to the user disabling all bands. This will + * cause IWD to never issue another periodic scan so warn the user of + * this. + */ + if (L_WARN_ON(!freqs)) + return false; + + params.freqs = freqs; if (sc->sp.needs_active_scan && known_networks_has_hidden()) { params.randomize_mac_addr_hint = true; @@ -1007,6 +1041,8 @@ static bool scan_periodic_queue(struct scan_context *sc) scan_periodic_notify, sc, scan_periodic_destroy); + scan_freq_set_free(freqs); + return sc->sp.id != 0; }