diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-01-07 23:28:08 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-01-10 20:12:58 +0100 |
commit | c5ac08548b53c3292aa3cbd02de6ae99ca7271e6 (patch) | |
tree | 6cf308093b7e7405d04e5e179dd61e53502f63b5 | |
parent | 85ca8fc74671def6041fb12c0a7d3423da56ffd3 (diff) | |
download | lwn-c5ac08548b53c3292aa3cbd02de6ae99ca7271e6.tar.gz lwn-c5ac08548b53c3292aa3cbd02de6ae99ca7271e6.zip |
mac80211_hwsim: register netlink even with multi-channel
Reject wmediumd registrations when any devices have multi-channel
capability, but register the generic netlink family unconditionally
to make it possible to add new commands that shouldn't depend on
the number of (default) channels.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 4ee88a9b095d..5bad3d4ccdba 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2243,6 +2243,22 @@ out: static int hwsim_register_received_nl(struct sk_buff *skb_2, struct genl_info *info) { + struct mac80211_hwsim_data *data; + int chans = 1; + + spin_lock_bh(&hwsim_radio_lock); + list_for_each_entry(data, &hwsim_radios, list) + chans = max(chans, data->channels); + spin_unlock_bh(&hwsim_radio_lock); + + /* In the future we should revise the userspace API and allow it + * to set a flag that it does support multi-channel, then we can + * let this pass conditionally on the flag. + * For current userspace, prohibit it since it won't work right. + */ + if (chans > 1) + return -EOPNOTSUPP; + if (wmediumd_portid) return -EBUSY; @@ -2300,10 +2316,6 @@ static int hwsim_init_netlink(void) { int rc; - /* userspace test API hasn't been adjusted for multi-channel */ - if (channels > 1) - return 0; - printk(KERN_INFO "mac80211_hwsim: initializing netlink\n"); rc = genl_register_family_with_ops(&hwsim_genl_family, hwsim_ops); @@ -2323,10 +2335,6 @@ failure: static void hwsim_exit_netlink(void) { - /* userspace test API hasn't been adjusted for multi-channel */ - if (channels > 1) - return; - /* unregister the notifier */ netlink_unregister_notifier(&hwsim_netlink_notifier); /* unregister the family */ |