bsd-airtools and 5.1-REL
Benjamin Close
cisbjc at cs.unisa.edu.au
Tue Jun 24 00:50:49 PDT 2003
Cliff L. Biffle wrote:
>On Friday 20 June 2003 01:15 pm, Marcin Kot wrote:
>
>
>>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.
>>
>>
>
>The interface to the wi driver has changed. A few ioctls, etc. This is a
>result of pulling the 802.11 code out of the wi driver and into a separate
>802.11 networks layer.
>
>I and a few others on the current- list wrote preliminary patches to get
>dstumbler working, but none of us could get the full functionality. Though,
>admittedly, none of us really gave it our all.... Another fellow said he'd
>gotten the program to work completely, though his patches had no effect for
>me, etc.
>
>
That other fellow would be me.
I've been hacking around at it in my spare time and have almost got it
fully working (over looked something last time).
The attached patch gets it working and displaying ap's although they
aren't always valid.
For anyone with more spare time that me, there's a bug in
wistat.c:wi_parse_scan_ap just can't figure out where.
Those using -current can still use dstumbler without the patches just
run: dstumbler wi0 -s
although this may not be as effective as dstumbler polls the card in 'is
there an ap mode' rather than asking the card for the AP's it sees.
Cheers,
Benjamin
--
3D Research Associate / System Administrator +61 8 8302 3669
School of Computer and Information Science Room D1-07, ML Campus
University of South Australia Mawson Lakes Blvd.
Benjamin.Close at cs.unisa.edu.au South Australia, 5095
F00D C83D 5F7E 5561 DF91 B74D E602 CAA3 4842 B5B4
-------------- next part --------------
diff -ur /usr/ports/net/bsd-airtools/work/bsd-airtools/dstumbler/Makefile ./Makefile
--- /usr/ports/net/bsd-airtools/work/bsd-airtools/dstumbler/Makefile Tue Jun 24 17:14:17 2003
+++ ./Makefile Tue Jun 24 15:02:42 2003
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -Wall -I/usr/local/include
+CFLAGS = -Wall -I/usr/local/include -ggdb
TARGET = dstumbler
LDFLAGS = -L/usr/local/lib -lncurses -lpcap
PREFIX = /usr/local
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 Tue Jun 24 17:14:17 2003
+++ ./dstumbler.h Tue Jun 24 16:00:00 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 Tue Jun 24 17:12:30 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;
- int i, offset;
+ struct wi_apinfo *w;
struct wi_req wreq;
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,17 @@
*/
if(prism2)
{
- for(i = 0; res->wi_srates[i] != 0; i++)
- aps->srate = MAX(aps->srate, (res->wi_srates[i] & WI_VAR_SRATES_MASK));
+ /** FIXME
+ for(i = 0; w->rate[i] != 0; i++)
+ aps->srate = MAX(aps->srate, (w->rate[i] & WI_VAR_SRATES_MASK));
+ */
}
/*
* 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 +291,9 @@
wreq.wi_val[0] = htole16(*((int *)mem));
break;
case WI_RID_OWN_SSID:
- wreq.wi_len = MIN((strlen(mem) + 1) / 2, len);
+ // FIXME:
+ //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,13 +309,14 @@
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)
{
wreq.wi_val[0] = htole16(0x3FFF); /* set to scan all 14 channels */
wreq.wi_val[1] = htole16(0x000F); /* scan on all 4 rates */
}
+
break;
default:
break;
More information about the freebsd-mobile
mailing list