]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not reply to Probe Request frame indicating only 802.11b rates
authorJouni Malinen <j@w1.fi>
Fri, 15 Jul 2011 18:49:50 +0000 (21:49 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 15 Jul 2011 18:49:50 +0000 (21:49 +0300)
Per P2P specification 2.4.1, P2P Device shall shall not respond to
Probe Request frames that indicate support for only 802.11b rates.

src/p2p/p2p.c

index 5d8023ca954b9930b3ad6d56c80441293da85784..75a0329264d77273af5e39dfbd3697b5e49ff1c1 100644 (file)
@@ -1644,6 +1644,31 @@ 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++;
+       }
+
+       return num_11b > 0 && num_others == 0;
+}
+
+
 static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr,
                            const u8 *dst, const u8 *bssid, const u8 *ie,
                            size_t ie_len)
@@ -1689,6 +1714,11 @@ static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr,
                return;
        }
 
+       if (supp_rates_11b_only(&elems)) {
+               /* Indicates support for 11b rates only */
+               return;
+       }
+
        os_memset(&msg, 0, sizeof(msg));
        if (p2p_parse_ies(ie, ie_len, &msg) < 0) {
                /* Could not parse P2P attributes */