aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-25 08:34:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-25 14:34:56 -0400
commit5eb5a52da6ef04604cf8faca43ec670f69f417d3 (patch)
tree4d3397d83cb533ba4fa8dd47b884305c877b01d7
parent45f7e3116fad77e6dd15cb0e2eaccb7de7b806c9 (diff)
mac80211: fix mesh advertisement
When a mac80211-based driver advertises mesh mode support, this will be advertised to userspace. However, if mac80211 was compiled without mesh support, then that won't actually be true. Fix this by removing the bit for mesh if mesh isn't compiled in. Since this synchronizes what we advertise to cfg80211 and actually support, it means we can now rely on cfg80211's interface type checks and need not check again in mac80211. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/mac80211/cfg.c33
-rw-r--r--net/mac80211/main.c5
2 files changed, 5 insertions, 33 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7693ebc77596..581438255d7e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -19,33 +19,6 @@
19#include "rate.h" 19#include "rate.h"
20#include "mesh.h" 20#include "mesh.h"
21 21
22static bool nl80211_type_check(enum nl80211_iftype type)
23{
24 switch (type) {
25 case NL80211_IFTYPE_ADHOC:
26 case NL80211_IFTYPE_STATION:
27 case NL80211_IFTYPE_MONITOR:
28#ifdef CONFIG_MAC80211_MESH
29 case NL80211_IFTYPE_MESH_POINT:
30#endif
31 case NL80211_IFTYPE_AP:
32 case NL80211_IFTYPE_AP_VLAN:
33 case NL80211_IFTYPE_WDS:
34 return true;
35 default:
36 return false;
37 }
38}
39
40static bool nl80211_params_check(enum nl80211_iftype type,
41 struct vif_params *params)
42{
43 if (!nl80211_type_check(type))
44 return false;
45
46 return true;
47}
48
49static int ieee80211_add_iface(struct wiphy *wiphy, char *name, 22static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
50 enum nl80211_iftype type, u32 *flags, 23 enum nl80211_iftype type, u32 *flags,
51 struct vif_params *params) 24 struct vif_params *params)
@@ -55,9 +28,6 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
55 struct ieee80211_sub_if_data *sdata; 28 struct ieee80211_sub_if_data *sdata;
56 int err; 29 int err;
57 30
58 if (!nl80211_params_check(type, params))
59 return -EINVAL;
60
61 err = ieee80211_if_add(local, name, &dev, type, params); 31 err = ieee80211_if_add(local, name, &dev, type, params);
62 if (err || type != NL80211_IFTYPE_MONITOR || !flags) 32 if (err || type != NL80211_IFTYPE_MONITOR || !flags)
63 return err; 33 return err;
@@ -85,9 +55,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
85 if (ieee80211_sdata_running(sdata)) 55 if (ieee80211_sdata_running(sdata))
86 return -EBUSY; 56 return -EBUSY;
87 57
88 if (!nl80211_params_check(type, params))
89 return -EINVAL;
90
91 ret = ieee80211_if_change_type(sdata, type); 58 ret = ieee80211_if_change_type(sdata, type);
92 if (ret) 59 if (ret)
93 return ret; 60 return ret;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 28415de5f476..80db5ea02052 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -622,6 +622,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
622 /* mac80211 always supports monitor */ 622 /* mac80211 always supports monitor */
623 local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); 623 local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
624 624
625#ifndef CONFIG_MAC80211_MESH
626 /* mesh depends on Kconfig, but drivers should set it if they want */
627 local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
628#endif
629
625 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) 630 if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
626 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; 631 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
627 else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) 632 else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)