diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-11-26 17:31:40 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-05 09:32:58 -0500 |
commit | e60c7744f8aa77bcbcb0b294596d6c87445d1200 (patch) | |
tree | 7039c0906d825b035595a826cd117fd08242d0ad /net/mac80211/wext.c | |
parent | fee52678dbda2099a25243e79da98dc390e1939a (diff) |
cfg80211: handle SIOCGIWMODE/SIOCSIWMODE
further reducing wext code in mac80211.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r-- | net/mac80211/wext.c | 76 |
1 files changed, 2 insertions, 74 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index b9eee3c903de..4e1fdcfacb0c 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -224,78 +224,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev, | |||
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | static int ieee80211_ioctl_siwmode(struct net_device *dev, | ||
228 | struct iw_request_info *info, | ||
229 | __u32 *mode, char *extra) | ||
230 | { | ||
231 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
232 | struct ieee80211_local *local = sdata->local; | ||
233 | int type; | ||
234 | |||
235 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) | ||
236 | return -EOPNOTSUPP; | ||
237 | |||
238 | switch (*mode) { | ||
239 | case IW_MODE_INFRA: | ||
240 | type = NL80211_IFTYPE_STATION; | ||
241 | break; | ||
242 | case IW_MODE_ADHOC: | ||
243 | /* Setting ad-hoc mode on non ibss channel is not | ||
244 | * supported. | ||
245 | */ | ||
246 | if (local->oper_channel && | ||
247 | (local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)) | ||
248 | return -EOPNOTSUPP; | ||
249 | |||
250 | type = NL80211_IFTYPE_ADHOC; | ||
251 | break; | ||
252 | case IW_MODE_REPEAT: | ||
253 | type = NL80211_IFTYPE_WDS; | ||
254 | break; | ||
255 | case IW_MODE_MONITOR: | ||
256 | type = NL80211_IFTYPE_MONITOR; | ||
257 | break; | ||
258 | default: | ||
259 | return -EINVAL; | ||
260 | } | ||
261 | |||
262 | return ieee80211_if_change_type(sdata, type); | ||
263 | } | ||
264 | |||
265 | |||
266 | static int ieee80211_ioctl_giwmode(struct net_device *dev, | ||
267 | struct iw_request_info *info, | ||
268 | __u32 *mode, char *extra) | ||
269 | { | ||
270 | struct ieee80211_sub_if_data *sdata; | ||
271 | |||
272 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
273 | switch (sdata->vif.type) { | ||
274 | case NL80211_IFTYPE_AP: | ||
275 | *mode = IW_MODE_MASTER; | ||
276 | break; | ||
277 | case NL80211_IFTYPE_STATION: | ||
278 | *mode = IW_MODE_INFRA; | ||
279 | break; | ||
280 | case NL80211_IFTYPE_ADHOC: | ||
281 | *mode = IW_MODE_ADHOC; | ||
282 | break; | ||
283 | case NL80211_IFTYPE_MONITOR: | ||
284 | *mode = IW_MODE_MONITOR; | ||
285 | break; | ||
286 | case NL80211_IFTYPE_WDS: | ||
287 | *mode = IW_MODE_REPEAT; | ||
288 | break; | ||
289 | case NL80211_IFTYPE_AP_VLAN: | ||
290 | *mode = IW_MODE_SECOND; /* FIXME */ | ||
291 | break; | ||
292 | default: | ||
293 | *mode = IW_MODE_AUTO; | ||
294 | break; | ||
295 | } | ||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, | 227 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, |
300 | struct iw_request_info *info, | 228 | struct iw_request_info *info, |
301 | struct iw_freq *freq, char *extra) | 229 | struct iw_freq *freq, char *extra) |
@@ -1109,8 +1037,8 @@ static const iw_handler ieee80211_handler[] = | |||
1109 | (iw_handler) NULL, /* SIOCGIWNWID */ | 1037 | (iw_handler) NULL, /* SIOCGIWNWID */ |
1110 | (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ | 1038 | (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ |
1111 | (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ | 1039 | (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ |
1112 | (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */ | 1040 | (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */ |
1113 | (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */ | 1041 | (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */ |
1114 | (iw_handler) NULL, /* SIOCSIWSENS */ | 1042 | (iw_handler) NULL, /* SIOCSIWSENS */ |
1115 | (iw_handler) NULL, /* SIOCGIWSENS */ | 1043 | (iw_handler) NULL, /* SIOCGIWSENS */ |
1116 | (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ | 1044 | (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ |