NetBSD already has ioctls that get/set these parameters. Only
compile support for the duplicate ioctls from FreeBSD if it is a COMPAT_FREEBSD kernel: IEEE80211_IOC_SSID IEEE80211_IOC_WEPTXKEY IEEE80211_IOC_CHANNEL IEEE80211_IOC_PRIVACY IEEE80211_IOC_DROPUNENCRYPTED IEEE80211_IOC_BSSID IEEE80211_IOC_BEACON_INTERVAL IEEE80211_IOC_WEPKEY
This commit is contained in:
parent
d6d1366732
commit
9ec95e5520
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_ioctl.c,v 1.22 2005/07/27 06:52:27 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_ioctl.c,v 1.23 2005/07/27 07:01:25 dyoung Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
@ -36,7 +36,7 @@
|
||||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.25 2005/07/06 15:38:27 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.22 2005/07/27 06:52:27 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.23 2005/07/27 07:01:25 dyoung Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -841,6 +841,7 @@ ieee80211_cfgset(struct ieee80211com *ic, u_long cmd, caddr_t data)
|
||||
return error;
|
||||
}
|
||||
|
||||
#ifdef COMPAT_FREEBSD
|
||||
static struct ieee80211_channel *
|
||||
getcurchan(struct ieee80211com *ic)
|
||||
{
|
||||
@ -852,6 +853,7 @@ getcurchan(struct ieee80211com *ic)
|
||||
return ic->ic_ibss_chan;
|
||||
}
|
||||
}
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
|
||||
static int
|
||||
cap2cipher(int flag)
|
||||
@ -1263,11 +1265,15 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
{
|
||||
const struct ieee80211_rsnparms *rsn = &ic->ic_bss->ni_rsn;
|
||||
int error = 0;
|
||||
u_int kid, len, m;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
u_int kid, len;
|
||||
u_int8_t tmpkey[IEEE80211_KEYBUF_SIZE];
|
||||
char tmpssid[IEEE80211_NWID_LEN];
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
u_int m;
|
||||
|
||||
switch (ireq->i_type) {
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_SSID:
|
||||
switch (ic->ic_state) {
|
||||
case IEEE80211_S_INIT:
|
||||
@ -1314,12 +1320,14 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
case IEEE80211_IOC_WEPTXKEY:
|
||||
ireq->i_val = ic->ic_def_txkey;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_AUTHMODE:
|
||||
if (ic->ic_flags & IEEE80211_F_WPA)
|
||||
ireq->i_val = IEEE80211_AUTH_WPA;
|
||||
else
|
||||
ireq->i_val = ic->ic_bss->ni_authmode;
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_CHANNEL:
|
||||
ireq->i_val = ieee80211_chan2ieee(ic, getcurchan(ic));
|
||||
break;
|
||||
@ -1332,6 +1340,7 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
case IEEE80211_IOC_POWERSAVESLEEP:
|
||||
ireq->i_val = ic->ic_lintval;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_RTSTHRESHOLD:
|
||||
ireq->i_val = ic->ic_rtsthreshold;
|
||||
break;
|
||||
@ -1389,12 +1398,14 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
case IEEE80211_IOC_ROAMING:
|
||||
ireq->i_val = ic->ic_roaming;
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_PRIVACY:
|
||||
ireq->i_val = (ic->ic_flags & IEEE80211_F_PRIVACY) != 0;
|
||||
break;
|
||||
case IEEE80211_IOC_DROPUNENCRYPTED:
|
||||
ireq->i_val = (ic->ic_flags & IEEE80211_F_DROPUNENC) != 0;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_COUNTERMEASURES:
|
||||
ireq->i_val = (ic->ic_flags & IEEE80211_F_COUNTERM) != 0;
|
||||
break;
|
||||
@ -1425,6 +1436,7 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
case IEEE80211_IOC_CHANINFO:
|
||||
error = ieee80211_ioctl_getchaninfo(ic, ireq);
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_BSSID:
|
||||
if (ireq->i_len != IEEE80211_ADDR_LEN)
|
||||
return EINVAL;
|
||||
@ -1433,6 +1445,7 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
ic->ic_des_bssid,
|
||||
ireq->i_data, ireq->i_len);
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_WPAIE:
|
||||
error = ieee80211_ioctl_getwpaie(ic, ireq);
|
||||
break;
|
||||
@ -1462,10 +1475,12 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
case IEEE80211_IOC_DTIM_PERIOD:
|
||||
ireq->i_val = ic->ic_dtim_period;
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_BEACON_INTERVAL:
|
||||
/* NB: get from ic_bss for station mode */
|
||||
ireq->i_val = ic->ic_bss->ni_intval;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_PUREG:
|
||||
ireq->i_val = (ic->ic_flags & IEEE80211_F_PUREG) != 0;
|
||||
break;
|
||||
@ -1929,19 +1944,22 @@ cipher2cap(int cipher)
|
||||
static int
|
||||
ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211req *ireq)
|
||||
{
|
||||
#ifdef COMPAT_FREEBSD
|
||||
static const u_int8_t zerobssid[IEEE80211_ADDR_LEN];
|
||||
struct ieee80211_rsnparms *rsn = &ic->ic_bss->ni_rsn;
|
||||
int error;
|
||||
const struct ieee80211_authenticator *auth;
|
||||
u_int8_t tmpkey[IEEE80211_KEYBUF_SIZE];
|
||||
char tmpssid[IEEE80211_NWID_LEN];
|
||||
u_int8_t tmpbssid[IEEE80211_ADDR_LEN];
|
||||
struct ieee80211_key *k;
|
||||
int j, caps;
|
||||
u_int kid;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
struct ieee80211_rsnparms *rsn = &ic->ic_bss->ni_rsn;
|
||||
int error;
|
||||
const struct ieee80211_authenticator *auth;
|
||||
int j, caps;
|
||||
|
||||
error = 0;
|
||||
switch (ireq->i_type) {
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_SSID:
|
||||
if (ireq->i_val != 0 ||
|
||||
ireq->i_len > IEEE80211_NWID_LEN)
|
||||
@ -1954,6 +1972,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
memcpy(ic->ic_des_essid, tmpssid, ireq->i_len);
|
||||
error = ENETRESET;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_WEP:
|
||||
switch (ireq->i_val) {
|
||||
case IEEE80211_WEP_OFF:
|
||||
@ -1971,6 +1990,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
}
|
||||
error = ENETRESET;
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_WEPKEY:
|
||||
kid = (u_int) ireq->i_val;
|
||||
if (kid >= IEEE80211_WEP_NKID)
|
||||
@ -2009,6 +2029,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
ic->ic_def_txkey = kid;
|
||||
error = ENETRESET; /* push to hardware */
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_AUTHMODE:
|
||||
switch (ireq->i_val) {
|
||||
case IEEE80211_AUTH_WPA:
|
||||
@ -2049,6 +2070,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
ic->ic_auth = auth;
|
||||
error = ENETRESET;
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_CHANNEL:
|
||||
/* XXX 0xffff overflows 16-bit signed */
|
||||
if (ireq->i_val == 0 ||
|
||||
@ -2107,6 +2129,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
ic->ic_lintval = ireq->i_val;
|
||||
error = IS_UP(ic) ? ic->ic_reset(ic->ic_ifp) : 0;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_RTSTHRESHOLD:
|
||||
if (!(IEEE80211_RTS_MIN < ireq->i_val &&
|
||||
ireq->i_val < IEEE80211_RTS_MAX))
|
||||
@ -2138,6 +2161,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
ic->ic_roaming = ireq->i_val;
|
||||
/* XXXX reset? */
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_PRIVACY:
|
||||
if (ireq->i_val) {
|
||||
/* XXX check for key state? */
|
||||
@ -2151,6 +2175,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
else
|
||||
ic->ic_flags &= ~IEEE80211_F_DROPUNENC;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_WPAKEY:
|
||||
error = ieee80211_ioctl_setkey(ic, ireq);
|
||||
break;
|
||||
@ -2272,6 +2297,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
rsn->rsn_caps = ireq->i_val;
|
||||
error = (ic->ic_flags & IEEE80211_F_WPA) ? ENETRESET : 0;
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_BSSID:
|
||||
/* NB: should only be set when in STA mode */
|
||||
if (ic->ic_opmode != IEEE80211_M_STA)
|
||||
@ -2288,6 +2314,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
ic->ic_flags |= IEEE80211_F_DESBSSID;
|
||||
error = ENETRESET;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_CHANLIST:
|
||||
error = ieee80211_ioctl_setchanlist(ic, ireq);
|
||||
break;
|
||||
@ -2327,6 +2354,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
} else
|
||||
error = EINVAL;
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD
|
||||
case IEEE80211_IOC_BEACON_INTERVAL:
|
||||
if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
|
||||
ic->ic_opmode != IEEE80211_M_IBSS)
|
||||
@ -2338,6 +2366,7 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re
|
||||
} else
|
||||
error = EINVAL;
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
case IEEE80211_IOC_PUREG:
|
||||
if (ireq->i_val)
|
||||
ic->ic_flags |= IEEE80211_F_PUREG;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee80211_ioctl.h,v 1.11 2005/07/27 06:52:27 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_ioctl.h,v 1.12 2005/07/27 07:01:25 dyoung Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
@ -408,19 +408,27 @@ struct ieee80211req {
|
||||
#define SIOCG80211STATS _IOWR('i', 236, struct ifreq)
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#ifdef COMPAT_FREEBSD
|
||||
#define IEEE80211_IOC_SSID 1
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
#define IEEE80211_IOC_NUMSSIDS 2
|
||||
#define IEEE80211_IOC_WEP 3
|
||||
#define IEEE80211_WEP_NOSUP -1
|
||||
#define IEEE80211_WEP_OFF 0
|
||||
#define IEEE80211_WEP_ON 1
|
||||
#define IEEE80211_WEP_MIXED 2
|
||||
#ifdef COMPAT_FREEBSD
|
||||
#define IEEE80211_IOC_WEPKEY 4
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
#define IEEE80211_IOC_NUMWEPKEYS 5
|
||||
#ifdef COMPAT_FREEBSD
|
||||
#define IEEE80211_IOC_WEPTXKEY 6
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
#define IEEE80211_IOC_AUTHMODE 7
|
||||
#define IEEE80211_IOC_STATIONNAME 8
|
||||
#ifdef COMPAT_FREEBSD
|
||||
#define IEEE80211_IOC_CHANNEL 9
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
#define IEEE80211_IOC_POWERSAVE 10
|
||||
#define IEEE80211_POWERSAVE_NOSUP -1
|
||||
#define IEEE80211_POWERSAVE_OFF 0
|
||||
@ -435,10 +443,14 @@ struct ieee80211req {
|
||||
#define IEEE80211_PROTMODE_CTS 1
|
||||
#define IEEE80211_PROTMODE_RTSCTS 2
|
||||
#define IEEE80211_IOC_TXPOWER 14 /* global tx power limit */
|
||||
#ifdef COMPAT_FREEBSD
|
||||
#define IEEE80211_IOC_BSSID 15
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
#define IEEE80211_IOC_ROAMING 16 /* roaming mode */
|
||||
#ifdef COMPAT_FREEBSD
|
||||
#define IEEE80211_IOC_PRIVACY 17 /* privacy invoked */
|
||||
#define IEEE80211_IOC_DROPUNENCRYPTED 18 /* discard unencrypted frames */
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
#define IEEE80211_IOC_WPAKEY 19
|
||||
#define IEEE80211_IOC_DELKEY 20
|
||||
#define IEEE80211_IOC_MLME 21
|
||||
@ -473,7 +485,9 @@ struct ieee80211req {
|
||||
#define IEEE80211_IOC_WME_ACM 50 /* WME: ACM (bss only) */
|
||||
#define IEEE80211_IOC_WME_ACKPOLICY 51 /* WME: ACK policy (!bss only)*/
|
||||
#define IEEE80211_IOC_DTIM_PERIOD 52 /* DTIM period (beacons) */
|
||||
#ifdef COMPAT_FREEBSD
|
||||
#define IEEE80211_IOC_BEACON_INTERVAL 53 /* beacon interval (ms) */
|
||||
#endif /* COMPAT_FREEBSD */
|
||||
#define IEEE80211_IOC_ADDMAC 54 /* add sta to MAC ACL table */
|
||||
#define IEEE80211_IOC_DELMAC 55 /* del sta from MAC ACL table */
|
||||
#define IEEE80211_IOC_PUREG 56 /* pure 11g (no 11b stations) */
|
||||
|
Loading…
Reference in New Issue
Block a user