Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2013 20:27:55 -0400
From:      Patrick Kelsey <kelsey@ieee.org>
To:        freebsd-net@freebsd.org
Subject:   [ieee80211] [patch] BPF taps not working for ieee80211 interfaces in monitor mode
Message-ID:  <CAD44qMVeT_FJP26NSt5uXRdqzyWvZvYNOMpybnAG5u9YunqVQw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi,

A bug was introduced in r254082 that results in BPF taps never being
enabled for ieee80211 interfaces that are in monitor mode.

Before r254082, bpf_track() in sys/net80211/ieee80211_freebsd.c was
identifying ieee80211 interfaces by checking to see if the value of
the ifp->if_start pointer was equal to ieee80211_start.  r254082 was a
move away from using if_start to using if_transmit in the ieee80211
stack, and bpf_track() was correspondingly updated to check the value
of ifp->if_transmit against ieee80211_vap_transmit.  The problem is
that ifp->if_transmit is set to null_transmit by
ieee80211_vap_attach() in sys/net80211/ieee80211.c for interfaces that
are in monitor mode (code that has been in place since r195846).

One fix that resolves the issue is to use what is likely to be a more
stable signature in the check in bpf_track().

A patch against r256155 is attached.

-Patrick

[-- Attachment #2 --]
Index: sys/net80211/ieee80211_freebsd.c
===================================================================
--- sys/net80211/ieee80211_freebsd.c	(revision 256155)
+++ sys/net80211/ieee80211_freebsd.c	(working copy)
@@ -808,9 +808,9 @@
 static void
 bpf_track(void *arg, struct ifnet *ifp, int dlt, int attach)
 {
-	/* NB: identify vap's by if_start */
+	/* NB: identify vap's by if_init */
 	if (dlt == DLT_IEEE802_11_RADIO &&
-	    ifp->if_transmit == ieee80211_vap_transmit) {
+	    ifp->if_init == ieee80211_init) {
 		struct ieee80211vap *vap = ifp->if_softc;
 		/*
 		 * Track bpf radiotap listener state.  We mark the vap

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD44qMVeT_FJP26NSt5uXRdqzyWvZvYNOMpybnAG5u9YunqVQw>