]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Remove CCK supported rates when running P2P scan
authorRajkumar Manoharan <rmanohar@qca.qualcomm.com>
Sat, 10 Sep 2011 19:40:30 +0000 (22:40 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 10 Sep 2011 19:40:30 +0000 (22:40 +0300)
This allows drivers to disable CCK rates from Probe Request frames.
For nl80211, this is currently applying only to the supported rates
element(s), but this mechanism could be extended to address TX rate
control masking, too, to lessen need for global rate disabling.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
src/drivers/driver.h
src/drivers/driver_nl80211.c
wpa_supplicant/p2p_supplicant.c

index af730579426215809c559b5fcc1b5216f79ac9b2..3e9c132f64b36ae3d66bd6e0838b816af5cd39e7 100644 (file)
@@ -264,6 +264,15 @@ struct wpa_driver_scan_params {
         * num_filter_ssids - Number of entries in filter_ssids array
         */
        size_t num_filter_ssids;
+
+       /**
+        * p2p_probe - Used to disable CCK (802.11b) rates for P2P probes
+        *
+        * When set, the driver is expected to remove rates 1, 2, 5.5, and 11
+        * Mbps from the support rates element(s) in the Probe Request frames
+        * and not to transmit the frames at any of those rates.
+        */
+       u8 p2p_probe;
 };
 
 /**
index 3d8f9db6fd48b0cbf92972b53908a2bd97593220..c2fa19a5bcabad6ab87605dbe0041985c5a77760 100644 (file)
@@ -2438,16 +2438,18 @@ static int wpa_driver_nl80211_scan(void *priv,
        struct i802_bss *bss = priv;
        struct wpa_driver_nl80211_data *drv = bss->drv;
        int ret = 0, timeout;
-       struct nl_msg *msg, *ssids, *freqs;
+       struct nl_msg *msg, *ssids, *freqs, *rates;
        size_t i;
 
        msg = nlmsg_alloc();
        ssids = nlmsg_alloc();
        freqs = nlmsg_alloc();
-       if (!msg || !ssids || !freqs) {
+       rates = nlmsg_alloc();
+       if (!msg || !ssids || !freqs || !rates) {
                nlmsg_free(msg);
                nlmsg_free(ssids);
                nlmsg_free(freqs);
+               nlmsg_free(rates);
                return -1;
        }
 
@@ -2487,6 +2489,18 @@ static int wpa_driver_nl80211_scan(void *priv,
                nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
        }
 
+       if (params->p2p_probe) {
+               /*
+                * Remove 2.4 GHz rates 1, 2, 5.5, 11 Mbps from supported rates
+                * by masking out everything else apart from the OFDM rates 6,
+                * 9, 12, 18, 24, 36, 48, 54 Mbps from non-MCS rates. All 5 GHz
+                * rates are left enabled.
+                */
+               NLA_PUT(rates, NL80211_BAND_2GHZ, 8,
+                       "\x0c\x12\x18\x24\x30\x48\x60\x6c");
+               nla_put_nested(msg, NL80211_ATTR_SCAN_SUPP_RATES, rates);
+       }
+
        ret = send_and_recv_msgs(drv, msg, NULL, NULL);
        msg = NULL;
        if (ret) {
@@ -2538,6 +2552,7 @@ nla_put_failure:
        nlmsg_free(ssids);
        nlmsg_free(msg);
        nlmsg_free(freqs);
+       nlmsg_free(rates);
        return ret;
 }
 
index fba8e1e2f8497f4a9a16c44bcbefdff7d74d15f5..3b4e887996bda8fd78774014e26e1b89568f2043 100644 (file)
@@ -120,6 +120,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 
        p2p_scan_ie(wpa_s->global->p2p, ies);
 
+       params.p2p_probe = 1;
        params.extra_ies = wpabuf_head(ies);
        params.extra_ies_len = wpabuf_len(ies);
 
@@ -2789,6 +2790,7 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
 
        p2p_scan_ie(wpa_s->global->p2p, ies);
 
+       params.p2p_probe = 1;
        params.extra_ies = wpabuf_head(ies);
        params.extra_ies_len = wpabuf_len(ies);