PERFORCE change 135068 for review

Sam Leffler sam at FreeBSD.org
Fri Feb 8 15:17:47 PST 2008


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

Change 135068 by sam at sam_ebb on 2008/02/08 23:17:00

	mark EAPOL frames w/ M_EAPOL in ieee80211_classify and assign
	them to the VO ac so they get high priority

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_output.c#26 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_output.c#26 (text+ko) ====

@@ -139,6 +139,9 @@
 		 * Sanitize mbuf flags for net80211 use.  We cannot
 		 * clear M_PWR_SAV because this may be set for frames
 		 * that are re-submitted from the power save queue.
+		 *
+		 * NB: This must be done before ieee80211_classify as
+		 *     it marks EAPOL in frames with M_EAPOL.
 		 */
 		m->m_flags &= ~(M_80211_TX - M_PWR_SAV);
 		/*
@@ -349,6 +352,14 @@
 		ni = ieee80211_ref_node(vap->iv_bss);
 	}
 
+	/*
+	 * Sanitize mbuf for net80211 flags leaked from above.
+	 *
+	 * NB: This must be done before ieee80211_classify as
+	 *     it marks EAPOL in frames with M_EAPOL.
+	 */
+	m->m_flags &= ~M_80211_TX;
+
 	/* calculate priority so drivers can find the tx queue */
 	/* XXX assumes an 802.3 frame */
 	if (ieee80211_classify(ni, m))
@@ -356,9 +367,6 @@
 
 	BPF_MTAP(ifp, m);
 
-	/* sanitize mbuf for net80211 flags leaked from above */
-	m->m_flags &= ~M_80211_TX;
-
 	/*
 	 * NB: DLT_IEEE802_11_RADIO identifies the parameters are
 	 * present by setting the sa_len field of the sockaddr (yes,
@@ -580,8 +588,21 @@
 int
 ieee80211_classify(struct ieee80211_node *ni, struct mbuf *m)
 {
+	const struct ether_header *eh = mtod(m, struct ether_header *);
 	int v_wme_ac, d_wme_ac, ac;
 
+	/*
+	 * Always promote PAE/EAPOL frames to high priority.
+	 */
+	if (eh->ether_type == htons(ETHERTYPE_PAE)) {
+		/* NB: mark so others don't need to check header */
+		m->m_flags |= M_EAPOL;
+		ac = WME_AC_VO;
+		goto done;
+	}
+	/*
+	 * Non-qos traffic goes to BE.
+	 */
 	if ((ni->ni_flags & IEEE80211_NODE_QOS) == 0) {
 		ac = WME_AC_BE;
 		goto done;
@@ -607,7 +628,7 @@
 	}
 
 #ifdef INET
-	if (mtod(m, struct ether_header *)->ether_type == htons(ETHERTYPE_IP)) {
+	if (eh->ether_type == htons(ETHERTYPE_IP)) {
 		uint8_t tos;
 		/*
 		 * IP frame, map the DSCP bits from the TOS field.
@@ -775,6 +796,9 @@
  * If an error is encountered NULL is returned.  The caller is required
  * to provide a node reference and pullup the ethernet header in the
  * first mbuf.
+ *
+ * NB: Packet is assumed to be processed by ieee80211_classify which
+ *     marked EAPOL frames w/ M_EAPOL.
  */
 struct mbuf *
 ieee80211_encap(struct ieee80211_node *ni, struct mbuf *m)
@@ -816,7 +840,7 @@
 			key = ieee80211_crypto_getucastkey(vap, ni);
 		else
 			key = ieee80211_crypto_getmcastkey(vap, ni);
-		if (key == NULL && eh.ether_type != htons(ETHERTYPE_PAE)) {
+		if (key == NULL && (m->m_flags & M_EAPOL)) {
 			IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_CRYPTO,
 			    eh.ether_dhost,
 			    "no default transmit key (%s) deftxkey %u",
@@ -834,7 +858,7 @@
 	 * configurable.
 	 */
 	addqos = (ni->ni_flags & (IEEE80211_NODE_QOS|IEEE80211_NODE_HT)) &&
-		 eh.ether_type != htons(ETHERTYPE_PAE);
+		 (m->m_flags & M_EAPOL) == 0;
 	if (addqos)
 		hdrsize = sizeof(struct ieee80211_qosframe);
 	else
@@ -1038,7 +1062,7 @@
 		 * IEEE 802.1X: send EAPOL frames always in the clear.
 		 * WPA/WPA2: encrypt EAPOL keys when pairwise keys are set.
 		 */
-		if (eh.ether_type != htons(ETHERTYPE_PAE) ||
+		if ((m->m_flags & M_EAPOL) == 0 ||
 		    ((vap->iv_flags & IEEE80211_F_WPA) &&
 		     (vap->iv_opmode == IEEE80211_M_STA ?
 		      !IEEE80211_KEY_UNDEFINED(key) :


More information about the p4-projects mailing list