Hello folks,

the wireless tools for GNU Mach use the `device_get_status' function
of ethernet devices to access the ioctl (read) routines of the
underlying wireless driver.

When writing the glue code I obviously got something wrong,
especially reading from STATUS in the device_get_status function is
not a good idea.  This didn't hurt much so far, since it affects
only those ioctls, that require a `struct iw_point' argument (mainly
get-essid, get-nickname and get-range).  

On the whole it probably was just by accident that iwconfig works.

  - % -

2006-09-24  Stefan Siegl  <[EMAIL PROTECTED]>

        * linux/dev/glue/net.c (device_get_status): Reworked to not read
        from STATUS.  Fill `struct iw_point' correctly if necessary.

  - % -

Patch should be attached.

Okay to apply?

cheers,
  stesie

PS: With the patch, the `iwlist' command from the wireless-tools[1]
should work. However scanning unfortunately still does not work,
since the wireless extensions in the GNU Mach kernel are way too old
(version 13 is required, we've got version 10 so far)

[1] http://cvs.brokenpipe.de/cgi-bin/viewcvs.cgi/wireless-tools-gnumach/

-- 
StefanSiegl <[EMAIL PROTECTED]>
Index: linux/dev/glue/net.c
===================================================================
RCS file: /cvsroot/hurd/gnumach/linux/dev/glue/Attic/net.c,v
retrieving revision 1.1.4.2
diff -u -p -r1.1.4.2 net.c
--- linux/dev/glue/net.c        26 Jul 2006 23:15:13 -0000      1.1.4.2
+++ linux/dev/glue/net.c        24 Sep 2006 17:33:07 -0000
@@ -543,24 +543,25 @@ device_get_status (void *d, dev_flavor_t
 
       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;
-
-         /* 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);
+         iwp->length = *count * sizeof (dev_status_t) - sizeof (struct ifreq);
+         iwp->pointer = (void *) status + sizeof (struct ifreq);
 
          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
        {
_______________________________________________
Bug-hurd mailing list
Bug-hurd@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-hurd

Reply via email to