Module Name:    src
Committed By:   macallan
Date:           Tue Aug 30 07:54:15 UTC 2011

Modified Files:
        src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
support SIOCG80211NWKEY


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.37 -r1.38 src/sys/compat/netbsd32/netbsd32_ioctl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.58 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.59
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.58	Tue Aug 30 07:06:39 2011
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Tue Aug 30 07:54:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.58 2011/08/30 07:06:39 macallan Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.59 2011/08/30 07:54:15 macallan Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.58 2011/08/30 07:06:39 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.59 2011/08/30 07:54:15 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -305,6 +305,23 @@
 	asd->idx = asd32->idx;
 }
 
+static inline void
+netbsd32_to_ieee80211_nwkey(struct netbsd32_ieee80211_nwkey *nwk32,
+					       struct ieee80211_nwkey *nwk,
+					       u_long cmd)
+{
+	int i;
+
+	strncpy(nwk->i_name, nwk32->i_name, IFNAMSIZ);
+	nwk->i_wepon = nwk32->i_wepon;
+	nwk->i_defkid = nwk32->i_defkid;
+	for (i = 0; i < IEEE80211_WEP_NKID; i++) {
+		nwk->i_key[i].i_keylen = nwk32->i_key[i].i_keylen;
+		nwk->i_key[i].i_keydat =
+		    NETBSD32PTR64(nwk32->i_key[i].i_keydat);
+	}
+}
+
 /*
  * handle ioctl conversions from 64-bit kernel -> netbsd32
  */
@@ -481,6 +498,23 @@
 }
 
 static inline void
+netbsd32_from_ieee80211_nwkey(struct ieee80211_nwkey *nwk,
+				struct netbsd32_ieee80211_nwkey *nwk32,
+				u_long cmd)
+{
+	int i;
+
+	strncpy(nwk32->i_name, nwk->i_name, IFNAMSIZ);
+	nwk32->i_wepon = nwk->i_wepon;
+	nwk32->i_defkid = nwk->i_defkid;
+	for (i = 0; i < IEEE80211_WEP_NKID; i++) {
+		nwk32->i_key[i].i_keylen = nwk->i_key[i].i_keylen;
+		NETBSD32PTR32(nwk32->i_key[i].i_keydat,
+				nwk->i_key[i].i_keydat);
+	}
+}
+
+static inline void
 netbsd32_from_u_long(u_long *p, netbsd32_u_long *s32p, u_long cmd)
 {
 
@@ -794,6 +828,9 @@
 	case WSDISPLAYIO_ADDSCREEN32:
 		IOCTL_STRUCT_CONV_TO(WSDISPLAYIO_ADDSCREEN, wsdisplay_addscreendata);
 
+	case SIOCS80211NWKEY32:
+		IOCTL_STRUCT_CONV_TO(SIOCG80211NWKEY, ieee80211_nwkey);
+
 	default:
 #ifdef NETBSD32_MD_IOCTL
 		error = netbsd32_md_ioctl(fp, com, data32, l);

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.37 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.38
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.37	Tue Aug 30 07:06:39 2011
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Tue Aug 30 07:54:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.37 2011/08/30 07:06:39 macallan Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.38 2011/08/30 07:54:15 macallan Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -36,6 +36,7 @@
 #include <dev/vndvar.h>
 
 #include <dev/wscons/wsconsio.h>
+#include <net80211/ieee80211_ioctl.h>
 
 /* we define some handy macros here... */
 #define IOCTL_STRUCT_CONV_TO(cmd, type)	\
@@ -96,6 +97,19 @@
 };
 #define	WSDISPLAYIO_ADDSCREEN32	_IOW('W', 78, struct netbsd32_wsdisplay_addscreendata)
 
+/* the first member must be matched with struct ifreq */
+struct netbsd32_ieee80211_nwkey {
+	char		i_name[IFNAMSIZ];	/* if_name, e.g. "wi0" */
+	int		i_wepon;		/* wep enabled flag */
+	int		i_defkid;		/* default encrypt key id */
+	struct {
+		int		i_keylen;
+		netbsd32_charp	i_keydat;
+	}		i_key[IEEE80211_WEP_NKID];
+};
+#define	SIOCS80211NWKEY32		 _IOW('i', 232, struct netbsd32_ieee80211_nwkey)
+#define	SIOCG80211NWKEY32		_IOWR('i', 233, struct netbsd32_ieee80211_nwkey)
+
 /* can wait! */
 #if 0
 dev/ccdvar.h:219:#define CCDIOCSET	_IOWR('F', 16, struct ccd_ioctl)   /* enable ccd */

Reply via email to