Changeset View
Changeset View
Standalone View
Standalone View
sys/net80211/ieee80211_scan_sta.c
Show First 20 Lines • Show All 1,700 Lines • ▼ Show 20 Lines | static const struct ieee80211_scanner adhoc_default = { | ||||
.scan_age = adhoc_age, | .scan_age = adhoc_age, | ||||
.scan_iterate = sta_iterate, | .scan_iterate = sta_iterate, | ||||
.scan_assoc_fail = sta_assoc_fail, | .scan_assoc_fail = sta_assoc_fail, | ||||
.scan_assoc_success = sta_assoc_success, | .scan_assoc_success = sta_assoc_success, | ||||
}; | }; | ||||
IEEE80211_SCANNER_ALG(ibss, IEEE80211_M_IBSS, adhoc_default); | IEEE80211_SCANNER_ALG(ibss, IEEE80211_M_IBSS, adhoc_default); | ||||
IEEE80211_SCANNER_ALG(ahdemo, IEEE80211_M_AHDEMO, adhoc_default); | IEEE80211_SCANNER_ALG(ahdemo, IEEE80211_M_AHDEMO, adhoc_default); | ||||
static void | |||||
ap_force_promisc(struct ieee80211com *ic) | |||||
{ | |||||
struct ifnet *ifp = ic->ic_ifp; | |||||
IEEE80211_LOCK(ic); | |||||
/* set interface into promiscuous mode */ | |||||
ifp->if_flags |= IFF_PROMISC; | |||||
ieee80211_runtask(ic, &ic->ic_promisc_task); | |||||
IEEE80211_UNLOCK(ic); | |||||
} | |||||
static void | |||||
ap_reset_promisc(struct ieee80211com *ic) | |||||
{ | |||||
IEEE80211_LOCK(ic); | |||||
ieee80211_syncifflag_locked(ic, IFF_PROMISC); | |||||
IEEE80211_UNLOCK(ic); | |||||
} | |||||
static int | static int | ||||
ap_start(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) | ap_start(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) | ||||
{ | { | ||||
struct sta_table *st = ss->ss_priv; | struct sta_table *st = ss->ss_priv; | ||||
makescanlist(ss, vap, staScanTable); | makescanlist(ss, vap, staScanTable); | ||||
if (ss->ss_mindwell == 0) | if (ss->ss_mindwell == 0) | ||||
ss->ss_mindwell = msecs_to_ticks(200); /* 200ms */ | ss->ss_mindwell = msecs_to_ticks(200); /* 200ms */ | ||||
if (ss->ss_maxdwell == 0) | if (ss->ss_maxdwell == 0) | ||||
ss->ss_maxdwell = msecs_to_ticks(200); /* 200ms */ | ss->ss_maxdwell = msecs_to_ticks(200); /* 200ms */ | ||||
st->st_scangen++; | st->st_scangen++; | ||||
st->st_newscan = 1; | st->st_newscan = 1; | ||||
ap_force_promisc(vap->iv_ic); | ieee80211_promisc(vap, true); | ||||
return 0; | return 0; | ||||
} | } | ||||
/* | /* | ||||
* Cancel an ongoing scan. | * Cancel an ongoing scan. | ||||
*/ | */ | ||||
static int | static int | ||||
ap_cancel(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) | ap_cancel(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) | ||||
{ | { | ||||
ap_reset_promisc(vap->iv_ic); | ieee80211_promisc(vap, false); | ||||
return 0; | return 0; | ||||
} | } | ||||
/* | /* | ||||
* Pick a quiet channel to use for ap operation. | * Pick a quiet channel to use for ap operation. | ||||
*/ | */ | ||||
static struct ieee80211_channel * | static struct ieee80211_channel * | ||||
ap_pick_channel(struct ieee80211_scan_state *ss, int flags) | ap_pick_channel(struct ieee80211_scan_state *ss, int flags) | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | ap_end(struct ieee80211_scan_state *ss, struct ieee80211vap *vap) | ||||
if (IEEE80211_IS_CHAN_TURBO(bestchan)) { | if (IEEE80211_IS_CHAN_TURBO(bestchan)) { | ||||
bestchan = ieee80211_find_channel(ic, bestchan->ic_freq, | bestchan = ieee80211_find_channel(ic, bestchan->ic_freq, | ||||
bestchan->ic_flags & ~IEEE80211_CHAN_TURBO); | bestchan->ic_flags & ~IEEE80211_CHAN_TURBO); | ||||
if (bestchan == NULL) { | if (bestchan == NULL) { | ||||
/* should never happen ?? */ | /* should never happen ?? */ | ||||
return 0; | return 0; | ||||
} | } | ||||
} | } | ||||
ap_reset_promisc(ic); | ieee80211_promisc(vap, false); | ||||
if (ss->ss_flags & (IEEE80211_SCAN_NOPICK | IEEE80211_SCAN_NOJOIN)) { | if (ss->ss_flags & (IEEE80211_SCAN_NOPICK | IEEE80211_SCAN_NOJOIN)) { | ||||
/* | /* | ||||
* Manual/background scan, don't select+join the | * Manual/background scan, don't select+join the | ||||
* bss, just return. The scanning framework will | * bss, just return. The scanning framework will | ||||
* handle notification that this has completed. | * handle notification that this has completed. | ||||
*/ | */ | ||||
ss->ss_flags &= ~IEEE80211_SCAN_NOPICK; | ss->ss_flags &= ~IEEE80211_SCAN_NOPICK; | ||||
return 1; | return 1; | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |