fix up hostapd for mac80211
[openwrt.git] / package / mac80211 / patches / 009-add-old-ioctl-skeleton.patch
1 ---
2 net/mac80211/ieee80211.c | 5 +
3 net/mac80211/ieee80211_ioctl.c | 121 +++++++++++++++++++++++++++++++++++++++++
4 2 files changed, 126 insertions(+)
5
6 --- everything.orig/net/mac80211/ieee80211_ioctl.c 2007-11-07 13:06:34.902124618 +0100
7 +++ everything/net/mac80211/ieee80211_ioctl.c 2007-11-07 13:19:24.311521482 +0100
8 @@ -21,6 +21,7 @@
9
10 #include <net/mac80211.h>
11 #include "ieee80211_i.h"
12 +#include "hostapd_ioctl.h"
13 #include "ieee80211_rate.h"
14 #include "wpa.h"
15 #include "aes_ccm.h"
16 @@ -124,6 +125,47 @@ static int ieee80211_ioctl_siwgenie(stru
17 return -EOPNOTSUPP;
18 }
19
20 +
21 +static int ieee80211_ioctl_priv_hostapd(struct net_device *dev,
22 + struct iw_point *p)
23 +{
24 + struct prism2_hostapd_param *param;
25 + int ret = 0;
26 +
27 + if (p->length < sizeof(struct prism2_hostapd_param) ||
28 + p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer) {
29 + printk(KERN_DEBUG "%s: hostapd ioctl: ptr=%p len=%d min=%d "
30 + "max=%d\n", dev->name, p->pointer, p->length,
31 + (int)sizeof(struct prism2_hostapd_param),
32 + PRISM2_HOSTAPD_MAX_BUF_SIZE);
33 + return -EINVAL;
34 + }
35 +
36 + param = kmalloc(p->length, GFP_KERNEL);
37 + if (!param)
38 + return -ENOMEM;
39 +
40 + if (copy_from_user(param, p->pointer, p->length)) {
41 + ret = -EFAULT;
42 + goto out;
43 + }
44 +
45 + switch (param->cmd) {
46 + default:
47 + ret = -EOPNOTSUPP;
48 + break;
49 + }
50 +
51 + if (copy_to_user(p->pointer, param, p->length))
52 + ret = -EFAULT;
53 +
54 + out:
55 + kfree(param);
56 +
57 + return ret;
58 +}
59 +
60 +
61 static int ieee80211_ioctl_giwname(struct net_device *dev,
62 struct iw_request_info *info,
63 char *name, char *extra)
64 @@ -819,6 +861,49 @@ static int ieee80211_ioctl_giwretry(stru
65 return 0;
66 }
67
68 +static int ieee80211_ioctl_prism2_param(struct net_device *dev,
69 + struct iw_request_info *info,
70 + void *wrqu, char *extra)
71 +{
72 + struct ieee80211_sub_if_data *sdata;
73 + int *i = (int *) extra;
74 + int param = *i;
75 + int ret = 0;
76 +
77 + if (!capable(CAP_NET_ADMIN))
78 + return -EPERM;
79 +
80 + sdata = IEEE80211_DEV_TO_SUB_IF(dev);
81 +
82 + switch (param) {
83 + default:
84 + ret = -EOPNOTSUPP;
85 + break;
86 + }
87 +
88 + return ret;
89 +}
90 +
91 +
92 +static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
93 + struct iw_request_info *info,
94 + void *wrqu, char *extra)
95 +{
96 + struct ieee80211_sub_if_data *sdata;
97 + int *param = (int *) extra;
98 + int ret = 0;
99 +
100 + sdata = IEEE80211_DEV_TO_SUB_IF(dev);
101 +
102 + switch (*param) {
103 + default:
104 + ret = -EOPNOTSUPP;
105 + break;
106 + }
107 +
108 + return ret;
109 +}
110 +
111 static int ieee80211_ioctl_siwmlme(struct net_device *dev,
112 struct iw_request_info *info,
113 struct iw_point *data, char *extra)
114 @@ -1073,6 +1158,32 @@ static int ieee80211_ioctl_siwencodeext(
115 }
116
117
118 +static const struct iw_priv_args ieee80211_ioctl_priv[] = {
119 + { PRISM2_IOCTL_PRISM2_PARAM,
120 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "param" },
121 + { PRISM2_IOCTL_GET_PRISM2_PARAM,
122 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
123 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_param" },
124 +};
125 +
126 +
127 +int ieee80211_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
128 +{
129 + struct iwreq *wrq = (struct iwreq *) rq;
130 +
131 + switch (cmd) {
132 + /* Private ioctls (iwpriv) that have not yet been converted
133 + * into new wireless extensions API */
134 + case PRISM2_IOCTL_HOSTAPD:
135 + if (!capable(CAP_NET_ADMIN))
136 + return -EPERM;
137 + return ieee80211_ioctl_priv_hostapd(dev, &wrq->u.data);
138 + default:
139 + return -EOPNOTSUPP;
140 + }
141 +}
142 +
143 +
144 /* Structures to export the Wireless Handlers */
145
146 static const iw_handler ieee80211_handler[] =
147 @@ -1135,9 +1246,19 @@ static const iw_handler ieee80211_handle
148 (iw_handler) NULL, /* -- hole -- */
149 };
150
151 +static const iw_handler ieee80211_private_handler[] =
152 +{ /* SIOCIWFIRSTPRIV + */
153 + (iw_handler) ieee80211_ioctl_prism2_param, /* 0 */
154 + (iw_handler) ieee80211_ioctl_get_prism2_param, /* 1 */
155 +};
156 +
157 const struct iw_handler_def ieee80211_iw_handler_def =
158 {
159 .num_standard = ARRAY_SIZE(ieee80211_handler),
160 + .num_private = ARRAY_SIZE(ieee80211_private_handler),
161 + .num_private_args = ARRAY_SIZE(ieee80211_ioctl_priv),
162 .standard = (iw_handler *) ieee80211_handler,
163 + .private = (iw_handler *) ieee80211_private_handler,
164 + .private_args = (struct iw_priv_args *) ieee80211_ioctl_priv,
165 .get_wireless_stats = ieee80211_get_wireless_stats,
166 };
167 --- everything.orig/net/mac80211/ieee80211.c 2007-11-07 13:18:36.001511500 +0100
168 +++ everything/net/mac80211/ieee80211.c 2007-11-07 13:19:24.311521482 +0100
169 @@ -413,6 +413,9 @@ static const struct header_ops ieee80211
170 .cache_update = eth_header_cache_update,
171 };
172
173 +/* HACK */
174 +extern int ieee80211_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
175 +
176 /* Must not be called for mdev */
177 void ieee80211_if_setup(struct net_device *dev)
178 {
179 @@ -425,6 +428,8 @@ void ieee80211_if_setup(struct net_devic
180 dev->open = ieee80211_open;
181 dev->stop = ieee80211_stop;
182 dev->destructor = ieee80211_if_free;
183 +
184 + dev->do_ioctl = ieee80211_ioctl;
185 }
186
187 /* WDS specialties */
This page took 0.056005 seconds and 5 git commands to generate.