Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2005 05:21:08 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 74080 for review
Message-ID:  <200503300521.j2U5L8Mk004943@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -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 <sys/cdefs.h>
-__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 *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503300521.j2U5L8Mk004943>