Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 341598
b: refs/heads/master
c: 0172bb7
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg committed Nov 23, 2012
1 parent bdae4fa commit 5a24dfc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03ae834faac9831181ae471543d9f640b75c652b
refs/heads/master: 0172bb75073e11a5aa9d8a953bdaefb8709f00c8
9 changes: 1 addition & 8 deletions trunk/net/mac80211/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
u8 *elements;
struct ieee80211_channel *channel;
size_t baselen;
int freq;
bool beacon;
struct ieee802_11_elems elems;

Expand Down Expand Up @@ -209,13 +208,7 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)

ieee802_11_parse_elems(elements, skb->len - baselen, &elems);

if (elems.ds_params && elems.ds_params_len == 1)
freq = ieee80211_channel_to_frequency(elems.ds_params[0],
rx_status->band);
else
freq = rx_status->freq;

channel = ieee80211_get_channel(local->hw.wiphy, freq);
channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq);

if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
return;
Expand Down
45 changes: 44 additions & 1 deletion trunk/net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,38 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
return found;
}

static struct ieee80211_channel *
cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,
struct ieee80211_channel *channel)
{
const u8 *tmp;
u32 freq;
int channel_number = -1;

tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen);
if (tmp && tmp[1] == 1) {
channel_number = tmp[2];
} else {
tmp = cfg80211_find_ie(WLAN_EID_HT_OPERATION, ie, ielen);
if (tmp && tmp[1] >= sizeof(struct ieee80211_ht_operation)) {
struct ieee80211_ht_operation *htop = (void *)(tmp + 2);

channel_number = htop->primary_chan;
}
}

if (channel_number < 0)
return channel;

freq = ieee80211_channel_to_frequency(channel_number, channel->band);
channel = ieee80211_get_channel(wiphy, freq);
if (!channel)
return NULL;
if (channel->flags & IEEE80211_CHAN_DISABLED)
return NULL;
return channel;
}

struct cfg80211_bss*
cfg80211_inform_bss(struct wiphy *wiphy,
struct ieee80211_channel *channel,
Expand All @@ -790,6 +822,10 @@ cfg80211_inform_bss(struct wiphy *wiphy,
(signal < 0 || signal > 100)))
return NULL;

channel = cfg80211_get_bss_channel(wiphy, ie, ielen, channel);
if (!channel)
return NULL;

res = kzalloc(sizeof(*res) + privsz + ielen, gfp);
if (!res)
return NULL;
Expand Down Expand Up @@ -839,11 +875,13 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
s32 signal, gfp_t gfp)
{
struct cfg80211_internal_bss *res;

size_t ielen = len - offsetof(struct ieee80211_mgmt,
u.probe_resp.variable);
size_t privsz;

BUILD_BUG_ON(offsetof(struct ieee80211_mgmt, u.probe_resp.variable) !=
offsetof(struct ieee80211_mgmt, u.beacon.variable));

trace_cfg80211_inform_bss_frame(wiphy, channel, mgmt, len, signal);

if (WARN_ON(!mgmt))
Expand All @@ -861,6 +899,11 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,

privsz = wiphy->bss_priv_size;

channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable,
ielen, channel);
if (!channel)
return NULL;

res = kzalloc(sizeof(*res) + privsz + ielen, gfp);
if (!res)
return NULL;
Expand Down

0 comments on commit 5a24dfc

Please sign in to comment.