From 8157976a26887b369d552c0a7a3a52539f77320b Mon Sep 17 00:00:00 2001 From: Tai-hwa Liang Date: Tue, 30 Aug 2005 14:27:47 +0000 Subject: [PATCH] Properly set ic_curchan before calling back to device driver to do channel switching(ifconfig devX channel Y). This fix should make channel changing works again in monitor mode. Submitted by: sam X-MFC-With: other ic_curchan changes --- sys/net80211/ieee80211_ioctl.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 9d5a28579fcf..00f8a761a796 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -2090,8 +2090,18 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re error = ENETRESET; break; } - if (error == ENETRESET && ic->ic_opmode == IEEE80211_M_MONITOR) - error = IS_UP(ic) ? ic->ic_reset(ic->ic_ifp) : 0; + if (error == ENETRESET && + ic->ic_opmode == IEEE80211_M_MONITOR) { + if (IS_UP(ic)) { + /* + * Monitor mode can switch directly. + */ + if (ic->ic_des_chan != IEEE80211_CHAN_ANYC) + ic->ic_curchan = ic->ic_des_chan; + error = ic->ic_reset(ic->ic_ifp); + } else + error = 0; + } break; case IEEE80211_IOC_POWERSAVE: switch (ireq->i_val) {