summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2009-07-24 15:27:02 +0000
committersam <sam@FreeBSD.org>2009-07-24 15:27:02 +0000
commita2c9681cf878772efbd3941201d86baf5de4b44c (patch)
tree304e7d17386ce111bef086bf644710432bac8d5a /sys/net80211
parentd364fa589df46ba79958706a8f6af37dac09662d (diff)
downloadFreeBSD-src-a2c9681cf878772efbd3941201d86baf5de4b44c.zip
FreeBSD-src-a2c9681cf878772efbd3941201d86baf5de4b44c.tar.gz
monitor mode vaps are meant to be read-only so they can operate on any
frequency w/o regulatory issues, do this by hooking if_transmit and if_output with routines that discard all transmits Reviewed by: thompsa, cbzimmer (intent) Approved by: re (kensmith)
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 1cc4964..fadd210 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -224,12 +224,19 @@ null_update_promisc(struct ifnet *ifp)
}
static int
+null_transmit(struct ifnet *ifp, struct mbuf *m)
+{
+ m_freem(m);
+ ifp->if_oerrors++;
+ return EACCES; /* XXX EIO/EPERM? */
+}
+
+static int
null_output(struct ifnet *ifp, struct mbuf *m,
struct sockaddr *dst, struct route *ro)
{
if_printf(ifp, "discard raw packet\n");
- m_freem(m);
- return EIO;
+ return null_transmit(ifp, m);
}
static void
@@ -515,9 +522,15 @@ ieee80211_vap_attach(struct ieee80211vap *vap,
ifp->if_baudrate = IF_Mbps(maxrate);
ether_ifattach(ifp, vap->iv_myaddr);
- /* hook output method setup by ether_ifattach */
- vap->iv_output = ifp->if_output;
- ifp->if_output = ieee80211_output;
+ if (vap->iv_opmode == IEEE80211_M_MONITOR) {
+ /* NB: disallow transmit */
+ ifp->if_transmit = null_transmit;
+ ifp->if_output = null_output;
+ } else {
+ /* hook output method setup by ether_ifattach */
+ vap->iv_output = ifp->if_output;
+ ifp->if_output = ieee80211_output;
+ }
/* NB: if_mtu set by ether_ifattach to ETHERMTU */
IEEE80211_LOCK(ic);
OpenPOWER on IntegriCloud