cfg80211: send regulatory beacon hint events to userspace
This informs userspace when a change has occured on a world roaming wiphy's channel which has lifted some restrictions due to a regulatory beacon hint. Because this is now sent to userspace through the regulatory multicast group we remove the debug prints we used to use as they are no longer necessary. Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
5dab3b8a68
commit
6bad876662
4 changed files with 106 additions and 15 deletions
|
|
@ -3491,6 +3491,60 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
|
|||
nlmsg_free(msg);
|
||||
}
|
||||
|
||||
void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
|
||||
struct ieee80211_channel *channel_before,
|
||||
struct ieee80211_channel *channel_after)
|
||||
{
|
||||
struct sk_buff *msg;
|
||||
void *hdr;
|
||||
struct nlattr *nl_freq;
|
||||
|
||||
msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
|
||||
if (!msg)
|
||||
return;
|
||||
|
||||
hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_REG_BEACON_HINT);
|
||||
if (!hdr) {
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Since we are applying the beacon hint to a wiphy we know its
|
||||
* wiphy_idx is valid
|
||||
*/
|
||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy));
|
||||
|
||||
/* Before */
|
||||
nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE);
|
||||
if (!nl_freq)
|
||||
goto nla_put_failure;
|
||||
if (nl80211_msg_put_channel(msg, channel_before))
|
||||
goto nla_put_failure;
|
||||
nla_nest_end(msg, nl_freq);
|
||||
|
||||
/* After */
|
||||
nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_AFTER);
|
||||
if (!nl_freq)
|
||||
goto nla_put_failure;
|
||||
if (nl80211_msg_put_channel(msg, channel_after))
|
||||
goto nla_put_failure;
|
||||
nla_nest_end(msg, nl_freq);
|
||||
|
||||
if (genlmsg_end(msg, hdr) < 0) {
|
||||
nlmsg_free(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
genlmsg_multicast(msg, 0, nl80211_regulatory_mcgrp.id, GFP_ATOMIC);
|
||||
|
||||
return;
|
||||
|
||||
nla_put_failure:
|
||||
genlmsg_cancel(msg, hdr);
|
||||
nlmsg_free(msg);
|
||||
}
|
||||
|
||||
/* initialisation/exit functions */
|
||||
|
||||
int nl80211_init(void)
|
||||
|
|
|
|||
|
|
@ -29,4 +29,9 @@ nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
|
|||
enum nl80211_key_type key_type,
|
||||
int key_id, const u8 *tsc);
|
||||
|
||||
extern void
|
||||
nl80211_send_beacon_hint_event(struct wiphy *wiphy,
|
||||
struct ieee80211_channel *channel_before,
|
||||
struct ieee80211_channel *channel_after);
|
||||
|
||||
#endif /* __NET_WIRELESS_NL80211_H */
|
||||
|
|
|
|||
|
|
@ -1049,18 +1049,10 @@ static void handle_reg_beacon(struct wiphy *wiphy,
|
|||
unsigned int chan_idx,
|
||||
struct reg_beacon *reg_beacon)
|
||||
{
|
||||
#ifdef CONFIG_CFG80211_REG_DEBUG
|
||||
#define REG_DEBUG_BEACON_FLAG(desc) \
|
||||
printk(KERN_DEBUG "cfg80211: Enabling " desc " on " \
|
||||
"frequency: %d MHz (Ch %d) on %s\n", \
|
||||
reg_beacon->chan.center_freq, \
|
||||
ieee80211_frequency_to_channel(reg_beacon->chan.center_freq), \
|
||||
wiphy_name(wiphy));
|
||||
#else
|
||||
#define REG_DEBUG_BEACON_FLAG(desc) do {} while (0)
|
||||
#endif
|
||||
struct ieee80211_supported_band *sband;
|
||||
struct ieee80211_channel *chan;
|
||||
bool channel_changed = false;
|
||||
struct ieee80211_channel chan_before;
|
||||
|
||||
assert_cfg80211_lock();
|
||||
|
||||
|
|
@ -1070,20 +1062,28 @@ static void handle_reg_beacon(struct wiphy *wiphy,
|
|||
if (likely(chan->center_freq != reg_beacon->chan.center_freq))
|
||||
return;
|
||||
|
||||
if (chan->beacon_found)
|
||||
return;
|
||||
|
||||
chan->beacon_found = true;
|
||||
|
||||
chan_before.center_freq = chan->center_freq;
|
||||
chan_before.flags = chan->flags;
|
||||
|
||||
if ((chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) &&
|
||||
!(chan->orig_flags & IEEE80211_CHAN_PASSIVE_SCAN)) {
|
||||
chan->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
|
||||
REG_DEBUG_BEACON_FLAG("active scanning");
|
||||
channel_changed = true;
|
||||
}
|
||||
|
||||
if ((chan->flags & IEEE80211_CHAN_NO_IBSS) &&
|
||||
!(chan->orig_flags & IEEE80211_CHAN_NO_IBSS)) {
|
||||
chan->flags &= ~IEEE80211_CHAN_NO_IBSS;
|
||||
REG_DEBUG_BEACON_FLAG("beaconing");
|
||||
channel_changed = true;
|
||||
}
|
||||
|
||||
chan->beacon_found = true;
|
||||
#undef REG_DEBUG_BEACON_FLAG
|
||||
if (channel_changed)
|
||||
nl80211_send_beacon_hint_event(wiphy, &chan_before, chan);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue