From owner-svn-src-head@FreeBSD.ORG Tue Jun 9 16:32:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4FBC1065673; Tue, 9 Jun 2009 16:32:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D27608FC0A; Tue, 9 Jun 2009 16:32:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n59GW7gj077324; Tue, 9 Jun 2009 16:32:07 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n59GW7qs077320; Tue, 9 Jun 2009 16:32:07 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906091632.n59GW7qs077320@svn.freebsd.org> From: Sam Leffler Date: Tue, 9 Jun 2009 16:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193840 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2009 16:32:08 -0000 Author: sam Date: Tue Jun 9 16:32:07 2009 New Revision: 193840 URL: http://svn.freebsd.org/changeset/base/193840 Log: Correct ieee80211_gettid: o don't increment extracted tid, this was a vestige of IEEE80211_NONQOS_TID being defined as 0 (w/ real tid's +1) o handle 4-address frames (add IEEE80211_IS_DSTODS to check if an 802.11 header is DSTODS) Submitted by: cbzimmer Reviewed by: avatar Modified: head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211.h ============================================================================== --- head/sys/net80211/ieee80211.h Tue Jun 9 15:50:33 2009 (r193839) +++ head/sys/net80211/ieee80211.h Tue Jun 9 16:32:07 2009 (r193840) @@ -158,6 +158,9 @@ struct ieee80211_qosframe_addr4 { #define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ #define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ +#define IEEE80211_IS_DSTODS(wh) \ + (((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) + #define IEEE80211_FC1_MORE_FRAG 0x04 #define IEEE80211_FC1_RETRY 0x08 #define IEEE80211_FC1_PWR_MGT 0x10 Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Tue Jun 9 15:50:33 2009 (r193839) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Tue Jun 9 16:32:07 2009 (r193840) @@ -298,8 +298,6 @@ ccmp_init_blocks(rijndael_ctx *ctx, stru uint8_t b0[AES_BLOCK_LEN], uint8_t aad[2 * AES_BLOCK_LEN], uint8_t auth[AES_BLOCK_LEN], uint8_t s0[AES_BLOCK_LEN]) { -#define IS_4ADDRESS(wh) \ - ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) #define IS_QOS_DATA(wh) IEEE80211_QOS_HAS_SEQ(wh) /* CCM Initial Block: @@ -344,7 +342,7 @@ ccmp_init_blocks(rijndael_ctx *ctx, stru * initial block as we know whether or not we have * a QOS frame. */ - if (IS_4ADDRESS(wh)) { + if (IEEE80211_IS_DSTODS(wh)) { IEEE80211_ADDR_COPY(aad + 24, ((struct ieee80211_frame_addr4 *)wh)->i_addr4); if (IS_QOS_DATA(wh)) { @@ -386,7 +384,6 @@ ccmp_init_blocks(rijndael_ctx *ctx, stru b0[14] = b0[15] = 0; rijndael_encrypt(ctx, b0, s0); #undef IS_QOS_DATA -#undef IS_4ADDRESS } #define CCMP_ENCRYPT(_i, _b, _b0, _pos, _e, _len) do { \ Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Tue Jun 9 15:50:33 2009 (r193839) +++ head/sys/net80211/ieee80211_ht.c Tue Jun 9 16:32:07 2009 (r193840) @@ -567,7 +567,7 @@ ieee80211_ampdu_reorder(struct ieee80211 */ return PROCESS; } - if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) + if (IEEE80211_IS_DSTODS(wh)) tid = ((struct ieee80211_qosframe_addr4 *)wh)->i_qos[0]; else tid = wh->i_qos[0]; Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Tue Jun 9 15:50:33 2009 (r193839) +++ head/sys/net80211/ieee80211_proto.h Tue Jun 9 16:32:07 2009 (r193840) @@ -122,7 +122,7 @@ ieee80211_hdrsize(const void *data) /* NB: we don't handle control frames */ KASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL, ("%s: control frame", __func__)); - if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) + if (IEEE80211_IS_DSTODS(wh)) size += IEEE80211_ADDR_LEN; if (IEEE80211_QOS_HAS_SEQ(wh)) size += sizeof(uint16_t); @@ -255,9 +255,12 @@ ieee80211_gettid(const struct ieee80211_ uint8_t tid; if (IEEE80211_QOS_HAS_SEQ(wh)) { - tid = ((const struct ieee80211_qosframe *)wh)-> - i_qos[0] & IEEE80211_QOS_TID; - tid++; + if (IEEE80211_IS_DSTODS(wh)) + tid = ((const struct ieee80211_qosframe_addr4 *)wh)-> + i_qos[0]; + else + tid = ((const struct ieee80211_qosframe *)wh)->i_qos[0]; + tid &= IEEE80211_QOS_TID; } else tid = IEEE80211_NONQOS_TID; return tid;