]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not reply to 802.11b-only Probe Request frames as GO
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 19 Jun 2013 16:16:23 +0000 (19:16 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 19 Jun 2013 16:16:23 +0000 (19:16 +0300)
If AP mode SME/MLME within wpa_supplicant is used for processing Probe
Request frames in GO mode, drop Probe Request frames that include only
802.11b rates per P2P spec section 2.4.1.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/ap/beacon.c
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h
src/p2p/p2p.c

index 0ef307d34c6db450d2765c41437ade07719c1da9..2f4ba23a017e49a3dc1f5bde23a6f246b56cb367 100644 (file)
@@ -485,6 +485,17 @@ void handle_probe_req(struct hostapd_data *hapd,
        }
 #endif /* CONFIG_INTERWORKING */
 
+#ifdef CONFIG_P2P
+       if ((hapd->conf->p2p & P2P_GROUP_OWNER) &&
+           supp_rates_11b_only(&elems)) {
+               /* Indicates support for 11b rates only */
+               wpa_printf(MSG_EXCESSIVE, "P2P: Ignore Probe Request from "
+                          MACSTR " with only 802.11b rates",
+                          MAC2STR(mgmt->sa));
+               return;
+       }
+#endif /* CONFIG_P2P */
+
        /* TODO: verify that supp_rates contains at least one matching rate
         * with AP configuration */
 
index 407b066c249f7cc23793e798b568b120a10fbb20..aab8ac61cea19fc925d33c148c641f2922230a6f 100644 (file)
@@ -512,3 +512,36 @@ enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel)
 
        return mode;
 }
+
+
+static int is_11b(u8 rate)
+{
+       return rate == 0x02 || rate == 0x04 || rate == 0x0b || rate == 0x16;
+}
+
+
+int supp_rates_11b_only(struct ieee802_11_elems *elems)
+{
+       int num_11b = 0, num_others = 0;
+       int i;
+
+       if (elems->supp_rates == NULL && elems->ext_supp_rates == NULL)
+               return 0;
+
+       for (i = 0; elems->supp_rates && i < elems->supp_rates_len; i++) {
+               if (is_11b(elems->supp_rates[i]))
+                       num_11b++;
+               else
+                       num_others++;
+       }
+
+       for (i = 0; elems->ext_supp_rates && i < elems->ext_supp_rates_len;
+            i++) {
+               if (is_11b(elems->ext_supp_rates[i]))
+                       num_11b++;
+               else
+                       num_others++;
+       }
+
+       return num_11b > 0 && num_others == 0;
+}
index 7f59cf2566ed23d9d9ce7ef50a66acf316ad9364..68c6b96f1f7db8d2a37b00a6a767924e6f72e72a 100644 (file)
@@ -101,4 +101,6 @@ int hostapd_config_wmm_ac(struct hostapd_wmm_ac_params wmm_ac_params[],
                          const char *name, const char *val);
 enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel);
 
+int supp_rates_11b_only(struct ieee802_11_elems *elems);
+
 #endif /* IEEE802_11_COMMON_H */
index 1295be54e02aef8145abd25d2e824fe6f2fe2105..54f5ee8a689022db231e2683164c808ad4151a2e 100644 (file)
@@ -1899,39 +1899,6 @@ struct wpabuf * p2p_build_probe_resp_ies(struct p2p_data *p2p)
 }
 
 
-static int is_11b(u8 rate)
-{
-       return rate == 0x02 || rate == 0x04 || rate == 0x0b || rate == 0x16;
-}
-
-
-static int supp_rates_11b_only(struct ieee802_11_elems *elems)
-{
-       int num_11b = 0, num_others = 0;
-       int i;
-
-       if (elems->supp_rates == NULL && elems->ext_supp_rates == NULL)
-               return 0;
-
-       for (i = 0; elems->supp_rates && i < elems->supp_rates_len; i++) {
-               if (is_11b(elems->supp_rates[i]))
-                       num_11b++;
-               else
-                       num_others++;
-       }
-
-       for (i = 0; elems->ext_supp_rates && i < elems->ext_supp_rates_len;
-            i++) {
-               if (is_11b(elems->ext_supp_rates[i]))
-                       num_11b++;
-               else
-                       num_others++;
-       }
-
-       return num_11b > 0 && num_others == 0;
-}
-
-
 static enum p2p_probe_req_status
 p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
                const u8 *bssid, const u8 *ie, size_t ie_len)