[Bug 264238] wpa_supplicant 2.10 fails to associate to open secondary VAP when primary VAP is WPA

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 03 Jul 2022 12:28:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264238

--- Comment #188 from J.R. Oldroyd <fbsd@opal.com> ---
Yes, the code has been there for ages.

However, in 2.10 additional CONFIG_XYZ options are enabled which result in the
generation of an IE that wasn't being generated before.  That IE is (correctly
or incorrectly) being handed to our driver which is then incorrectly setting
WPA as a result of the IE.

Here is another proposed patch.

I have taken the approach that, if the driver receives an IE, whether or not it
should have received it, it should process the IE properly.  At the moment the
driver just says "hey, we have an IE, so lets enable WPA".  If the IE is the
generated WLAN_EID_EXT_CAPAB IE, it is not the correct behavior to enable WPA. 
So in this proposed patch, I am checking to see if the IE is WLAN_EID_RSN or at
least not WLAN_EID_EXT_CAPAB and only setting WPA in the appropriate case.

diff --git a/contrib/wpa/src/drivers/driver_bsd.c
b/contrib/wpa/src/drivers/driver_bsd.c
index c455bc93103..8ead569c2ff 100644
--- a/contrib/wpa/src/drivers/driver_bsd.c
+++ b/contrib/wpa/src/drivers/driver_bsd.c
@@ -1257,19 +1257,22 @@ wpa_driver_bsd_associate(void *priv, struct
wpa_driver_associate_params *params)
        if (wpa_driver_bsd_set_auth_alg(drv, params->auth_alg) < 0)
                ret = -1;
        /* XXX error handling is wrong but unclear what to do... */
-       if (wpa_driver_bsd_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len)
< 0)
+       if (params->wpa_ie_len && params->wpa_ie[0] == WLAN_EID_RSN &&
+           wpa_driver_bsd_set_wpa_ie(drv, params->wpa_ie, params->wpa_ie_len)
< 0)
                return -1;

        privacy = !(params->pairwise_suite == WPA_CIPHER_NONE &&
            params->group_suite == WPA_CIPHER_NONE &&
            params->key_mgmt_suite == WPA_KEY_MGMT_NONE &&
-           params->wpa_ie_len == 0);
+           (params->wpa_ie_len == 0 || params->wpa_ie[0] != WLAN_EID_RSN)
+           );
        wpa_printf(MSG_DEBUG, "%s: set PRIVACY %u", __func__, privacy);

        if (set80211param(drv, IEEE80211_IOC_PRIVACY, privacy) < 0)
                return -1;

        if (params->wpa_ie_len &&
+           params->wpa_ie[0] != WLAN_EID_EXT_CAPAB &&
            set80211param(drv, IEEE80211_IOC_WPA,
                          params->wpa_ie[0] == WLAN_EID_RSN ? 2 : 1) < 0)
                return -1;

-- 
You are receiving this mail because:
You are on the CC list for the bug.