support SIOCG80211NWKEY

This commit is contained in:
macallan 2011-08-30 07:54:15 +00:00
parent a356035768
commit d9554c19b2
2 changed files with 54 additions and 3 deletions

View File

@ -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 @@ netbsd32_to_wsdisplay_addscreendata(struct netbsd32_wsdisplay_addscreendata *asd
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
*/
@ -480,6 +497,23 @@ netbsd32_from_wsdisplay_addscreendata(struct wsdisplay_addscreendata *asd,
asd32->idx = asd->idx;
}
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 @@ netbsd32_ioctl(struct lwp *l, const struct netbsd32_ioctl_args *uap, register_t
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);

View File

@ -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 @@ struct netbsd32_wsdisplay_addscreendata {
};
#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 */