Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2004 18:07:42 -0800 (PST)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 47351 for review
Message-ID:  <200402220207.i1M27ggU093061@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=47351

Change 47351 by sam@sam_ebb on 2004/02/21 18:07:29

	flush changes to sync w/ madwifi a week ago (need to update again)

Affected files ...

.. //depot/projects/netperf+sockets/sys/net80211/ieee80211.c#17 edit
.. //depot/projects/netperf+sockets/sys/net80211/ieee80211_dot1x.c#2 edit
.. //depot/projects/netperf+sockets/sys/net80211/ieee80211_input.c#18 edit
.. //depot/projects/netperf+sockets/sys/net80211/ieee80211_node.c#10 edit
.. //depot/projects/netperf+sockets/sys/net80211/ieee80211_output.c#18 edit
.. //depot/projects/netperf+sockets/sys/net80211/ieee80211_radius.c#2 edit

Differences ...

==== //depot/projects/netperf+sockets/sys/net80211/ieee80211.c#17 (text+ko) ====

@@ -178,6 +178,8 @@
 	/* XXX lock */
 	SLIST_REMOVE(&ieee80211_list, ic, ieee80211com, ic_next);
 
+	if (ic->ic_ec != NULL)
+		ieee80211_authenticator_detach(ic);
 	ieee80211_proto_detach(ic);
 	ieee80211_crypto_detach(ic);
 	ieee80211_node_detach(ic);
@@ -374,6 +376,16 @@
 #endif
 	if (ic->ic_max_aid == 0)
 		ic->ic_max_aid = IEEE80211_MAX_AID;
+	/*
+	 * If we default to 802.1x authentication then attach
+	 * the authenticator now.  Otherwise it'll get setup
+	 * when the authentication mode is manually configured.
+	 * Note that we delay until here so ic_max_aid is set;
+	 * this lets the authenticator size/bound it's data
+	 * structures accordingly.
+	 */
+	if (ic->ic_bss->ni_authmode == IEEE80211_AUTH_8021X)
+		ieee80211_authenticator_attach(ic);
 #undef ADD
 }
 

==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_dot1x.c#2 (text+ko) ====

@@ -627,7 +627,7 @@
 }
 
 struct mbuf *
-eapol_alloc_mbuf(u_int pktlen)
+eapol_alloc_mbuf(u_int payload)
 {
 	/* NB: these will never be encrypted */
 	const int overhead =
@@ -638,10 +638,9 @@
 		;
 	struct mbuf *m;
 
-	pktlen += overhead;
-	KASSERT(pktlen+overhead <= MCLBYTES,
-		("EAPOL packet too large: %u", pktlen+overhead));
-	if (pktlen+overhead <= MHLEN)
+	KASSERT(payload+overhead <= MCLBYTES,
+		("EAPOL packet too large: %u", payload+overhead));
+	if (payload+overhead <= MHLEN)
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 	else
 		m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
@@ -649,8 +648,8 @@
 	 * Align to the end of the mbuf/cluster so headers
 	 * fit w/o requiring another mbuf.
 	 */
-	MH_ALIGN(m, pktlen);
-	m->m_pkthdr.len = m->m_len = pktlen;
+	MH_ALIGN(m, payload);
+	m->m_pkthdr.len = m->m_len = payload;
 	return m;
 }
 
@@ -1107,14 +1106,19 @@
 		switch (eap->eap_code) {
 		case EAP_CODE_SUCCESS:
 		case EAP_CODE_FAILURE:
-			/* XXX no need for these */
-			goto out;
 		case EAP_CODE_REQUEST:
-			m_adj(m, sizeof(struct eap_hdr));
 			/* XXX no need for these */
 			goto out;
 		case EAP_CODE_RESPONSE:
-			m_adj(m, sizeof(struct eap_hdr));
+			if (m->m_pkthdr.len < sizeof(struct eap_hdr)) {
+				IEEE80211_DPRINTF(ean->ean_ic,
+				    IEEE80211_MSG_DOT1X,
+				    ("[%s] EAP msg too short, len %u\n",
+				    ether_sprintf(ean->ean_node->ni_macaddr),
+				    m->m_pkthdr.len));
+				eapolstats.eap_tooshort++;
+				goto out;
+			}
 			return eapol_auth_input_eap(ean, eap, m);
 		default:
 			eapolstats.eap_badcode++;

==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_input.c#18 (text+ko) ====

@@ -333,7 +333,7 @@
 			break;
 		default:
 			/* XXX here to keep compiler happy */
-			break;
+			goto out;
 		}
 		if (wh->i_fc[1] & IEEE80211_FC1_WEP) {
 			/*
@@ -771,7 +771,6 @@
 			ni = ieee80211_dup_bss(ic, wh->i_addr2);
 			if (ni == NULL)
 				return;
-			IEEE80211_ADDR_COPY(ni->ni_bssid, ic->ic_bss->ni_bssid);
 			allocbs = 1;
 		} else
 			allocbs = 0;
@@ -797,6 +796,7 @@
 			    ("open authentication failed (reason %d) for %s\n",
 			    status,
 			    ether_sprintf(wh->i_addr3)));
+			/* XXX can this happen? */
 			if (ni != ic->ic_bss)
 				ni->ni_fails++;
 			ic->ic_stats.is_rx_auth_fail++;
@@ -919,8 +919,6 @@
 					/* NB: no way to return an error */
 					return;
 				}
-				IEEE80211_ADDR_COPY(ni->ni_bssid,
-				    ic->ic_bss->ni_bssid);
 				allocbs = 1;
 			} else
 				allocbs = 0;

==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_node.c#10 (text+ko) ====

@@ -512,6 +512,7 @@
 	IEEE80211_NODE_LOCK(ic);
 	TAILQ_INSERT_TAIL(&ic->ic_node, ni, ni_list);
 	LIST_INSERT_HEAD(&ic->ic_hash[hash], ni, ni_hash);
+	ni->ni_ucastkeyix = IEEE80211_KEYIX_NONE;
 	/* 
 	 * Note we don't enable the inactive timer when acting
 	 * as a station.  Nodes created in this mode represent
@@ -624,6 +625,8 @@
 	for (i = 0; i < N(ni->ni_rxfrag); i++)
 		if (ni->ni_rxfrag[i] != NULL)
 			m_freem(ni->ni_rxfrag[i]);
+	if (ni->ni_ucastkeyix != IEEE80211_KEYIX_NONE)
+		(*ic->ic_key_delete)(ic, ni->ni_ucastkeyix);
 	(*ic->ic_node_free)(ic, ni);
 #undef N
 }

==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_output.c#18 (text+ko) ====

@@ -828,7 +828,7 @@
 		  struct mbuf *m)
 {
 	if (_IF_QLEN(&ni->ni_savedq) == 0)
-		ic->ic_set_tim(ic, ni->ni_associd, 1);
+		(*ic->ic_set_tim)(ic, ni->ni_associd, 1);
 	if (_IF_QLEN(&ni->ni_savedq) >= IEEE80211_PS_MAX_QUEUE) {
 		IF_LOCK(&ni->ni_savedq);
 		_IF_DROP(&ni->ni_savedq);

==== //depot/projects/netperf+sockets/sys/net80211/ieee80211_radius.c#2 (text+ko) ====

@@ -560,7 +560,7 @@
 	/*
 	 * Use the received length to size the payload
 	 * in the reply.  This is likely an overestimate but
-	 * simplfies things. Note also that eapol_alloc_mbuf
+	 * simplifies things. Note also that eapol_alloc_mbuf
 	 * reserves headroom for the headers, including the
 	 * EAPOL header.
 	 */


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