From owner-p4-projects@FreeBSD.ORG Mon Dec 15 11:44:39 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EEA6F16A4D0; Mon, 15 Dec 2003 11:44:38 -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 B2CB416A4CE for ; Mon, 15 Dec 2003 11:44:38 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77FAC43D32 for ; Mon, 15 Dec 2003 11:44:37 -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 hBFJib0B020385 for ; Mon, 15 Dec 2003 11:44:37 -0800 (PST) (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id hBFJibV0020382 for perforce@freebsd.org; Mon, 15 Dec 2003 11:44:37 -0800 (PST) (envelope-from sam@freebsd.org) Date: Mon, 15 Dec 2003 11:44:37 -0800 (PST) Message-Id: <200312151944.hBFJibV0020382@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 43951 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: Mon, 15 Dec 2003 19:44:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=43951 Change 43951 by sam@sam_ebb on 2003/12/15 11:43:52 o fix station-side shared key authentication: add missing auth challenge frame send o fixup some debug msgs related to shared key authentication Affected files ... .. //depot/projects/netperf/sys/net80211/ieee80211_input.c#18 edit Differences ... ==== //depot/projects/netperf/sys/net80211/ieee80211_input.c#18 (text+ko) ==== @@ -784,7 +784,7 @@ IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1); if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "station %s %s authenticated\n", + if_printf(ifp, "station %s %s authenticated (open)\n", ether_sprintf(ni->ni_macaddr), (allocbs ? "newly" : "already")); break; @@ -797,7 +797,7 @@ } if (status != 0) { if_printf(&ic->ic_if, - "authentication failed (reason %d) for %s\n", + "open authentication failed (reason %d) for %s\n", status, ether_sprintf(wh->i_addr3)); if (ni != ic->ic_bss) @@ -829,7 +829,7 @@ } if (frm + 1 < efrm) { - if ((frm[1] + 2) > (efrm - frm)) { + if (frm[1] + 2 > efrm - frm) { IEEE80211_DPRINTF(("elt %d %d bytes too long\n", frm[0], (frm[1] + 2) - (efrm - frm))); return; @@ -893,6 +893,11 @@ for (i = IEEE80211_CHALLENGE_LEN / sizeof(u_int32_t); --i >= 0; ) ni->ni_challenge[i] = arc4random(); + if (ifp->if_flags & IFF_DEBUG) + if_printf(ifp, "station %s shared key " + "%sauthentication\n", + ether_sprintf(ni->ni_macaddr), + allocbs ? "" : "re"); break; case IEEE80211_AUTH_SHARED_RESPONSE: if (ni == ic->ic_bss) { @@ -900,7 +905,6 @@ __func__)); return; } - allocbs = 1; if (ni->ni_challenge == NULL) { IEEE80211_DPRINTF(( "%s: no challenge recorded\n", __func__)); @@ -912,6 +916,10 @@ __func__)); return; } + if (ifp->if_flags & IFF_DEBUG) + if_printf(ifp, "station %s authenticated " + "(shared key)\n", + ether_sprintf(ni->ni_macaddr)); break; default: IEEE80211_DPRINTF(("%s: bad seq %d from %s\n", @@ -920,10 +928,6 @@ } IEEE80211_SEND_MGMT(ic, ni, IEEE80211_FC0_SUBTYPE_AUTH, seq + 1); - if (ifp->if_flags & IFF_DEBUG) - if_printf(ifp, "station %s %s authenticated\n", - ether_sprintf(ni->ni_macaddr), - (allocbs ? "newly" : "already")); break; case IEEE80211_M_STA: @@ -937,7 +941,8 @@ } if (status != 0) { if_printf(&ic->ic_if, - "%s: auth failed (reason %d) for %s\n", + "%s: shared authentication failed " + "(reason %d) for %s\n", __func__, status, ether_sprintf(wh->i_addr3)); if (ni != ic->ic_bss) @@ -958,6 +963,8 @@ return; } memcpy(ni->ni_challenge, &challenge[2], challenge[1]); + IEEE80211_SEND_MGMT(ic, ni, + IEEE80211_FC0_SUBTYPE_AUTH, seq + 1); break; default: IEEE80211_DPRINTF(("%s: bad seq %d from %s\n", @@ -1260,7 +1267,8 @@ ieee80211_auth_open(ic, wh, ni, rssi, rstamp, seq, status); else { - IEEE80211_DPRINTF(("%s: unsupported auth %d from %s\n", + IEEE80211_DPRINTF(("%s: unsupported authentication " + "algorithm %d from %s\n", __func__, algo, ether_sprintf(wh->i_addr2))); ic->ic_stats.is_rx_auth_unsupported++; return;