While testing my assocfail diff I have found a bug. The beacon parsing
code will skip RSN information in beacons unless WPA is active in the
current configuration. The symptom of this was WPA2 APs being flagged
!wpaprotos sometimes. I've even seen scan results in debug output where
every line contained !rsn, just because WPA was disabled during the
scan (i.e. ic->ic_rsnprotos was set to zero).

In my opinion the implicit assumption that WPA is always enabled is wrong.
So instead of checking the current WPA configuration, check whether the
driver announces WPA support. This way, all nodes have their RSN IEs parsed.

This code attempts to infer the highest mutually supported WPA version.
It is safe to always assume that the highest version we support is WPA2.
I don't think we have any driver which supports WPA1 but not WPA2.
Should we have a driver which supports WPA1 but not WPA2, the driver
would need to be urgently fixed anyway.

ok?

diff fd4c5934aa7aaaf9db9d202db33c8f150f540cec /usr/src
blob - 31842d7d3fff5c31b84e2c72eb9ca56136ab25fa
file + sys/net80211/ieee80211_input.c
--- sys/net80211/ieee80211_input.c
+++ sys/net80211/ieee80211_input.c
@@ -1676,7 +1676,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, str
                 */
                if (rsnie != NULL &&
                    (ni->ni_supported_rsnprotos & IEEE80211_PROTO_RSN) &&
-                   (ic->ic_rsnprotos & IEEE80211_PROTO_RSN)) {
+                   (ic->ic_caps & IEEE80211_C_RSN)) {
                        if (ieee80211_save_ie(rsnie, &ni->ni_rsnie) == 0
 #ifndef IEEE80211_STA_ONLY
                        && ic->ic_opmode != IEEE80211_M_HOSTAP
@@ -1692,7 +1692,7 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, str
                        }
                } else if (wpaie != NULL &&
                    (ni->ni_supported_rsnprotos & IEEE80211_PROTO_WPA) &&
-                   (ic->ic_rsnprotos & IEEE80211_PROTO_WPA)) {
+                   (ic->ic_caps & IEEE80211_C_RSN)) {
                        if (ieee80211_save_ie(wpaie, &ni->ni_rsnie) == 0
 #ifndef IEEE80211_STA_ONLY
                        && ic->ic_opmode != IEEE80211_M_HOSTAP



Reply via email to