]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Do not add NL80211_ATTR_SMPS_MODE attribute if HT is disabled
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 18 Mar 2016 14:16:40 +0000 (16:16 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 18 Mar 2016 14:16:40 +0000 (16:16 +0200)
SMPS mode is applicable only for HT and including an attribute to
configure it when HT is disabled could result in the AP start operation
failing. Fix this by adding the attribute only in cases where HT is
enabled.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/drivers/driver_nl80211.c

index 5fb6652a031ed8860ecb388598a76630f7d49c6f..b4c3462c734973a8f053a896938c05ea5ba2d298 100644 (file)
@@ -3526,24 +3526,26 @@ static int wpa_driver_nl80211_set_ap(void *priv,
            nla_put_u32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, suite))
                goto fail;
 
-       switch (params->smps_mode) {
-       case HT_CAP_INFO_SMPS_DYNAMIC:
-               wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - dynamic");
-               smps_mode = NL80211_SMPS_DYNAMIC;
-               break;
-       case HT_CAP_INFO_SMPS_STATIC:
-               wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - static");
-               smps_mode = NL80211_SMPS_STATIC;
-               break;
-       default:
-               /* invalid - fallback to smps off */
-       case HT_CAP_INFO_SMPS_DISABLED:
-               wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - off");
-               smps_mode = NL80211_SMPS_OFF;
-               break;
+       if (params->ht_opmode != -1) {
+               switch (params->smps_mode) {
+               case HT_CAP_INFO_SMPS_DYNAMIC:
+                       wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - dynamic");
+                       smps_mode = NL80211_SMPS_DYNAMIC;
+                       break;
+               case HT_CAP_INFO_SMPS_STATIC:
+                       wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - static");
+                       smps_mode = NL80211_SMPS_STATIC;
+                       break;
+               default:
+                       /* invalid - fallback to smps off */
+               case HT_CAP_INFO_SMPS_DISABLED:
+                       wpa_printf(MSG_DEBUG, "nl80211: SMPS mode - off");
+                       smps_mode = NL80211_SMPS_OFF;
+                       break;
+               }
+               if (nla_put_u32(msg, NL80211_ATTR_SMPS_MODE, smps_mode))
+                       goto fail;
        }
-       if (nla_put_u32(msg, NL80211_ATTR_SMPS_MODE, smps_mode))
-               goto fail;
 
        if (params->beacon_ies) {
                wpa_hexdump_buf(MSG_DEBUG, "nl80211: beacon_ies",