Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2003 16:12:09 +0930
From:      Benjamin Close <cisbjc@cs.unisa.edu.au>
To:        Marcin Kot <mailingliste@broadpark.no>
Cc:        freebsd-mobile@freebsd.org
Subject:   Re: bsd-airtools and 5.1-REL
Message-ID:  <3EF94441.8070307@cs.unisa.edu.au>
In-Reply-To: <03e301c33768$ae140560$0400a8c0@orion.local>
References:  <03e301c33768$ae140560$0400a8c0@orion.local>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080909050600090402010902
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Marcin Kot wrote:

>Hi,
>
>Has anyone been able to get bsd-airtools to work in 5.1-release? Each time i
>try dstumbler it outputs this error:
>'error: unable to ioctl device socket: Input/output error'. I'm using a
>orinoco wavelan silver wireless card.
>
Hi All,
    Well found some more spare time. The attached patch gets dstumbler 
working with FreeBSD -current (and most likely 5.1R) on an Orinoco card.
If anyone has a prism based card and can test the patch works with them, 
it would be great. To apply:

    cd /usr/ports/net/bsd-airtools
    make configure
    cd work/bsd-airtools/dstumbler
    patch < bsd-airtools-dstumbler.diff
    cd ../../../
    make install

Many thanks to Warner for such easy to follow code in wicontrol.

Cheers,  
    Benjamin


--------------080909050600090402010902
Content-Type: text/plain;
 name="bsd-airtools-dstumbler.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="bsd-airtools-dstumbler.diff"

diff -ur /usr/ports/net/bsd-airtools/work/bsd-airtools/dstumbler/dstumbler.h ./dstumbler.h
--- /usr/ports/net/bsd-airtools/work/bsd-airtools/dstumbler/dstumbler.h	Wed Jun 25 16:01:18 2003
+++ ./dstumbler.h	Wed Jun 25 16:01:05 2003
@@ -48,6 +48,7 @@
 #include <sys/termios.h>
 
 #include <dev/wi/if_wavelan_ieee.h>
+#include <net/if_ieee80211.h>
 
 #ifdef __OpenBSD__
 #include <curses.h>
@@ -237,7 +238,9 @@
 #ifdef __FreeBSD__
 #define htole16(x) (x)
 #define le16toh(x) (x)
+#if __FreeBSD_version > 500112
 #define O_SYNC     O_FSYNC
+#endif
 #else
 #ifdef __OpenBSD__
 #define le16toh(x) letoh16(x)
diff -ur /usr/ports/net/bsd-airtools/work/bsd-airtools/dstumbler/wistat.c ./wistat.c
--- /usr/ports/net/bsd-airtools/work/bsd-airtools/dstumbler/wistat.c	Sat Jan 12 01:35:43 2002
+++ ./wistat.c	Wed Jun 25 16:04:27 2003
@@ -119,13 +119,12 @@
 int
 wi_parse_scan_ap(const char *iface, struct aps_s *aps, int num)
 {
-  static int scanbuf_len;
-  static u_char scanbuf[1596];
+  static int ap_count = 0;
+  static struct wi_apinfo *ap_info;
+  static struct wi_req wreq;
 
-  int i, offset;
-  struct wi_req wreq;
+  struct wi_apinfo *w;	
   struct wi_scan_p2_hdr *res_h;
-  struct wi_scan_res *res;
 
   if(nodevice || monmode || !scanmode)
     return -1;
@@ -147,41 +146,33 @@
       if(res_h->wi_reason == 0)
         return -1;
 
-      offset = 4;
     }
-    else
-      offset = 0;
-
-    memcpy((char *)scanbuf, (char *)wreq.wi_val + offset,
-     (wreq.wi_len * 2) - offset);
-    scanbuf_len = ((wreq.wi_len * 2) - offset) /
-     (prism2 ? WI_PRISM2_RES_SIZE : WI_WAVELAN_RES_SIZE);
+	ap_count = *(int *)wreq.wi_val;
+  	ap_info =  (struct wi_apinfo *)(((char *)&wreq.wi_val) + sizeof(int));
 
     setscanreq(iface);
   }
 
-  if(num >= scanbuf_len)
+  if(num >= ap_count)
     return -1;
 
-  res = (struct wi_scan_res *)((char *)scanbuf +
-   ((prism2 ? WI_PRISM2_RES_SIZE : WI_WAVELAN_RES_SIZE) * num));
-
-  strncpy(aps->ssid, res->wi_ssid, le16toh(res->wi_ssid_len));
-  aps->ssid[le16toh(res->wi_ssid_len)] = '\0';
+  w = ap_info + num;
 
-  aps->chan = le16toh(res->wi_chan);
-  aps->quality[2] = MAX(le16toh(res->wi_noise), 27);
-  aps->quality[1] = MAX(le16toh(res->wi_signal), 27);
+  strncpy(aps->ssid, w->name, le16toh(w->namelen));
+  aps->ssid[le16toh(w->namelen)] = '\0';
+  aps->chan = le16toh(w->channel);
+  aps->quality[2] = MAX(le16toh(w->noise), 27);
+  aps->quality[1] = MAX(le16toh(w->signal), 27);
   aps->quality[0] = aps->quality[1] - aps->quality[2];
 
-  memcpy(aps->bssid, res->wi_bssid, MACSIZE);
-  aps->interval = le16toh(res->wi_interval);
+  memcpy(aps->bssid, w->bssid, MACSIZE);
+  aps->interval = le16toh(w->interval);
 
-  if(le16toh(res->wi_capinfo) & WI_CAPINFO_ESS)
+  if(le16toh(w->capinfo) &  IEEE80211_CAPINFO_ESS)
     aps->adhoc = 2;
-  if(le16toh(res->wi_capinfo) & WI_CAPINFO_IBSS)
+  if(le16toh(w->capinfo) & WI_CAPINFO_IBSS)
     aps->adhoc = 1;
-  if(le16toh(res->wi_capinfo) & WI_CAPINFO_PRIV)
+  if(le16toh(w->capinfo) & IEEE80211_CAPINFO_PRIVACY)
     aps->weped = 1;
   else
     aps->weped = 2;
@@ -192,15 +183,14 @@
    */
   if(prism2)
   {
-    for(i = 0; res->wi_srates[i] != 0; i++)
-      aps->srate = MAX(aps->srate, (res->wi_srates[i] & WI_VAR_SRATES_MASK));
+      aps->srate = w->rate;
   }
 
   /*
    * if we've reached the end of the list of aps, return a 0 so it won't call
    * us for more aps.. otherwise, keep on going.
    */
-  return(num >= scanbuf_len - 1 ? 0 : 1);
+  return (num >= ap_count-1 ? 0 : 1);
 }
 
 /*
@@ -298,7 +288,7 @@
       wreq.wi_val[0] = htole16(*((int *)mem));
       break;
     case WI_RID_OWN_SSID:
-      wreq.wi_len = MIN((strlen(mem) + 1) / 2, len);
+      wreq.wi_len = 18;
       wreq.wi_val[0] = htole16(strlen(mem));
       memcpy((char *)&wreq.wi_val[1], mem, strlen(mem));
       break;
@@ -314,7 +304,7 @@
       break;
     case WI_RID_SCAN_REQ:
       wreq.wi_len = (prism2 ? 3 : 1);
-      wreq.wi_type = WI_RID_SCAN_REQ;
+      wreq.wi_type =(prism2 ? WI_RID_SCAN_REQ : WI_RID_SCAN_APS );
 
       if(prism2)
       {

--------------080909050600090402010902--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EF94441.8070307>