eiwd

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

commit f3b31e48e0d48ba25e15be8839d66d82639426a5
parent 8d224624fc99f61d6d23bc98d2073e4e7a95b708
Author: James Prestwood <prestwoj@gmail.com>
Date:   Wed, 28 Sep 2022 09:36:32 -0700

station: reorder AP roam logic

There are a few checks that can be done prior to parsing the
request, in addition the explicit check for preparing_roam was
removed since this is taken care of by station_cannot_roam().

Diffstat:
Msrc/station.c | 55+++++++++++++++++++++++++------------------------------
1 file changed, 25 insertions(+), 30 deletions(-)

diff --git a/src/station.c b/src/station.c @@ -2763,6 +2763,31 @@ static void station_ap_directed_roam(struct station *station, if (station_cannot_roam(station)) return; + if (station->state != STATION_STATE_CONNECTED) { + l_debug("roam: unexpected AP directed roam -- ignore"); + return; + } + + /* + * Sanitize the frame to check that it is from our current AP. + * + * 802.11-2020 Section 9.3.3.1 about Address2: + * "If the STA is an AP with dot11MultiBSSDImplemented set to false, + * then this address is the BSSID." + * + * Address3: + * "If the STA is an AP or PCP, the Address 3 field is the same as the + * Address 2 field." + * + * For now check that Address2 & Address3 is the same as the connected + * BSS address. + */ + if (memcmp(hdr->address_2, station->connected_bss, ETH_ALEN) || + memcmp(hdr->address_2, hdr->address_3, ETH_ALEN)) { + l_debug("roam: AP directed roam not from our AP -- ignore"); + return; + } + if (body_len < 7) goto format_error; @@ -2816,36 +2841,6 @@ static void station_ap_directed_roam(struct station *station, pos += url_len; } - if (station->state != STATION_STATE_CONNECTED) { - l_debug("roam: unexpected AP directed roam -- ignore"); - return; - } - - /* - * Sanitize the frame to check that it is from our current AP. - * - * 802.11-2020 Section 9.3.3.1 about Address2: - * "If the STA is an AP with dot11MultiBSSDImplemented set to false, - * then this address is the BSSID." - * - * Address3: - * "If the STA is an AP or PCP, the Address 3 field is the same as the - * Address 2 field." - * - * For now check that Address2 & Address3 is the same as the connected - * BSS address. - */ - if (memcmp(hdr->address_2, station->connected_bss, ETH_ALEN) || - memcmp(hdr->address_2, hdr->address_3, ETH_ALEN)) { - l_debug("roam: AP directed roam not from our AP -- ignore"); - return; - } - - if (station->preparing_roam) { - l_debug("roam: roam attempt already in progress -- ignore"); - return; - } - station->ap_directed_roaming = true; station->preparing_roam = true;