summaryrefslogtreecommitdiff
path: root/linux/dev/glue/net.c
diff options
context:
space:
mode:
authorStefan Siegl <stesie@brokenpipe.de>2006-09-25 20:46:00 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:41 +0200
commitbc8b1b75dd55f6e3912f79609a22c2555df49745 (patch)
tree55efff7e727542fc1d36fa2706baa42f770fcb2b /linux/dev/glue/net.c
parent5678a225a2e8def88ea78ae766a0c4b8f1ce05b8 (diff)
2006-09-25 Stefan Siegl <stesie@brokenpipe.de>
* linux/dev/glue/net.c (device_get_status): Reworked to not read from STATUS. Fill `struct iw_point' correctly if necessary.
Diffstat (limited to 'linux/dev/glue/net.c')
-rw-r--r--linux/dev/glue/net.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/linux/dev/glue/net.c b/linux/dev/glue/net.c
index f0bd650..9f154b7 100644
--- a/linux/dev/glue/net.c
+++ b/linux/dev/glue/net.c
@@ -543,24 +543,26 @@ device_get_status (void *d, dev_flavor_t flavor, dev_status_t status,
int result;
- if((flavor == SIOCGIWRANGE || flavor == SIOCGIWENCODE
+ if (flavor == SIOCGIWRANGE || flavor == SIOCGIWENCODE
|| flavor == SIOCGIWESSID || flavor == SIOCGIWNICKN
|| flavor == SIOCGIWSPY)
- && ((struct iwreq *) status)->u.data.pointer)
{
+ /*
+ * These ioctls require an `iw_point' as their argument (i.e.
+ * they want to return some data to userspace.
+ * Therefore supply some sane values and carry the data back
+ * to userspace right behind the `struct iwreq'.
+ */
struct iw_point *iwp = &((struct iwreq *) status)->u.data;
+ iwp->length = *count * sizeof (dev_status_t) - sizeof (struct ifreq);
+ iwp->pointer = (void *) status + sizeof (struct ifreq);
- /* safety check whether the status array is long enough ... */
- if(*count * sizeof(int) < sizeof(struct ifreq) + iwp->length)
- return D_INVALID_OPERATION;
-
- /* make sure, iwp->pointer points to the correct address */
- iwp->pointer = (void *) status + sizeof(struct ifreq);
+ result = dev->do_ioctl (dev, (struct ifreq *) status, flavor);
- result = dev->do_ioctl(dev, (struct ifreq *) status, flavor);
- /* *count = (sizeof(struct ifreq) + iwp->length) / sizeof(int);
- * if(iwp->length % sizeof(int)) *count ++;
- */
+ *count = ((sizeof (struct ifreq) + iwp->length)
+ / sizeof (dev_status_t));
+ if (iwp->length % sizeof (dev_status_t))
+ (*count) ++;
}
else
{