Date: Sat, 13 Nov 2004 01:24:38 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 64988 for review Message-ID: <200411130124.iAD1Oc9o052289@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=64988 Change 64988 by sam@sam_ebb on 2004/11/13 01:23:52 fill in some more ioctls Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#14 edit .. //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#7 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.c#14 (text+ko) ==== @@ -866,14 +866,13 @@ } static int -ieee80211_ioctl_getchanlist(struct ieee80211com *ic, struct ieee80211req *ireq) +ieee80211_ioctl_getchaninfo(struct ieee80211com *ic, struct ieee80211req *ireq) { - struct ieee80211req_chanlist chans; - int i, j; + struct ieee80211req_chaninfo chans; /* XXX off stack? */ + int i, space; if (ireq->i_len != sizeof(chans)) return EINVAL; - memset(&chans, 0, sizeof(chans)); /* * Since channel 0 is not available for DS, channel 1 * is assigned to LSB on WaveLAN. @@ -882,10 +881,19 @@ i = 1; else i = 0; - for (j = 0; i <= IEEE80211_CHAN_MAX; i++, j++) - if (isset(ic->ic_chan_active, i)) - setbit(chans.ic_channels, j); - return copyout(&chans, ireq->i_data, sizeof(chans)); + memset(&chans, 0, sizeof(chans)); + for (; i <= IEEE80211_CHAN_MAX; i++) + if (isset(ic->ic_chan_active, i)) { + struct ieee80211_channel *c = &ic->ic_channels[i]; + chans.ic_chans[chans.ic_nchans].ic_freq = c->ic_freq; + chans.ic_chans[chans.ic_nchans].ic_flags = c->ic_flags; + chans.ic_nchans++; + } + space = __offsetof(struct ieee80211req_chaninfo, + ic_chans[chans.ic_nchans]); + if (space > ireq->i_len) + space = ireq->i_len; + return copyout(&chans, ireq->i_data, space); } static int @@ -1245,7 +1253,8 @@ ireq->i_val = (ic->ic_flags & IEEE80211_F_COUNTERM) != 0; break; case IEEE80211_IOC_DRIVER_CAPS: - ireq->i_val = ic->ic_caps; + ireq->i_val = ic->ic_caps>>16; + ireq->i_len = ic->ic_caps&0xffff; break; case IEEE80211_IOC_WME: ireq->i_val = (ic->ic_flags & IEEE80211_F_WME) != 0; @@ -1267,8 +1276,8 @@ case IEEE80211_IOC_WPAKEY: error = ieee80211_ioctl_getkey(ic, ireq); break; - case IEEE80211_IOC_CHANLIST: - error = ieee80211_ioctl_getchanlist(ic, ireq); + case IEEE80211_IOC_CHANINFO: + error = ieee80211_ioctl_getchaninfo(ic, ireq); break; case IEEE80211_IOC_BSSID: if (ireq->i_len != IEEE80211_ADDR_LEN) @@ -1929,7 +1938,9 @@ rsn->rsn_ucastkeylen = ireq->i_val; break; case IEEE80211_IOC_DRIVER_CAPS: - ic->ic_caps = ireq->i_val; /* NB: for testing */ + /* NB: for testing */ + ic->ic_caps = (((u_int16_t) ireq->i_val) << 16) | + ((u_int16_t) ireq->i_len); break; case IEEE80211_IOC_KEYMGTALGS: /* XXX check */ ==== //depot/projects/wifi/sys/net80211/ieee80211_ioctl.h#7 (text+ko) ==== @@ -247,6 +247,17 @@ }; /* + * Get the active channel list info. + */ +struct ieee80211req_chaninfo { + u_int ic_nchans; + struct ieee80211_chaninfo { + u_int16_t ic_freq; /* setting in Mhz */ + u_int16_t ic_flags; /* see below */ + } ic_chans[256]; +}; + +/* * Retrieve the WPA/RSN information element for an associated station. */ struct ieee80211req_wpaie { @@ -377,7 +388,8 @@ #define IEEE80211_IOC_WPAIE 39 /* WPA information element */ #define IEEE80211_IOC_STA_STATS 40 /* per-station statistics */ #define IEEE80211_IOC_MACCMD 41 /* MAC ACL operation */ -/* 42-44 available */ +#define IEEE80211_IOC_CHANINFO 42 /* channel info list */ +/* 43-44 available */ #define IEEE80211_IOC_STA_INFO 45 /* station/neighbor info */ #ifndef IEEE80211_CHAN_ANY
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411130124.iAD1Oc9o052289>