From owner-p4-projects@FreeBSD.ORG Sat Feb 21 18:07:43 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 01DD216A4D0; Sat, 21 Feb 2004 18:07:42 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B38CD16A4CE for ; Sat, 21 Feb 2004 18:07:42 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACB3E43D1D for ; Sat, 21 Feb 2004 18:07:42 -0800 (PST) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i1M27gGe093064 for ; Sat, 21 Feb 2004 18:07:42 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i1M27ggU093061 for perforce@freebsd.org; Sat, 21 Feb 2004 18:07:42 -0800 (PST) (envelope-from sam@freebsd.org) Date: Sat, 21 Feb 2004 18:07:42 -0800 (PST) Message-Id: <200402220207.i1M27ggU093061@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 47351 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Feb 2004 02:07:43 -0000 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. */