Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/netbsd32 support SIOCG80211NWKEY



details:   https://anonhg.NetBSD.org/src/rev/6fe6b9d0ec5a
branches:  trunk
changeset: 769015:6fe6b9d0ec5a
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Aug 30 07:54:15 2011 +0000

description:
support SIOCG80211NWKEY

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  41 ++++++++++++++++++++++++++++++++++-
 sys/compat/netbsd32/netbsd32_ioctl.h |  16 +++++++++++++-
 2 files changed, 54 insertions(+), 3 deletions(-)

diffs (113 lines):

diff -r bf65cc1fcb70 -r 6fe6b9d0ec5a sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Tue Aug 30 07:44:37 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Tue Aug 30 07:54:15 2011 +0000
@@ -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);
diff -r bf65cc1fcb70 -r 6fe6b9d0ec5a sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Tue Aug 30 07:44:37 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Tue Aug 30 07:54:15 2011 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index