when scanning is interrupted reset state so table entries go in the station

table and not the scan table

Noticed by:	Tai-hwa Liang
This commit is contained in:
sam 2005-01-18 19:59:40 +00:00
parent e433b5d6a2
commit 780a8054ea
3 changed files with 20 additions and 6 deletions

View File

@ -569,6 +569,20 @@ ieee80211_node_compare(struct ieee80211com *ic,
return rssia - rssib;
}
/*
* Mark an ongoing scan stopped.
*/
void
ieee80211_cancel_scan(struct ieee80211com *ic)
{
IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN, "%s: end %s scan\n",
__func__,
(ic->ic_flags & IEEE80211_F_ASCAN) ? "active" : "passive");
ic->ic_flags &= ~(IEEE80211_F_SCAN | IEEE80211_F_ASCAN);
}
/*
* Complete a scan of potential channels.
*/
@ -578,15 +592,12 @@ ieee80211_end_scan(struct ieee80211com *ic)
struct ieee80211_node *ni, *nextbs, *selbs;
struct ieee80211_node_table *nt;
IEEE80211_DPRINTF(ic, IEEE80211_MSG_SCAN, "end %s scan\n",
(ic->ic_flags & IEEE80211_F_ASCAN) ? "active" : "passive");
ieee80211_cancel_scan(ic);
ieee80211_notify_scan_done(ic);
ic->ic_flags &= ~(IEEE80211_F_SCAN | IEEE80211_F_ASCAN);
nt = &ic->ic_scan;
ni = TAILQ_FIRST(&nt->nt_node);
ieee80211_notify_scan_done(ic);
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
u_int8_t maxrssi[IEEE80211_CHAN_MAX]; /* XXX off stack? */
int i, bestchan;

View File

@ -189,6 +189,7 @@ extern int ieee80211_next_scan(struct ieee80211com *);
extern void ieee80211_create_ibss(struct ieee80211com*,
struct ieee80211_channel *);
extern void ieee80211_reset_bss(struct ieee80211com *);
extern void ieee80211_cancel_scan(struct ieee80211com *);
extern void ieee80211_end_scan(struct ieee80211com *);
extern int ieee80211_ibss_merge(struct ieee80211com *,
struct ieee80211_node *);

View File

@ -889,8 +889,10 @@ ieee80211_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg
break;
}
goto reset;
case IEEE80211_S_AUTH:
case IEEE80211_S_SCAN:
ieee80211_cancel_scan(ic);
goto reset;
case IEEE80211_S_AUTH:
reset:
ic->ic_mgt_timer = 0;
IF_DRAIN(&ic->ic_mgtq);