Subject: an driver, persistent keys and 1.5.1
To: None <tech-net@netbsd.org>
From: Feico Dillema <feico@pasta.cs.uit.no>
List: tech-net
Date: 04/30/2001 13:32:06
--GID0FwUMdk1T2AWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

I have a little local patch to the an driver for 1.5.1 that allows
enabling WEP-crypto with persistent keys. It is a bit of a hack, but a
fairly harmless one I think. I would like to see it in 1.5.1 if the
-current an driver is not pulled up to 1.5.1 (it's probably a bit late
for that). This patch is really minor, so I just include it her. (I
can send-pr it if preferred).

Feico.

--GID0FwUMdk1T2AWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="anreg.h.diff"

--- anreg.h.orig	Mon Apr 30 13:20:55 2001
+++ anreg.h	Mon Apr 30 13:21:12 2001
@@ -1,4 +1,4 @@
-/*	$NetBSD: anreg.h,v 1.3.2.2 2001/03/11 22:18:50 he Exp $	*/
+/*	$NetBSD: anreg.h,v 1.3.2.1 2000/12/12 21:26:34 he Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999
  *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
@@ -322,6 +322,7 @@
 #define AN_AUTHTYPE_OPEN			0x0001
 #define AN_AUTHTYPE_SHAREDKEY			0x0002
 #define AN_AUTHTYPE_EXCLUDE_UNENCRYPTED		0x0004
+#define AN_AUTHTYPE_MASK			0x00ff
 
 #define AN_PSAVE_NONE				0x0000
 #define AN_PSAVE_CAM				0x0001

--GID0FwUMdk1T2AWN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="an.c.diff"

--- an.c.orig	Mon Apr 30 13:20:51 2001
+++ an.c	Mon Apr 30 13:21:05 2001
@@ -980,6 +980,7 @@
 	struct ifreq		*ifr = (struct ifreq *)data;
 	struct ifaddr		*ifa = (struct ifaddr *)data;
 	struct ieee80211_nwid nwid;
+	struct ieee80211_nwkey	*nwkey;
 
 	sc = ifp->if_softc;
 
@@ -1105,6 +1106,15 @@
 			    nwid.i_len);
 		}
 		error = copyout(&nwid, ifr->ifr_data, sizeof(nwid));
+		break;
+	case SIOCS80211NWKEY:
+		/* FWD: WEP with persistent key only */
+		nwkey = (struct ieee80211_nwkey *)data;
+		sc->an_config.an_authtype &= AN_AUTHTYPE_MASK;
+		if (nwkey->i_wepon)
+			sc->an_config.an_authtype |= (AN_AUTHTYPE_MASK + 1);
+		if (sc->sc_enabled)
+			an_init(ifp);
 		break;
 #ifdef IFM_IEEE80211
 	case SIOCSIFMEDIA:

--GID0FwUMdk1T2AWN--