summaryrefslogtreecommitdiff
path: root/sys/dev/ic/malo.c
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2006-11-29 12:51:30 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2006-11-29 12:51:30 +0000
commitcb28cd29dabf0c91090f3a8297b8ce130189f2f5 (patch)
tree30537b44e199f11c500d76998e29f0a2b64d0111 /sys/dev/ic/malo.c
parent98c4330df10a3ea21f170a57ea3944d8ea99cc53 (diff)
Enable monitor mode.
ok claudio@
Diffstat (limited to 'sys/dev/ic/malo.c')
-rw-r--r--sys/dev/ic/malo.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c
index 3734f8a54e9..92e78c37ba0 100644
--- a/sys/dev/ic/malo.c
+++ b/sys/dev/ic/malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malo.c,v 1.43 2006/11/28 09:55:57 mglocker Exp $ */
+/* $OpenBSD: malo.c,v 1.44 2006/11/29 12:51:29 mglocker Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -382,7 +382,10 @@ malo_attach(struct malo_softc *sc)
}
/* set the rest */
- ic->ic_caps = IEEE80211_C_IBSS | IEEE80211_C_WEP;
+ ic->ic_caps =
+ IEEE80211_C_IBSS |
+ IEEE80211_C_MONITOR |
+ IEEE80211_C_WEP;
ic->ic_opmode = IEEE80211_M_STA;
ic->ic_state = IEEE80211_S_INIT;
ic->ic_max_rssi = 75;
@@ -863,6 +866,7 @@ malo_init(struct ifnet *ifp)
{
struct malo_softc *sc = ifp->if_softc;
struct ieee80211com *ic = &sc->sc_ic;
+ uint8_t chan;
int error;
DPRINTF(("%s: %s\n", ifp->if_xname, __func__));
@@ -898,8 +902,14 @@ malo_init(struct ifnet *ifp)
/* select default channel */
ic->ic_bss->ni_chan = ic->ic_ibss_chan;
+ chan = ieee80211_chan2ieee(ic, ic->ic_bss->ni_chan);
/* initialize hardware */
+ if ((error = malo_cmd_set_channel(sc, chan))) {
+ printf("%s: setting channel failed!\n",
+ sc->sc_dev.dv_xname);
+ return (error);
+ }
if ((error = malo_cmd_set_antenna(sc, 1))) {
printf("%s: setting RX antenna failed!\n",
sc->sc_dev.dv_xname);
@@ -938,8 +948,12 @@ malo_init(struct ifnet *ifp)
ifp->if_flags |= IFF_RUNNING;
- /* start background scanning */
- ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
+ if (ic->ic_opmode != IEEE80211_M_MONITOR)
+ /* start background scanning */
+ ieee80211_new_state(ic, IEEE80211_S_SCAN, -1);
+ else
+ /* in monitor mode change directly into run state */
+ ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
return (0);
}