PERFORCE change 114288 for review

Sepherosa Ziehau sephe at FreeBSD.org
Fri Feb 9 12:53:19 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=114288

Change 114288 by sephe at sephe_zealot:sam_wifi on 2007/02/09 12:52:33

	Avoid possible mbuf re-tap on error path.
	Obtained-from:	DragonFly

Affected files ...

.. //depot/projects/wifi/sys/net80211/ieee80211_input.c#80 edit

Differences ...

==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#80 (text+ko) ====

@@ -139,7 +139,7 @@
 	struct ieee80211_frame *wh;
 	struct ieee80211_key *key;
 	struct ether_header *eh;
-	int hdrspace;
+	int hdrspace, need_tap;
 	u_int8_t dir, type, subtype;
 	u_int8_t *bssid;
 	u_int16_t rxseq;
@@ -152,6 +152,7 @@
 		m_adj(m, -IEEE80211_CRC_LEN);
 		m->m_flags &= ~M_HASFCS;
 	}
+	need_tap = 1;			/* mbuf need to be tapped. */
 	type = -1;			/* undefined */
 	/*
 	 * In monitor mode, send everything directly to bpf.
@@ -427,6 +428,7 @@
 		/* copy to listener after decrypt */
 		if (bpf_peers_present(ic->ic_rawbpf))
 			bpf_mtap(ic->ic_rawbpf, m);
+		need_tap = 0;
 
 		/*
 		 * Finally, strip the 802.11 header.
@@ -588,7 +590,7 @@
 	ifp->if_ierrors++;
 out:
 	if (m != NULL) {
-		if (bpf_peers_present(ic->ic_rawbpf))
+		if (bpf_peers_present(ic->ic_rawbpf) && need_tap)
 			bpf_mtap(ic->ic_rawbpf, m);
 		m_freem(m);
 	}


More information about the p4-projects mailing list