]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Register for SAE Authentication frames more strictly
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Mon, 24 Feb 2020 09:14:26 +0000 (11:14 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 29 Feb 2020 20:55:55 +0000 (22:55 +0200)
If the driver requires external SAE authentication, it would result in
registration for all Authentication frames, so even non-SAE
Authentication frames might be forwarded to user space instead of being
handled internally. Fix this by using a more strict match pattern,
limiting the registration to the SAE authentication algorithm only.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/drivers/driver_nl80211.c

index 18e4b8eef918f8fefff80300577e3334928dd0fe..c29142f0f8b7bb782479118fa95dd89559f6e673 100644 (file)
@@ -2182,6 +2182,7 @@ static int nl80211_init_connect_handle(struct i802_bss *bss)
 static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss)
 {
        struct wpa_driver_nl80211_data *drv = bss->drv;
+       u16 type = (WLAN_FC_TYPE_MGMT << 2) | (WLAN_FC_STYPE_AUTH << 4);
        int ret = 0;
 
        if (nl80211_alloc_mgmt_handle(bss))
@@ -2189,13 +2190,14 @@ static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss)
        wpa_printf(MSG_DEBUG, "nl80211: Subscribe to mgmt frames with non-AP "
                   "handle %p", bss->nl_mgmt);
 
-       if (drv->nlmode == NL80211_IFTYPE_ADHOC ||
-           ((drv->capa.flags & WPA_DRIVER_FLAGS_SAE) &&
-            !(drv->capa.flags & WPA_DRIVER_FLAGS_SME))) {
-               u16 type = (WLAN_FC_TYPE_MGMT << 2) | (WLAN_FC_STYPE_AUTH << 4);
-
+       if (drv->nlmode == NL80211_IFTYPE_ADHOC) {
                /* register for any AUTH message */
                nl80211_register_frame(bss, bss->nl_mgmt, type, NULL, 0);
+       } else if ((drv->capa.flags & WPA_DRIVER_FLAGS_SAE) &&
+                  !(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) {
+               /* register for SAE Authentication frames */
+               nl80211_register_frame(bss, bss->nl_mgmt, type,
+                                      (u8 *) "\x03\x00", 2);
        }
 
 #ifdef CONFIG_INTERWORKING