tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: IEEE80211_IOC_STA_STATS broken?
On Tue, Oct 28, 2008 at 04:10:57PM +0000, Roy Marples wrote:
> Hi List
>
> I'm having a spot of bother getting the IEEE80211_IOC_STA_STATS ioctl
> to work. For some reason it always returns Invalid Argument EINVAL.
>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <sys/ioctl.h>
>
> #include <net/if.h>
> #include <net80211/ieee80211.h>
> #include <net80211/ieee80211_ioctl.h>
>
> #include <stdio.h>
> #include <string.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <errno.h>
>
> int main(void) {
> struct ieee80211req ireq;
> char buf[24*1024];
> int s = socket(AF_INET, SOCK_DGRAM, 0);
>
> memset(&ireq, 0, sizeof(ireq));
> strlcpy(ireq.i_name, "iwi0", sizeof(ireq.i_name));
> ireq.i_type = IEEE80211_IOC_STA_STATS;
> ireq.i_data = buf;
> ireq.i_len = sizeof(buf);
> if(ioctl(s, SIOCG80211, &ireq) != 0)
> perror("SIOCG80211");
> else
> printf ("ok\n");
> return 0;
> }
>
> If someone could tell me what I'm doing wrong or it's it's a
> NetBSD-4.99.73 bug I'd appreciate it.
Apparently, i_data has to point at a STA's MAC address:
error = copyin(ireq->i_data, macaddr, IEEE80211_ADDR_LEN);
if (error != 0)
return error;
ni = ieee80211_find_node(&ic->ic_sta, macaddr);
if (ni == NULL)
return EINVAL; /* XXX */
Instead of EINVAL, it should return ENOENT, IMO.
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 278-3933 ext 24
Home |
Main Index |
Thread Index |
Old Index