mac80211: add probe request building flags
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 May 2018 13:47:38 +0000 (15:47 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Fri, 15 Jun 2018 11:34:21 +0000 (13:34 +0200)
Add flags to pass through to probe request building and
change the "bool directed" to be one of them.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c
net/mac80211/scan.c
net/mac80211/util.c

index d1978aa1c15ddf4d946bae7458343f9875861451..ee2a25d6ecf2286bddfd64ed201aff2f3e516088 100644 (file)
@@ -2031,24 +2031,30 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
 void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
                                    const u8 *bssid, u16 stype, u16 reason,
                                    bool send_frame, u8 *frame_buf);
+
+enum {
+       IEEE80211_PROBE_FLAG_DIRECTED           = BIT(0),
+};
+
 int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
                             size_t buffer_len,
                             struct ieee80211_scan_ies *ie_desc,
                             const u8 *ie, size_t ie_len,
                             u8 bands_used, u32 *rate_masks,
-                            struct cfg80211_chan_def *chandef);
+                            struct cfg80211_chan_def *chandef,
+                            u32 flags);
 struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
                                          const u8 *src, const u8 *dst,
                                          u32 ratemask,
                                          struct ieee80211_channel *chan,
                                          const u8 *ssid, size_t ssid_len,
                                          const u8 *ie, size_t ie_len,
-                                         bool directed);
+                                         u32 flags);
 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
                              const u8 *src, const u8 *dst,
                              const u8 *ssid, size_t ssid_len,
                              const u8 *ie, size_t ie_len,
-                             u32 ratemask, bool directed, u32 tx_flags,
+                             u32 ratemask, u32 flags, u32 tx_flags,
                              struct ieee80211_channel *channel, bool scan);
 
 u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
index a59187c016e08193e50078becbd169820f2efe9a..c3f2883cc0ec25dd5aba42fb05895a4cd1027379 100644 (file)
@@ -2267,7 +2267,8 @@ static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
 
                ieee80211_send_probe_req(sdata, sdata->vif.addr, dst,
                                         ssid + 2, ssid_len, NULL,
-                                        0, (u32) -1, true, 0,
+                                        0, (u32) -1,
+                                        IEEE80211_PROBE_FLAG_DIRECTED, 0,
                                         ifmgd->associated->channel, false);
                rcu_read_unlock();
        }
@@ -2370,7 +2371,7 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
        skb = ieee80211_build_probe_req(sdata, sdata->vif.addr, cbss->bssid,
                                        (u32) -1, cbss->channel,
                                        ssid + 2, ssid_len,
-                                       NULL, 0, true);
+                                       NULL, 0, IEEE80211_PROBE_FLAG_DIRECTED);
        rcu_read_unlock();
 
        return skb;
index a3b1bcc2b4615373bc636a5f3e2b6ae326608c9b..8e28d8de26aa5f4d8ee929fc0bade8d662f254ae 100644 (file)
@@ -336,7 +336,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
                                         local->hw_scan_ies_bufsize,
                                         &local->hw_scan_req->ies,
                                         req->ie, req->ie_len,
-                                        bands_used, req->rates, &chandef);
+                                        bands_used, req->rates, &chandef, 0);
        local->hw_scan_req->req.ie_len = ielen;
        local->hw_scan_req->req.no_cck = req->no_cck;
        ether_addr_copy(local->hw_scan_req->req.mac_addr, req->mac_addr);
@@ -552,7 +552,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
                        sdata, local->scan_addr, scan_req->bssid,
                        scan_req->ssids[i].ssid, scan_req->ssids[i].ssid_len,
                        scan_req->ie, scan_req->ie_len,
-                       scan_req->rates[band], false,
+                       scan_req->rates[band], 0,
                        tx_flags, local->hw.conf.chandef.chan, true);
 
        /*
@@ -1167,7 +1167,8 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
 
        ieee80211_build_preq_ies(local, ie, num_bands * iebufsz,
                                 &sched_scan_ies, req->ie,
-                                req->ie_len, bands_used, rate_masks, &chandef);
+                                req->ie_len, bands_used, rate_masks, &chandef,
+                                0);
 
        ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies);
        if (ret == 0) {
index 2d82c88efd0b6f271b693067451cc75d210fb8c4..fb7264edecad16b5c84507b60fddfaaa3e67fbf6 100644 (file)
@@ -1353,7 +1353,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_local *local,
                                         enum nl80211_band band,
                                         u32 rate_mask,
                                         struct cfg80211_chan_def *chandef,
-                                        size_t *offset)
+                                        size_t *offset, u32 flags)
 {
        struct ieee80211_supported_band *sband;
        u8 *pos = buffer, *end = buffer + buffer_len;
@@ -1518,7 +1518,8 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
                             struct ieee80211_scan_ies *ie_desc,
                             const u8 *ie, size_t ie_len,
                             u8 bands_used, u32 *rate_masks,
-                            struct cfg80211_chan_def *chandef)
+                            struct cfg80211_chan_def *chandef,
+                            u32 flags)
 {
        size_t pos = 0, old_pos = 0, custom_ie_offset = 0;
        int i;
@@ -1533,7 +1534,8 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
                                                             ie, ie_len, i,
                                                             rate_masks[i],
                                                             chandef,
-                                                            &custom_ie_offset);
+                                                            &custom_ie_offset,
+                                                            flags);
                        ie_desc->ies[i] = buffer + old_pos;
                        ie_desc->len[i] = pos - old_pos;
                        old_pos = pos;
@@ -1561,7 +1563,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
                                          struct ieee80211_channel *chan,
                                          const u8 *ssid, size_t ssid_len,
                                          const u8 *ie, size_t ie_len,
-                                         bool directed)
+                                         u32 flags)
 {
        struct ieee80211_local *local = sdata->local;
        struct cfg80211_chan_def chandef;
@@ -1577,7 +1579,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
         * badly-behaved APs don't respond when this parameter is included.
         */
        chandef.width = sdata->vif.bss_conf.chandef.width;
-       if (directed)
+       if (flags & IEEE80211_PROBE_FLAG_DIRECTED)
                chandef.chan = NULL;
        else
                chandef.chan = chan;
@@ -1591,7 +1593,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
        ies_len = ieee80211_build_preq_ies(local, skb_tail_pointer(skb),
                                           skb_tailroom(skb), &dummy_ie_desc,
                                           ie, ie_len, BIT(chan->band),
-                                          rate_masks, &chandef);
+                                          rate_masks, &chandef, flags);
        skb_put(skb, ies_len);
 
        if (dst) {
@@ -1609,14 +1611,14 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
                              const u8 *src, const u8 *dst,
                              const u8 *ssid, size_t ssid_len,
                              const u8 *ie, size_t ie_len,
-                             u32 ratemask, bool directed, u32 tx_flags,
+                             u32 ratemask, u32 flags, u32 tx_flags,
                              struct ieee80211_channel *channel, bool scan)
 {
        struct sk_buff *skb;
 
        skb = ieee80211_build_probe_req(sdata, src, dst, ratemask, channel,
                                        ssid, ssid_len,
-                                       ie, ie_len, directed);
+                                       ie, ie_len, flags);
        if (skb) {
                IEEE80211_SKB_CB(skb)->flags |= tx_flags;
                if (scan)