summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_upgt.c
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2008-01-02 10:07:27 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2008-01-02 10:07:27 +0000
commitafd353a721cddd54ea33bb1ccfdaa4cbd752aa55 (patch)
treec38bc024d1932e6b631c5e1339511b74cc207ce2 /sys/dev/usb/if_upgt.c
parent71c3a2ccaa3c0b04fe1d2f65c18a7a7fe0a9fb2d (diff)
Make network scanning work correctly.
Diffstat (limited to 'sys/dev/usb/if_upgt.c')
-rw-r--r--sys/dev/usb/if_upgt.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/dev/usb/if_upgt.c b/sys/dev/usb/if_upgt.c
index fc0932eac7f..88c4ee76f74 100644
--- a/sys/dev/usb/if_upgt.c
+++ b/sys/dev/usb/if_upgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_upgt.c,v 1.12 2008/01/01 20:20:30 mglocker Exp $ */
+/* $OpenBSD: if_upgt.c,v 1.13 2008/01/02 10:07:26 mglocker Exp $ */
/*
* Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org>
@@ -1186,18 +1186,15 @@ upgt_init(struct ifnet *ifp)
ic->ic_bss->ni_chan = ic->ic_ibss_chan;
sc->sc_curchan = ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan);
- /* set default channel */
- upgt_set_channel(sc, sc->sc_curchan);
-
- upgt_set_macfilter(sc, IEEE80211_S_SCAN);
-
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
if (ic->ic_opmode == IEEE80211_M_MONITOR)
ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
- else
+ else {
+ upgt_set_macfilter(sc, IEEE80211_S_SCAN);
ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
+ }
return (0);
}
@@ -1208,9 +1205,6 @@ upgt_stop(struct upgt_softc *sc)
struct ieee80211com *ic = &sc->sc_ic;
struct ifnet *ifp = &ic->ic_if;
- /* do not accept any frames if the device is down */
- upgt_set_macfilter(sc, IEEE80211_S_INIT);
-
/* device down */
ifp->if_timer = 0;
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
@@ -1270,6 +1264,9 @@ upgt_newstate_task(void *arg)
case IEEE80211_S_INIT:
DPRINTF(1, "%s: newstate is IEEE80211_S_INIT\n",
sc->sc_dev.dv_xname);
+
+ /* do not accept any frames if the device is down */
+ upgt_set_macfilter(sc, IEEE80211_S_INIT);
break;
case IEEE80211_S_SCAN:
DPRINTF(1, "%s: newstate is IEEE80211_S_SCAN\n",
@@ -1277,7 +1274,6 @@ upgt_newstate_task(void *arg)
channel = ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan);
upgt_set_channel(sc, channel);
-
timeout_add(&sc->scan_to, hz / 5);
break;
case IEEE80211_S_AUTH: