Subject: Re: ath driver and wep
To: None <>
From: Greg Troxel <>
List: current-users
Date: 09/30/2005 20:13:52
I made the following change (locally, not committed) yet to
sys/dev/ic/ath.c to write wep keys to the hardware on power up.  This
intends to fix the problem of wep keys being set while the power is
off (ifconfig nwkey before ifconfig up), or lost during ifconfig
down/up.  I tested on one machine and an ifconfig down/up resulted in
a working configuration where previously it did not (and I received a
report from someone else who had the same problem).

I'm using a single 40-bit WEP key.

I'm hesitant to commit it because I don't fully understand how this is
supposed to be handled and I suspect it doesn't handle non-wep keys

This is in ath_mode_init; line numbers are likely off since I have a
lot of local changes.

--- ath.c.~1.37.~	2005-09-30 12:12:48.000000000 -0400
+++ ath.c	2005-09-30 20:08:28.000000000 -0400
@@ -1911,6 +1911,7 @@
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct ath_hal *ah = sc->sc_ah;
 	u_int32_t rfilt, mfilt[2];
+	int i;
 	/* configure rx filter */
 	rfilt = ath_calcrxfilter(sc, ic->ic_state);
@@ -1919,6 +1920,15 @@
 	/* configure operational mode */
+	/* Write keys to hardware; it may have been powered down. */
+	ath_key_update_begin(ic);
+	for (i = 0; i < IEEE80211_WEP_NKID; i++) {
+		ath_key_set(ic,
+			    &ic->ic_crypto.cs_nw_keys[i],
+			    ic->ic_myaddr);
+	}
+	ath_key_update_end(ic);
 	 * Handle any link-level address change.  Note that we only
 	 * need to force ic_myaddr; any other addresses are handled

        Greg Troxel <>