diff options
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 41 |
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 | ||
1163 | static int ieee80211_set_channel(struct wiphy *wiphy, | 1163 | static 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, | |||
1213 | static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, | 1226 | static 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, | |||
1235 | static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | 1262 | static 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 | ||