10 #include <linux/slab.h>
11 #include <linux/wireless.h>
12 #include <linux/netdevice.h>
22 if ((dev->wireless_handlers->num_private_args == 0) ||
23 (dev->wireless_handlers->private_args ==
NULL))
27 if (wrqu->
data.length < dev->wireless_handlers->num_private_args) {
31 wrqu->
data.length = dev->wireless_handlers->num_private_args;
36 wrqu->
data.length = dev->wireless_handlers->num_private_args;
39 memcpy(extra, dev->wireless_handlers->private_args,
46 static const char iw_priv_type_size[] = {
57 static int get_priv_size(
__u16 args)
62 return num * iw_priv_type_size[
type];
75 return num * iw_priv_type_size[
type];
100 for (i = 0; i < dev->wireless_handlers->num_private_args; i++) {
101 if (cmd == dev->wireless_handlers->private_args[i].cmd) {
102 descr = &dev->wireless_handlers->private_args[
i];
112 if (descr->
name[0] ==
'\0')
114 offset =
sizeof(
__u32);
117 extra_size = get_priv_size(descr->
set_args);
121 ((extra_size + offset) <=
IFNAMSIZ))
125 extra_size = get_priv_size(descr->
get_args);
137 static int ioctl_private_iw_point(
struct iw_point *iwp,
unsigned int cmd,
168 err = handler(dev, info, (
union iwreq_data *) iwp, extra);
176 extra_size = adjust_priv_size(descr->
get_args, iwp);
194 extra_size = get_priv_descr_and_size(dev, cmd, &descr);
197 if (extra_size == 0) {
199 ret = handler(dev, info, &(iwr->
u), (
char *) &(iwr->
u));
201 ret = ioctl_private_iw_point(&iwr->
u.
data, cmd, descr,
202 handler, dev, info, extra_size);
220 extra_size = get_priv_descr_and_size(dev, cmd, &descr);
223 if (extra_size == 0) {
225 ret = handler(dev, info, &(iwr->
u), (
char *) &(iwr->
u));
227 struct compat_iw_point *iwp_compat;
230 iwp_compat = (
struct compat_iw_point *) &iwr->
u.
data;
231 iwp.
pointer = compat_ptr(iwp_compat->pointer);
232 iwp.
length = iwp_compat->length;
233 iwp.
flags = iwp_compat->flags;
235 ret = ioctl_private_iw_point(&iwp, cmd, descr,
236 handler, dev, info, extra_size);
238 iwp_compat->pointer = ptr_to_compat(iwp.
pointer);
239 iwp_compat->length = iwp.
length;
240 iwp_compat->flags = iwp.
flags;