diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-11-29 12:51:30 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-11-29 12:51:30 +0000 |
commit | cb28cd29dabf0c91090f3a8297b8ce130189f2f5 (patch) | |
tree | 30537b44e199f11c500d76998e29f0a2b64d0111 | |
parent | 98c4330df10a3ea21f170a57ea3944d8ea99cc53 (diff) |
Enable monitor mode.
ok claudio@
-rw-r--r-- | share/man/man4/malo.4 | 26 | ||||
-rw-r--r-- | sys/dev/ic/malo.c | 22 |
2 files changed, 31 insertions, 17 deletions
diff --git a/share/man/man4/malo.4 b/share/man/man4/malo.4 index f8e169d19ee..e1a33f6101a 100644 --- a/share/man/man4/malo.4 +++ b/share/man/man4/malo.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: malo.4,v 1.11 2006/11/27 22:32:15 jmc Exp $ +.\" $OpenBSD: malo.4,v 1.12 2006/11/29 12:51:29 mglocker Exp $ .\" .\" Copyright (c) 2006 Theo de Raadt. .\" @@ -64,12 +64,12 @@ This mode is the default. .\" .It Host AP .\" In this mode the driver acts as an access point (base station) .\" for other cards. -.\" .It monitor mode -.\" In this mode the driver is able to receive packets without -.\" associating with an access point. -.\" This disables the internal receive filter and enables the card to -.\" capture packets from networks which it wouldn't normally have access to, -.\" or to scan for access points. +.It monitor mode +In this mode the driver is able to receive packets without +associating with an access point. +This disables the internal receive filter and enables the card to +capture packets from networks which it wouldn't normally have access to, +or to scan for access points. .El .Pp .Nm @@ -146,12 +146,12 @@ The driver supports the following media options: .Pp .Bl -tag -width monitor -compact -.It Cm hostap -Select Host AP operation. -.It Cm ibss -Select IBSS operation. -.\".It Cm monitor -.\"Select monitor mode. +.\".It Cm hostap +.\"Select Host AP operation. +.\".It Cm ibss +.\"Select IBSS operation. +.It Cm monitor +Select monitor mode. .El .It Fl mediaopt Ar opts Disable the specified media options on the driver and return it to the 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); } |