Date: Fri, 24 Mar 2023 19:41:15 +0000 From: obiwac <obiwac@gmail.com> To: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: net80211 association failures in station mode Message-ID: <CAN8-kNWaW4MypL-L5WJRJg3MNfCyha5nGdzXL=jScGVDb%2Br5pQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hey, Recently I've been getting a lot of association failures with wpa_supplicant(8). I looked into things a little and found that the issue comes when iterating over the sta scan table with mlmelookup (sys/net80211/ieee80211_ioctl.c) in setmlme_assoc_sta, which first checks if the MAC addresses are equal between the query and a scan entry, and then checks if the SSID's are equal. (Minor issue but the "Match mac address and *any* ssid." comment above is wrong, right?) Thing is that query used when calling setmlme_assoc_sta (in ieee80211_ioctl_setmlme) is the vap's SSID (vap->iv_des_ssid[0]), whereas the one used when calling setmlme_assoc_adhoc for adhoc networks is the SSID contained in the MLME request structure (mlme.im_ssid): static int ieee80211_ioctl_setmlme(struct ieee80211vap *vap, struct ieee80211req *ireq) { struct ieee80211req_mlme mlme; ... int error = copyin(ireq->i_data, &mlme, sizeof(mlme)); ... if (vap->iv_opmode == IEEE80211_M_STA && mlme.im_op == IEEE80211_MLME_ASSOC) return setmlme_assoc_sta(vap, mlme.im_macaddr, vap->iv_des_ssid[0].len, vap->iv_des_ssid[0].ssid); else if ((vap->iv_opmode == IEEE80211_M_IBSS || vap->iv_opmode == IEEE80211_M_AHDEMO) && mlme.im_op == IEEE80211_MLME_ASSOC) return setmlme_assoc_adhoc(vap, mlme.im_macaddr, mlme.im_ssid_len, mlme.im_ssid); ... } I would have expected these SSID arguments be the other way around, because e.g. when wpa_supplicant(8) tries to associate in station mode, it sets the wanted SSID in the MLME request structure and then calls IEEE802_IOC_MLME - in fact, when reversing these arguments, I can associate no problem and things operate as I'd expect again... But since this code has last been touched over a decade ago, I feel like there's something I'm missing/doing wrong here :P If this is indeed wrong I'll make a diff :) Thanks in advance, Aymeric
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN8-kNWaW4MypL-L5WJRJg3MNfCyha5nGdzXL=jScGVDb%2Br5pQ>