From 4e844c9453a586f5841ad862abd6ef51601afe28 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Fri, 31 Dec 2004 20:51:41 +0000 Subject: correct header length calculations on tx path for QoS-encapsulated frames when IEEE80211_F_DATAPAD is set (e.g. ath); must use ieee80211_hdrspace instead of ieee80211_hdrsize --- sys/net80211/ieee80211_crypto_ccmp.c | 4 +++- sys/net80211/ieee80211_crypto_tkip.c | 9 ++++++--- sys/net80211/ieee80211_crypto_wep.c | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'sys/net80211') diff --git a/sys/net80211/ieee80211_crypto_ccmp.c b/sys/net80211/ieee80211_crypto_ccmp.c index 8430ac2cadd3..95873b343dc8 100644 --- a/sys/net80211/ieee80211_crypto_ccmp.c +++ b/sys/net80211/ieee80211_crypto_ccmp.c @@ -136,10 +136,12 @@ ccmp_setkey(struct ieee80211_key *k) static int ccmp_encap(struct ieee80211_key *k, struct mbuf *m, u_int8_t keyid) { + struct ccmp_ctx *ctx = k->wk_private; + struct ieee80211com *ic = ctx->cc_ic; u_int8_t *ivp; int hdrlen; - hdrlen = ieee80211_hdrsize(mtod(m, void *)); + hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); /* * Copy down 802.11 header and add the IV, KeyID, and ExtIV. diff --git a/sys/net80211/ieee80211_crypto_tkip.c b/sys/net80211/ieee80211_crypto_tkip.c index 8c0a4b55d632..41f68512f767 100644 --- a/sys/net80211/ieee80211_crypto_tkip.c +++ b/sys/net80211/ieee80211_crypto_tkip.c @@ -171,7 +171,7 @@ tkip_encap(struct ieee80211_key *k, struct mbuf *m, u_int8_t keyid) ic->ic_stats.is_crypto_tkipcm++; return 0; } - hdrlen = ieee80211_hdrsize(mtod(m, void *)); + hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); /* * Copy down 802.11 header and add the IV, KeyID, and ExtIV. @@ -215,10 +215,13 @@ tkip_enmic(struct ieee80211_key *k, struct mbuf *m) if (k->wk_flags & IEEE80211_KEY_SWMIC) { struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); - int hdrlen = ieee80211_hdrsize(wh); + struct ieee80211com *ic = ctx->tc_ic; + int hdrlen; uint8_t mic[IEEE80211_WEP_MICLEN]; - ctx->tc_ic->ic_stats.is_crypto_tkipenmic++; + ic->ic_stats.is_crypto_tkipenmic++; + + hdrlen = ieee80211_hdrspace(ic, wh); michael_mic(ctx, k->wk_txmic, m, hdrlen, m->m_pkthdr.len - hdrlen, mic); diff --git a/sys/net80211/ieee80211_crypto_wep.c b/sys/net80211/ieee80211_crypto_wep.c index 040fab638cf5..c0ceb4c53820 100644 --- a/sys/net80211/ieee80211_crypto_wep.c +++ b/sys/net80211/ieee80211_crypto_wep.c @@ -120,11 +120,12 @@ static int wep_encap(struct ieee80211_key *k, struct mbuf *m, u_int8_t keyid) { struct wep_ctx *ctx = k->wk_private; + struct ieee80211com *ic = ctx->wc_ic; u_int32_t iv; u_int8_t *ivp; int hdrlen; - hdrlen = ieee80211_hdrsize(mtod(m, void *)); + hdrlen = ieee80211_hdrspace(ic, mtod(m, void *)); /* * Copy down 802.11 header and add the IV + KeyID. -- cgit v1.3