2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/netdevice.h>
13 #include <linux/types.h>
14 #include <linux/slab.h>
15 #include <linux/skbuff.h>
16 #include <linux/etherdevice.h>
17 #include <linux/if_arp.h>
18 #include <linux/wireless.h>
19 #include <net/iw_handler.h>
20 #include <asm/uaccess.h>
22 #include <net/mac80211.h>
23 #include "ieee80211_i.h"
30 static int ieee80211_ioctl_siwessid(struct net_device *dev,
31 struct iw_request_info *info,
32 struct iw_point *data, char *ssid)
34 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
36 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
37 return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
38 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
39 return cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
45 static int ieee80211_ioctl_giwessid(struct net_device *dev,
46 struct iw_request_info *info,
47 struct iw_point *data, char *ssid)
49 struct ieee80211_sub_if_data *sdata;
51 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
53 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
54 return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
55 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
56 return cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
62 static int ieee80211_ioctl_siwap(struct net_device *dev,
63 struct iw_request_info *info,
64 struct sockaddr *ap_addr, char *extra)
66 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
68 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
69 return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
71 if (sdata->vif.type == NL80211_IFTYPE_STATION)
72 return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
74 if (sdata->vif.type == NL80211_IFTYPE_WDS)
75 return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra);
80 static int ieee80211_ioctl_giwap(struct net_device *dev,
81 struct iw_request_info *info,
82 struct sockaddr *ap_addr, char *extra)
84 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
86 if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
87 return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
89 if (sdata->vif.type == NL80211_IFTYPE_STATION)
90 return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
92 if (sdata->vif.type == NL80211_IFTYPE_WDS)
93 return cfg80211_wds_wext_giwap(dev, info, ap_addr, extra);
99 /* Structures to export the Wireless Handlers */
101 static const iw_handler ieee80211_handler[] =
103 (iw_handler) NULL, /* SIOCSIWCOMMIT */
104 (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
105 (iw_handler) NULL, /* SIOCSIWNWID */
106 (iw_handler) NULL, /* SIOCGIWNWID */
107 (iw_handler) cfg80211_wext_siwfreq, /* SIOCSIWFREQ */
108 (iw_handler) cfg80211_wext_giwfreq, /* SIOCGIWFREQ */
109 (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */
110 (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */
111 (iw_handler) NULL, /* SIOCSIWSENS */
112 (iw_handler) NULL, /* SIOCGIWSENS */
113 (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
114 (iw_handler) cfg80211_wext_giwrange, /* SIOCGIWRANGE */
115 (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
116 (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
117 (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
118 (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
119 (iw_handler) NULL, /* SIOCSIWSPY */
120 (iw_handler) NULL, /* SIOCGIWSPY */
121 (iw_handler) NULL, /* SIOCSIWTHRSPY */
122 (iw_handler) NULL, /* SIOCGIWTHRSPY */
123 (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
124 (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
125 (iw_handler) cfg80211_wext_siwmlme, /* SIOCSIWMLME */
126 (iw_handler) NULL, /* SIOCGIWAPLIST */
127 (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */
128 (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */
129 (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */
130 (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */
131 (iw_handler) NULL, /* SIOCSIWNICKN */
132 (iw_handler) NULL, /* SIOCGIWNICKN */
133 (iw_handler) NULL, /* -- hole -- */
134 (iw_handler) NULL, /* -- hole -- */
135 (iw_handler) cfg80211_wext_siwrate, /* SIOCSIWRATE */
136 (iw_handler) cfg80211_wext_giwrate, /* SIOCGIWRATE */
137 (iw_handler) cfg80211_wext_siwrts, /* SIOCSIWRTS */
138 (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */
139 (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */
140 (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */
141 (iw_handler) cfg80211_wext_siwtxpower, /* SIOCSIWTXPOW */
142 (iw_handler) cfg80211_wext_giwtxpower, /* SIOCGIWTXPOW */
143 (iw_handler) cfg80211_wext_siwretry, /* SIOCSIWRETRY */
144 (iw_handler) cfg80211_wext_giwretry, /* SIOCGIWRETRY */
145 (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */
146 (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */
147 (iw_handler) cfg80211_wext_siwpower, /* SIOCSIWPOWER */
148 (iw_handler) cfg80211_wext_giwpower, /* SIOCGIWPOWER */
149 (iw_handler) NULL, /* -- hole -- */
150 (iw_handler) NULL, /* -- hole -- */
151 (iw_handler) cfg80211_wext_siwgenie, /* SIOCSIWGENIE */
152 (iw_handler) NULL, /* SIOCGIWGENIE */
153 (iw_handler) cfg80211_wext_siwauth, /* SIOCSIWAUTH */
154 (iw_handler) cfg80211_wext_giwauth, /* SIOCGIWAUTH */
155 (iw_handler) cfg80211_wext_siwencodeext, /* SIOCSIWENCODEEXT */
156 (iw_handler) NULL, /* SIOCGIWENCODEEXT */
157 (iw_handler) NULL, /* SIOCSIWPMKSA */
158 (iw_handler) NULL, /* -- hole -- */
161 const struct iw_handler_def ieee80211_iw_handler_def =
163 .num_standard = ARRAY_SIZE(ieee80211_handler),
164 .standard = (iw_handler *) ieee80211_handler,
165 .get_wireless_stats = cfg80211_wireless_stats,