From owner-p4-projects@FreeBSD.ORG Fri Feb 22 16:56:42 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 68D7F16A412; Fri, 22 Feb 2008 16:56:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E3A216A403 for ; Fri, 22 Feb 2008 16:56:42 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2771013C4D9 for ; Fri, 22 Feb 2008 16:56:42 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1MGufLP030183 for ; Fri, 22 Feb 2008 16:56:41 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1MGufPv030180 for perforce@freebsd.org; Fri, 22 Feb 2008 16:56:41 GMT (envelope-from sam@freebsd.org) Date: Fri, 22 Feb 2008 16:56:41 GMT Message-Id: <200802221656.m1MGufPv030180@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 Cc: Subject: PERFORCE change 135970 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2008 16:56:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=135970 Change 135970 by sam@sam_ebb on 2008/02/22 16:55:45 pull check for being in RUN state on processing AUTH packets up into the caller so it can be done early; this guards against responding w/ an error packet before the bss channel is setup Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_hostap.c#14 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_hostap.c#14 (text+ko) ==== @@ -892,6 +892,8 @@ { struct ieee80211vap *vap = ni->ni_vap; + KASSERT(vap->iv_state == IEEE80211_S_RUN, ("state %d", vap->iv_state)); + if (ni->ni_authmode == IEEE80211_AUTH_SHARED) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH, ni->ni_macaddr, "open auth", @@ -912,8 +914,7 @@ (seq + 1) | (IEEE80211_STATUS_ALG<<16)); return; } - if (vap->iv_state != IEEE80211_S_RUN || - seq != IEEE80211_AUTH_OPEN_REQUEST) { + if (seq != IEEE80211_AUTH_OPEN_REQUEST) { vap->iv_stats.is_rx_bad_auth++; return; } @@ -967,6 +968,8 @@ uint8_t *challenge; int allocbs, estatus; + KASSERT(vap->iv_state == IEEE80211_S_RUN, ("state %d", vap->iv_state)); + /* * NB: this can happen as we allow pre-shared key * authentication to be enabled w/o wep being turned @@ -1034,13 +1037,6 @@ default: break; } - if (vap->iv_state != IEEE80211_S_RUN) { - IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH, - ni->ni_macaddr, "shared key auth", - "bad state %u", vap->iv_state); - estatus = IEEE80211_STATUS_ALG; /* XXX */ - goto bad; - } switch (seq) { case IEEE80211_AUTH_SHARED_REQUEST: if (ni == vap->iv_bss) { @@ -1843,6 +1839,11 @@ case IEEE80211_FC0_SUBTYPE_AUTH: { uint16_t algo, seq, status; + + if (vap->iv_state != IEEE80211_S_RUN) { + vap->iv_stats.is_rx_mgtdiscard++; + return; + } /* * auth frame format * [2] algorithm