eiwd

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

commit 2c536ba4faa8ff3f1051ab9dc0ab106c1fefc6bc
parent 07cef99e5c500353a5c5a814f5a3c53ff11ea27c
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Mon, 28 Oct 2019 15:04:54 +0100

scan: Hide CCK rates if no_cck_rates set

no_cck_rates is set in the scan parameters generally to make sure
that the Probe Request frames are not sent at any of the 802.11b
rates during active scans.  With this patch we also omit those rates
from the Supported Rates IEs, which is required by the p2p spec and
also matches our flag's name.

Diffstat:
Msrc/scan.c | 38+++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/scan.c b/src/scan.c @@ -347,10 +347,46 @@ static struct l_genl_msg *scan_build_cmd(struct scan_context *sc, if (flags) l_genl_msg_append_attr(msg, NL80211_ATTR_SCAN_FLAGS, 4, &flags); - if (params->no_cck_rates) + if (params->no_cck_rates) { + static const uint8_t b_rates[] = { 2, 4, 11, 22 }; + uint8_t *scan_rates; + const uint8_t *supported; + unsigned int num_supported; + unsigned int count; + unsigned int i; + l_genl_msg_append_attr(msg, NL80211_ATTR_TX_NO_CCK_RATE, 0, NULL); + /* + * Assume if we're sending the probe requests at OFDM bit + * rates we don't want to advertise support for 802.11b rates. + */ + if (L_WARN_ON(!(supported = wiphy_get_supported_rates(sc->wiphy, + NL80211_BAND_2GHZ, + &num_supported)))) + goto done; + + scan_rates = l_malloc(num_supported); + + for (count = 0, i = 0; i < num_supported; i++) + if (!memchr(b_rates, supported[i], + L_ARRAY_SIZE(b_rates))) + scan_rates[count++] = supported[i]; + + if (L_WARN_ON(!count)) { + l_free(scan_rates); + goto done; + } + + l_genl_msg_enter_nested(msg, NL80211_ATTR_SCAN_SUPP_RATES); + l_genl_msg_append_attr(msg, NL80211_BAND_2GHZ, + count, scan_rates); + l_genl_msg_leave_nested(msg); + l_free(scan_rates); + } + +done: return msg; }