From owner-p4-projects@FreeBSD.ORG Tue May 17 23:32:39 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2902E16A4D1; Tue, 17 May 2005 23:32:39 +0000 (GMT) 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 E030016A4CE for ; Tue, 17 May 2005 23:32:38 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B577F43D6A for ; Tue, 17 May 2005 23:32:37 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j4HNWbdn060733 for ; Tue, 17 May 2005 23:32:37 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j4HNWbFh060730 for perforce@freebsd.org; Tue, 17 May 2005 23:32:37 GMT (envelope-from sam@freebsd.org) Date: Tue, 17 May 2005 23:32:37 GMT Message-Id: <200505172332.j4HNWbFh060730@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 77113 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: Tue, 17 May 2005 23:32:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=77113 Change 77113 by sam@sam_ebb on 2005/05/17 23:32:15 When receiving a NAK to an AUTH or ASSOC request frame explicitly kick the state machine rather than waiting for the tx timeout to fire. Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_input.c#12 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_input.c#12 (text+ko) ==== @@ -1138,13 +1138,10 @@ IEEE80211_NOTE(vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, ni, "open auth failed (reason %d)", status); - /* XXX can this happen? */ - if (ni != vap->iv_bss) - ni->ni_fails++; vap->iv_stats.is_rx_auth_fail++; - return; - } - ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0); + ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); + } else + ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0); break; case IEEE80211_M_MONITOR: break; @@ -1211,6 +1208,7 @@ * ordering in which case this check would just be * for sanity/consistency. */ + estatus = 0; /* NB: silence compiler */ if ((vap->iv_flags & IEEE80211_F_PRIVACY) == 0) { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_AUTH, ni->ni_macaddr, "shared key auth", @@ -1375,17 +1373,14 @@ ieee80211_getbssid(vap, wh), "shared key auth failed (reason %d)", status); - /* XXX can this happen? */ - if (ni != vap->iv_bss) - ni->ni_fails++; vap->iv_stats.is_rx_auth_fail++; - return; + goto bad; } ieee80211_new_state(vap, IEEE80211_S_ASSOC, 0); break; case IEEE80211_AUTH_SHARED_CHALLENGE: if (!alloc_challenge(ni)) - return; + goto bad; /* XXX could optimize by passing recvd challenge */ memcpy(ni->ni_challenge, &challenge[2], challenge[1]); IEEE80211_SEND_MGMT(ni, @@ -1395,20 +1390,28 @@ IEEE80211_DISCARD(vap, IEEE80211_MSG_AUTH, wh, "shared key auth", "bad seq %d", seq); vap->iv_stats.is_rx_bad_auth++; - return; + goto bad; } break; } return; bad: - /* - * Send an error response; but only when operating as an AP. - */ if (vap->iv_opmode == IEEE80211_M_HOSTAP) { + /* + * Send an error response. + */ /* XXX hack to workaround calling convention */ ieee80211_send_error(ni, wh->i_addr2, IEEE80211_FC0_SUBTYPE_AUTH, (seq + 1) | (estatus<<16)); + } else if (vap->iv_opmode == IEEE80211_M_STA) { + /* + * Kick the state machine. This short-circuits + * using the mgt frame timeout to trigger the + * state transition. + */ + if (vap->iv_state == IEEE80211_S_AUTH) + ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); } } @@ -2749,9 +2752,8 @@ wh->i_addr2, "%sassoc failed (reason %d)", ISREASSOC(subtype) ? "re" : "", status); - if (ni != vap->iv_bss) /* XXX never true? */ - ni->ni_fails++; vap->iv_stats.is_rx_auth_fail++; /* XXX */ + ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); return; } associd = le16toh(*(u_int16_t *)frm); @@ -2783,9 +2785,8 @@ wh->i_addr2, "%sassoc failed (rate set mismatch)", ISREASSOC(subtype) ? "re" : ""); - if (ni != vap->iv_bss) /* XXX never true? */ - ni->ni_fails++; vap->iv_stats.is_rx_assoc_norate++; + ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); return; }