aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-04-02 14:08:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:40 -0400
commit6bad8766620a3c8b64afa981502fdb543e3cfd6c (patch)
tree7524ea7826a443d920062e48fe081e82b6fd7385 /net
parent5dab3b8a68cc97a7e6b9f79f5de05803c8e55a3c (diff)
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>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/nl80211.c54
-rw-r--r--net/wireless/nl80211.h5
-rw-r--r--net/wireless/reg.c28
3 files changed, 73 insertions, 14 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 7285bdc4e598..85b5aa3c76f8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3491,6 +3491,60 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
3491 nlmsg_free(msg); 3491 nlmsg_free(msg);
3492} 3492}
3493 3493
3494void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
3495 struct ieee80211_channel *channel_before,
3496 struct ieee80211_channel *channel_after)
3497{
3498 struct sk_buff *msg;
3499 void *hdr;
3500 struct nlattr *nl_freq;
3501
3502 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
3503 if (!msg)
3504 return;
3505
3506 hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_REG_BEACON_HINT);
3507 if (!hdr) {
3508 nlmsg_free(msg);
3509 return;
3510 }
3511
3512 /*
3513 * Since we are applying the beacon hint to a wiphy we know its
3514 * wiphy_idx is valid
3515 */
3516 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy));
3517
3518 /* Before */
3519 nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE);
3520 if (!nl_freq)
3521 goto nla_put_failure;
3522 if (nl80211_msg_put_channel(msg, channel_before))
3523 goto nla_put_failure;
3524 nla_nest_end(msg, nl_freq);
3525
3526 /* After */
3527 nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_AFTER);
3528 if (!nl_freq)
3529 goto nla_put_failure;
3530 if (nl80211_msg_put_channel(msg, channel_after))
3531 goto nla_put_failure;
3532 nla_nest_end(msg, nl_freq);
3533
3534 if (genlmsg_end(msg, hdr) < 0) {
3535 nlmsg_free(msg);
3536 return;
3537 }
3538
3539 genlmsg_multicast(msg, 0, nl80211_regulatory_mcgrp.id, GFP_ATOMIC);
3540
3541 return;
3542
3543nla_put_failure:
3544 genlmsg_cancel(msg, hdr);
3545 nlmsg_free(msg);
3546}
3547
3494/* initialisation/exit functions */ 3548/* initialisation/exit functions */
3495 3549
3496int nl80211_init(void) 3550int nl80211_init(void)
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index e4b92cccd157..b3aaa59afa08 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -29,4 +29,9 @@ nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
29 enum nl80211_key_type key_type, 29 enum nl80211_key_type key_type,
30 int key_id, const u8 *tsc); 30 int key_id, const u8 *tsc);
31 31
32extern void
33nl80211_send_beacon_hint_event(struct wiphy *wiphy,
34 struct ieee80211_channel *channel_before,
35 struct ieee80211_channel *channel_after);
36
32#endif /* __NET_WIRELESS_NL80211_H */ 37#endif /* __NET_WIRELESS_NL80211_H */
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 4af4304cec3e..574e217bcc86 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1049,18 +1049,10 @@ static void handle_reg_beacon(struct wiphy *wiphy,
1049 unsigned int chan_idx, 1049 unsigned int chan_idx,
1050 struct reg_beacon *reg_beacon) 1050 struct reg_beacon *reg_beacon)
1051{ 1051{
1052#ifdef CONFIG_CFG80211_REG_DEBUG
1053#define REG_DEBUG_BEACON_FLAG(desc) \
1054 printk(KERN_DEBUG "cfg80211: Enabling " desc " on " \
1055 "frequency: %d MHz (Ch %d) on %s\n", \
1056 reg_beacon->chan.center_freq, \
1057 ieee80211_frequency_to_channel(reg_beacon->chan.center_freq), \
1058 wiphy_name(wiphy));
1059#else
1060#define REG_DEBUG_BEACON_FLAG(desc) do {} while (0)
1061#endif
1062 struct ieee80211_supported_band *sband; 1052 struct ieee80211_supported_band *sband;
1063 struct ieee80211_channel *chan; 1053 struct ieee80211_channel *chan;
1054 bool channel_changed = false;
1055 struct ieee80211_channel chan_before;
1064 1056
1065 assert_cfg80211_lock(); 1057 assert_cfg80211_lock();
1066 1058
@@ -1070,20 +1062,28 @@ static void handle_reg_beacon(struct wiphy *wiphy,
1070 if (likely(chan->center_freq != reg_beacon->chan.center_freq)) 1062 if (likely(chan->center_freq != reg_beacon->chan.center_freq))
1071 return; 1063 return;
1072 1064
1065 if (chan->beacon_found)
1066 return;
1067
1068 chan->beacon_found = true;
1069
1070 chan_before.center_freq = chan->center_freq;
1071 chan_before.flags = chan->flags;
1072
1073 if ((chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) && 1073 if ((chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) &&
1074 !(chan->orig_flags & IEEE80211_CHAN_PASSIVE_SCAN)) { 1074 !(chan->orig_flags & IEEE80211_CHAN_PASSIVE_SCAN)) {
1075 chan->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; 1075 chan->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
1076 REG_DEBUG_BEACON_FLAG("active scanning"); 1076 channel_changed = true;
1077 } 1077 }
1078 1078
1079 if ((chan->flags & IEEE80211_CHAN_NO_IBSS) && 1079 if ((chan->flags & IEEE80211_CHAN_NO_IBSS) &&
1080 !(chan->orig_flags & IEEE80211_CHAN_NO_IBSS)) { 1080 !(chan->orig_flags & IEEE80211_CHAN_NO_IBSS)) {
1081 chan->flags &= ~IEEE80211_CHAN_NO_IBSS; 1081 chan->flags &= ~IEEE80211_CHAN_NO_IBSS;
1082 REG_DEBUG_BEACON_FLAG("beaconing"); 1082 channel_changed = true;
1083 } 1083 }
1084 1084
1085 chan->beacon_found = true; 1085 if (channel_changed)
1086#undef REG_DEBUG_BEACON_FLAG 1086 nl80211_send_beacon_hint_event(wiphy, &chan_before, chan);
1087} 1087}
1088 1088
1089/* 1089/*