Subject: Re: wireless scanning doesn't work
To: None <current-users@NetBSD.org>
From: Masashi Honma <honma@ictec.co.jp>
List: current-users
Date: 07/06/2004 09:36:34
>>I am prism3 user. I used ieee80211_ioctl.c with WI_RID_SCAN_REQ. But no
>> scan result came. When I use WI_RID_SCAN_APS, I could get scan result
from a non WPA AP. But WI_RID_SCAN_REQ doesn't return result from same AP.

>What commands do you run to scan the APs with the different RIDs?

Thank you for replying.

I wrote code below for sanning.

struct ifreq ifr;
struct wi_req wreq;
int s, ret = 0;

if (ssid)
return -1;

s = socket(PF_INET, SOCK_DGRAM, 0);
if (s < 0) {
perror("socket[PF_INET,SOCK_DGRAM]");
return -1;
}

memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);

memset(&wreq, 0, sizeof(wreq));
//wreq.wi_type = WI_RID_SCAN_APS;
wreq.wi_type = WI_RID_SCAN_REQ;
wreq.wi_len = 4;
wreq.wi_val[0] = htole16(0x3fff);
wreq.wi_val[1] = htole16(0xf);

ifr.ifr_data = (caddr_t)&wreq;

if (ioctl(s, SIOCSIFGENERIC, &ifr) == -1) {
perror("ioctl[SIOCSIFGENERIC,WI_RID_SCAN_APS]");
ret = -1;
}

close(s);
return ret;

And I use WI_RID_READ_APS to get scan result like below.

wreq.wi_type = WI_RID_READ_APS;
wreq.wi_len = WI_MAX_DATALEN;

ifr.ifr_data = (caddr_t)&wreq;

while (ioctl(s, SIOCGIFGENERIC, &ifr) == -1) {
}

When I use WI_RID_SCAN_APS , I could get scan result. After that, I
ejected the card and re-inserted it in order to clear the scan result.
And I used WI_RID_SCAN_REQ , the ioctl to get the scan result was
returned normally but no AP information in there.

My port is i386.

Thank you.

Masashi Honma