diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index b878c80..e3d3272 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -1193,6 +1193,11 @@ Out of range values are truncated. Typically only a few discreet power settings are available and the driver will use the setting closest to the specified value. Not all adaptors support changing the transmit power. +.It Cm radio Ar mode +Enable or disable the radio transmitter of the adapter. +Not all adaptors support all modes. +The set of valid modes is +.Cm off , on , .It Cm wepmode Ar mode Set the desired WEP mode. Not all adaptors support all modes. diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 31f1b26..42af6b1 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -1017,6 +1017,12 @@ set80211doth(const char *val, int d, int s, const struct afswtch *rafp) set80211(s, IEEE80211_IOC_DOTH, d, 0, NULL); } +static void +set80211radio(const char *val, int d, int s, const struct afswtch *rafp) +{ + set80211(s, IEEE80211_IOC_RADIO, d, 0, NULL); +} + static int getmaxrate(const uint8_t rates[15], uint8_t nrates) { @@ -2360,6 +2366,10 @@ ieee80211_status(int s) LINE_CHECK("txpower %d", ireq.i_val); } + ireq.i_type = IEEE80211_IOC_RADIO; + if (ioctl(s, SIOCG80211, &ireq) != -1 ) + LINE_CHECK("radio %s",ireq.i_val ? "ON" : "OFF" ); + ireq.i_type = IEEE80211_IOC_RTSTHRESHOLD; if (ioctl(s, SIOCG80211, &ireq) != -1) { if (ireq.i_val != IEEE80211_RTS_MAX || verbose) @@ -2788,6 +2798,8 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD_ARG("bmissthreshold", set80211bmissthreshold), DEF_CMD("doth", 1, set80211doth), DEF_CMD("-doth", 0, set80211doth), + DEF_CMD("radio" 1, set80211radio), + DEF_CMD("-radio" 0, set80211radio), }; static struct afswtch af_ieee80211 = { .af_name = "af_ieee80211", diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 0fa4edc..77672e1 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -1108,6 +1108,9 @@ ieee80211_ioctl_get80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re case IEEE80211_IOC_INACTIVITY: ireq->i_val = (ic->ic_flags_ext & IEEE80211_FEXT_INACT) != 0; break; + case IEEE80211_IOC_RADIO: + ireq->i_val = (ic->ic_flags & IEEE80211_F_RADIO) != 0; + break; default: error = EINVAL; break; @@ -2479,6 +2482,16 @@ ieee80211_ioctl_set80211(struct ieee80211com *ic, u_long cmd, struct ieee80211re else ic->ic_flags_ext &= ~IEEE80211_FEXT_INACT; break; + case IEEE80211_IOC_RADIO: + if (ireq->i_val) { + if ((ic->ic_caps & IEEE80211_C_RADIO) == 0) + return EINVAL; + ic->ic_flags |= IEEE80211_F_RADIO; + } else + ic->ic_flags &= ~IEEE80211_F_RADIO; + + error = IS_UP(ic) ? ic->ic_reset(ic->ic_ifp) : 0; + break; default: error = EINVAL; break; diff --git a/sys/net80211/ieee80211_ioctl.h b/sys/net80211/ieee80211_ioctl.h index 15f6c69..5c8b7f2 100644 --- a/sys/net80211/ieee80211_ioctl.h +++ b/sys/net80211/ieee80211_ioctl.h @@ -493,6 +493,7 @@ struct ieee80211req { #define IEEE80211_IOC_LOCATION 91 /* indoor/outdoor/anywhere */ #define IEEE80211_IOC_HTCOMPAT 92 /* support pre-D1.10 HT ie's */ #define IEEE80211_IOC_INACTIVITY 94 /* sta inactivity handling */ +#define IEEE80211_IOC_RADIO 95 /* radio transmitter (on,off) */ /* * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS. diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index e808681..ee98d44 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -325,6 +325,7 @@ struct ieee80211com { #define IEEE80211_F_HIDESSID 0x08000000 /* CONF: hide SSID in beacon */ #define IEEE80211_F_NOBRIDGE 0x10000000 /* CONF: dis. internal bridge */ #define IEEE80211_F_DOTH 0x40000000 /* CONF: 11h enabled */ +#define IEEE80211_F_RADIO 0x80000000 /* CONF: Sftware radio control*/ /* Atheros protocol-specific flags */ #define IEEE80211_F_ATHEROS \ @@ -379,6 +380,7 @@ struct ieee80211com { /* 0x10000000 reserved */ #define IEEE80211_C_BGSCAN 0x20000000 /* CAPABILITY: bg scanning */ #define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */ +#define IEEE80211_C_RADIO 0x80000000 /* CAPABILITY:sw radio control*/ /* XXX protection/barker? */ #define IEEE80211_C_CRYPTO 0x0000002f /* CAPABILITY: crypto alg's */