From owner-p4-projects@FreeBSD.ORG Wed Mar 30 05:21:10 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9D66816A4D0; Wed, 30 Mar 2005 05:21:09 +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 5F28716A4CE for ; Wed, 30 Mar 2005 05:21:09 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 05DAF43D31 for ; Wed, 30 Mar 2005 05:21:09 +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 j2U5L8Mm004946 for ; Wed, 30 Mar 2005 05:21:08 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j2U5L8Mk004943 for perforce@freebsd.org; Wed, 30 Mar 2005 05:21:08 GMT (envelope-from sam@freebsd.org) Date: Wed, 30 Mar 2005 05:21:08 GMT Message-Id: <200503300521.j2U5L8Mk004943@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 74080 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: Wed, 30 Mar 2005 05:21:10 -0000 http://perforce.freebsd.org/chv.cgi?CH=74080 Change 74080 by sam@sam_ebb on 2005/03/30 05:20:59 IFC random stuff add force parametr to enmic/demic for tx fragmentation and similar and for verifying michael errors detected in h/w Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_crypto.h#7 edit .. //depot/projects/wifi/sys/net80211/ieee80211_crypto_ccmp.c#7 edit .. //depot/projects/wifi/sys/net80211/ieee80211_crypto_none.c#7 edit .. //depot/projects/wifi/sys/net80211/ieee80211_crypto_tkip.c#9 edit .. //depot/projects/wifi/sys/net80211/ieee80211_crypto_wep.c#7 edit .. //depot/projects/wifi/sys/net80211/ieee80211_input.c#47 edit .. //depot/projects/wifi/sys/net80211/ieee80211_output.c#41 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto.h#7 (text+ko) ==== @@ -158,8 +158,8 @@ int (*ic_encap)(struct ieee80211_key *, struct mbuf *, u_int8_t keyid); int (*ic_decap)(struct ieee80211_key *, struct mbuf *); - int (*ic_enmic)(struct ieee80211_key *, struct mbuf *); - int (*ic_demic)(struct ieee80211_key *, struct mbuf *); + int (*ic_enmic)(struct ieee80211_key *, struct mbuf *, int); + int (*ic_demic)(struct ieee80211_key *, struct mbuf *, int); }; extern const struct ieee80211_cipher ieee80211_cipher_none; @@ -177,10 +177,10 @@ */ static __inline int ieee80211_crypto_demic(struct ieee80211com *ic, struct ieee80211_key *k, - struct mbuf *m) + struct mbuf *m, int force) { const struct ieee80211_cipher *cip = k->wk_cipher; - return (cip->ic_miclen > 0 ? cip->ic_demic(k, m) : 1); + return (cip->ic_miclen > 0 ? cip->ic_demic(k, m, force) : 1); } /* @@ -188,10 +188,10 @@ */ static __inline int ieee80211_crypto_enmic(struct ieee80211com *ic, - struct ieee80211_key *k, struct mbuf *m) + struct ieee80211_key *k, struct mbuf *m, int force) { const struct ieee80211_cipher *cip = k->wk_cipher; - return (cip->ic_miclen > 0 ? cip->ic_enmic(k, m) : 1); + return (cip->ic_miclen > 0 ? cip->ic_enmic(k, m, force) : 1); } /* ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto_ccmp.c#7 (text+ko) ==== @@ -68,8 +68,8 @@ static int ccmp_setkey(struct ieee80211_key *); static int ccmp_encap(struct ieee80211_key *k, struct mbuf *, u_int8_t keyid); static int ccmp_decap(struct ieee80211_key *, struct mbuf *); -static int ccmp_enmic(struct ieee80211_key *, struct mbuf *); -static int ccmp_demic(struct ieee80211_key *, struct mbuf *); +static int ccmp_enmic(struct ieee80211_key *, struct mbuf *, int); +static int ccmp_demic(struct ieee80211_key *, struct mbuf *, int); static const struct ieee80211_cipher ccmp = { .ic_name = "AES-CCM", @@ -177,7 +177,7 @@ * Add MIC to the frame as needed. */ static int -ccmp_enmic(struct ieee80211_key *k, struct mbuf *m) +ccmp_enmic(struct ieee80211_key *k, struct mbuf *m, int force) { return 1; @@ -262,7 +262,7 @@ * Verify and strip MIC from the frame. */ static int -ccmp_demic(struct ieee80211_key *k, struct mbuf *m) +ccmp_demic(struct ieee80211_key *k, struct mbuf *m, int force) { return 1; } ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto_none.c#7 (text+ko) ==== @@ -53,8 +53,8 @@ static int none_setkey(struct ieee80211_key *); static int none_encap(struct ieee80211_key *, struct mbuf *, u_int8_t); static int none_decap(struct ieee80211_key *, struct mbuf *); -static int none_enmic(struct ieee80211_key *, struct mbuf *); -static int none_demic(struct ieee80211_key *, struct mbuf *); +static int none_enmic(struct ieee80211_key *, struct mbuf *, int); +static int none_demic(struct ieee80211_key *, struct mbuf *, int); const struct ieee80211_cipher ieee80211_cipher_none = { .ic_name = "NONE", @@ -131,7 +131,7 @@ } static int -none_enmic(struct ieee80211_key *k, struct mbuf *m) +none_enmic(struct ieee80211_key *k, struct mbuf *m, int force) { struct ieee80211com *ic = k->wk_private; @@ -140,7 +140,7 @@ } static int -none_demic(struct ieee80211_key *k, struct mbuf *m) +none_demic(struct ieee80211_key *k, struct mbuf *m, int force) { struct ieee80211com *ic = k->wk_private; ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto_tkip.c#9 (text+ko) ==== @@ -59,9 +59,9 @@ static void tkip_detach(struct ieee80211_key *); static int tkip_setkey(struct ieee80211_key *); static int tkip_encap(struct ieee80211_key *, struct mbuf *m, u_int8_t keyid); -static int tkip_enmic(struct ieee80211_key *, struct mbuf *); +static int tkip_enmic(struct ieee80211_key *, struct mbuf *, int); static int tkip_decap(struct ieee80211_key *, struct mbuf *); -static int tkip_demic(struct ieee80211_key *, struct mbuf *); +static int tkip_demic(struct ieee80211_key *, struct mbuf *, int); static const struct ieee80211_cipher tkip = { .ic_name = "TKIP", @@ -209,11 +209,11 @@ * Add MIC to the frame as needed. */ static int -tkip_enmic(struct ieee80211_key *k, struct mbuf *m) +tkip_enmic(struct ieee80211_key *k, struct mbuf *m, int force) { struct tkip_ctx *ctx = k->wk_private; - if (k->wk_flags & IEEE80211_KEY_SWMIC) { + if (force || (k->wk_flags & IEEE80211_KEY_SWMIC)) { struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); struct ieee80211com *ic = ctx->tc_ic; int hdrlen; @@ -321,11 +321,11 @@ * Verify and strip MIC from the frame. */ static int -tkip_demic(struct ieee80211_key *k, struct mbuf *m) +tkip_demic(struct ieee80211_key *k, struct mbuf *m, int force) { struct tkip_ctx *ctx = k->wk_private; - if (k->wk_flags & IEEE80211_KEY_SWMIC) { + if (force || (k->wk_flags & IEEE80211_KEY_SWMIC)) { struct ieee80211_frame *wh = mtod(m, struct ieee80211_frame *); int hdrlen = ieee80211_hdrsize(wh); u8 mic[IEEE80211_WEP_MICLEN]; ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto_wep.c#7 (text+ko) ==== @@ -56,8 +56,8 @@ static int wep_setkey(struct ieee80211_key *); static int wep_encap(struct ieee80211_key *, struct mbuf *, u_int8_t keyid); static int wep_decap(struct ieee80211_key *, struct mbuf *); -static int wep_enmic(struct ieee80211_key *, struct mbuf *); -static int wep_demic(struct ieee80211_key *, struct mbuf *); +static int wep_enmic(struct ieee80211_key *, struct mbuf *, int); +static int wep_demic(struct ieee80211_key *, struct mbuf *, int); static const struct ieee80211_cipher wep = { .ic_name = "WEP", @@ -193,7 +193,7 @@ * Add MIC to the frame as needed. */ static int -wep_enmic(struct ieee80211_key *k, struct mbuf *m) +wep_enmic(struct ieee80211_key *k, struct mbuf *m, int force) { return 1; @@ -242,7 +242,7 @@ * Verify and strip MIC from the frame. */ static int -wep_demic(struct ieee80211_key *k, struct mbuf *skb) +wep_demic(struct ieee80211_key *k, struct mbuf *skb, int force) { return 1; } ==== //depot/projects/wifi/sys/net80211/ieee80211_input.c#47 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.35 2005/03/16 20:39:05 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.36 2005/03/26 07:15:34 sam Exp $"); #include #include @@ -432,7 +432,7 @@ /* * Next strip any MSDU crypto bits. */ - if (key != NULL && !ieee80211_crypto_demic(ic, key, m)) { + if (key != NULL && !ieee80211_crypto_demic(ic, key, m, 0)) { IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_INPUT, ni->ni_macaddr, "data", "%s", "demic error"); IEEE80211_NODE_STAT(ni, rx_demicfail); ==== //depot/projects/wifi/sys/net80211/ieee80211_output.c#41 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.21 2005/03/16 20:42:00 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.22 2005/03/26 07:11:31 sam Exp $"); #include "opt_inet.h" @@ -629,7 +629,7 @@ !KEY_UNDEFINED(*key) : !KEY_UNDEFINED(ni->ni_ucastkey)))) { wh->i_fc[1] |= IEEE80211_FC1_WEP; /* XXX do fragmentation */ - if (!ieee80211_crypto_enmic(ic, key, m)) { + if (!ieee80211_crypto_enmic(ic, key, m, 0)) { IEEE80211_DPRINTF(ic, IEEE80211_MSG_OUTPUT, "[%s] enmic failed, discard frame\n", ether_sprintf(eh.ether_dhost)); @@ -1162,14 +1162,12 @@ * [tlv] ssid * [tlv] supported rates * [tlv] extended supported rates - * [tlv] WME (optional) * [tlv] user-specified ie's */ m = ieee80211_getmgtframe(&frm, 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) - + sizeof(struct ieee80211_wme_param) + (ic->ic_opt_ie != NULL ? ic->ic_opt_ie_len : 0) ); if (m == NULL) @@ -1179,8 +1177,6 @@ mode = ieee80211_chan2mode(ic, ni->ni_chan); frm = ieee80211_add_rates(frm, &ic->ic_sup_rates[mode]); frm = ieee80211_add_xrates(frm, &ic->ic_sup_rates[mode]); - if (ic->ic_flags & IEEE80211_F_WME) - frm = ieee80211_add_wme_param(frm, &ic->ic_wme); if (ic->ic_opt_ie != NULL) { memcpy(frm, ic->ic_opt_ie, ic->ic_opt_ie_len); frm += ic->ic_opt_ie_len; @@ -1205,6 +1201,7 @@ * [tlv] extended rate phy (ERP) * [tlv] extended supported rates * [tlv] WPA + * [tlv] WME (optional) * [tlv] Atheros capabilities */ m = ieee80211_getmgtframe(&frm, @@ -1220,6 +1217,7 @@ /* XXX !WPA1+WPA2 fits w/o a cluster */ + (ic->ic_flags & IEEE80211_F_WPA ? 2*sizeof(struct ieee80211_ie_wpa) : 0) + + sizeof(struct ieee80211_wme_param) + sizeof(struct ieee80211_ath_ie) ); if (m == NULL) @@ -1273,6 +1271,8 @@ if (ic->ic_curmode == IEEE80211_MODE_11G) frm = ieee80211_add_erp(frm, ic); frm = ieee80211_add_xrates(frm, &ni->ni_rates); + if (ic->ic_flags & IEEE80211_F_WME) + frm = ieee80211_add_wme_param(frm, &ic->ic_wme); if (ni->ni_ath_ie != NULL) frm = ieee80211_add_ath(frm, ni); m->m_pkthdr.len = m->m_len = frm - mtod(m, u_int8_t *);