aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2010-05-05 09:25:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-05-07 14:55:50 -0400
commitf444de05d20e27cdd960c13fcbcfca3099f03143 (patch)
treea7fbef60420d88dda5840e06094be21ee3eb1dc0 /net/mac80211/cfg.c
parentac8dd506e40ee2c7fcc61654a44c32555a0a8d6c (diff)
cfg80211/mac80211: better channel handling
Currently (all tested with hwsim) you can do stupid things like setting up an AP on a certain channel, then adding another virtual interface and making that associate on another channel -- this will make the beaconing to move channel but obviously without the necessary IEs data update. In order to improve this situation, first make the configuration APIs (cfg80211 and nl80211) aware of multi-channel operation -- we'll eventually need that in the future anyway. There's one userland API change and one API addition. The API change is that now SET_WIPHY must be called with virtual interface index rather than only wiphy index in order to take effect for that interface -- luckily all current users (hostapd) do that. For monitor interfaces, the old setting is preserved, but monitors are always slaved to other devices anyway so no guarantees. The second userland API change is the introduction of a per virtual interface SET_CHANNEL command, that hostapd should use going forward to make it easier to understand what's going on (it can automatically detect a kernel with this command). Other than mac80211, no existing cfg80211 drivers are affected by this change because they only allow a single virtual interface. mac80211, however, now needs to be aware that the channel settings are per interface now, and needs to disallow (for now) real multi-channel operation, which is another important part of this patch. One of the immediate benefits is that you can now start hostapd to operate on a hardware that already has a connection on another virtual interface, as long as you specify the same channel. Note that two things are left unhandled (this is an improvement -- not a complete fix): * different HT/no-HT modes currently you could start an HT AP and then connect to a non-HT network on the same channel which would configure the hardware for no HT; that can be fixed fairly easily * CSA An AP we're connected to on a virtual interface might indicate switching channels, and in that case we would follow it, regardless of how many other interfaces are operating; this requires more effort to fix but is pretty rare after all Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index b575a5066219..414b7dd7d7fd 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1161,11 +1161,24 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy,
1161} 1161}
1162 1162
1163static int ieee80211_set_channel(struct wiphy *wiphy, 1163static int ieee80211_set_channel(struct wiphy *wiphy,
1164 struct net_device *netdev,
1164 struct ieee80211_channel *chan, 1165 struct ieee80211_channel *chan,
1165 enum nl80211_channel_type channel_type) 1166 enum nl80211_channel_type channel_type)
1166{ 1167{
1167 struct ieee80211_local *local = wiphy_priv(wiphy); 1168 struct ieee80211_local *local = wiphy_priv(wiphy);
1168 1169
1170 switch (ieee80211_get_channel_mode(local, NULL)) {
1171 case CHAN_MODE_HOPPING:
1172 return -EBUSY;
1173 case CHAN_MODE_FIXED:
1174 if (local->oper_channel == chan &&
1175 local->oper_channel_type == channel_type)
1176 return 0;
1177 return -EBUSY;
1178 case CHAN_MODE_UNDEFINED:
1179 break;
1180 }
1181
1169 local->oper_channel = chan; 1182 local->oper_channel = chan;
1170 local->oper_channel_type = channel_type; 1183 local->oper_channel_type = channel_type;
1171 1184
@@ -1213,6 +1226,20 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev,
1213static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, 1226static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
1214 struct cfg80211_assoc_request *req) 1227 struct cfg80211_assoc_request *req)
1215{ 1228{
1229 struct ieee80211_local *local = wiphy_priv(wiphy);
1230 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1231
1232 switch (ieee80211_get_channel_mode(local, sdata)) {
1233 case CHAN_MODE_HOPPING:
1234 return -EBUSY;
1235 case CHAN_MODE_FIXED:
1236 if (local->oper_channel == req->bss->channel)
1237 break;
1238 return -EBUSY;
1239 case CHAN_MODE_UNDEFINED:
1240 break;
1241 }
1242
1216 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req); 1243 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req);
1217} 1244}
1218 1245
@@ -1235,8 +1262,22 @@ static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
1235static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, 1262static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
1236 struct cfg80211_ibss_params *params) 1263 struct cfg80211_ibss_params *params)
1237{ 1264{
1265 struct ieee80211_local *local = wiphy_priv(wiphy);
1238 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1266 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1239 1267
1268 switch (ieee80211_get_channel_mode(local, sdata)) {
1269 case CHAN_MODE_HOPPING:
1270 return -EBUSY;
1271 case CHAN_MODE_FIXED:
1272 if (!params->channel_fixed)
1273 return -EBUSY;
1274 if (local->oper_channel == params->channel)
1275 break;
1276 return -EBUSY;
1277 case CHAN_MODE_UNDEFINED:
1278 break;
1279 }
1280
1240 return ieee80211_ibss_join(sdata, params); 1281 return ieee80211_ibss_join(sdata, params);
1241} 1282}
1242 1283