Fixing invalid channel display in ifconfig(8) by implementing required

ioctl().

Note that other information provided by ifconfig(8) such like "list chan"
or "list ap" are still not available at this moment.

Before an(4) is connected to wlan(4), users are encouraged to use
ancontrol(8) to retrieve aforementioned information.

Reported by:	dhw (http://lists.freebsd.org/pipermail/freebsd-current/2007-July/074848.html)
Reviewed by:	ambrisko
Tested by:	dhw
Approved by:	re (bmah)
This commit is contained in:
Tai-hwa Liang 2007-09-10 12:53:34 +00:00
parent 2de1fa86d7
commit 73474451b9

View File

@ -1862,6 +1862,7 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
struct ifreq *ifr;
struct thread *td = curthread;
struct ieee80211req *ireq;
struct ieee80211_channel ch;
u_int8_t tmpstr[IEEE80211_NWID_LEN*2];
u_int8_t *tmpptr;
struct an_ltv_genconfig *config;
@ -2217,6 +2218,22 @@ an_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
ireq->i_val = status->an_cur_channel;
break;
case IEEE80211_IOC_CURCHAN:
sc->areq.an_type = AN_RID_STATUS;
if (an_read_record(sc,
(struct an_ltv_gen *)&sc->areq)) {
error = EINVAL;
break;
}
bzero(&ch, sizeof(ch));
ch.ic_freq = ieee80211_ieee2mhz(status->an_cur_channel,
IEEE80211_CHAN_B);
ch.ic_flags = IEEE80211_CHAN_B;
ch.ic_ieee = status->an_cur_channel;
AN_UNLOCK(sc);
error = copyout(&ch, ireq->i_data, sizeof(ch));
AN_LOCK(sc);
break;
case IEEE80211_IOC_POWERSAVE:
sc->areq.an_type = AN_RID_ACTUALCFG;
if (an_read_record(sc,