summaryrefslogtreecommitdiffstats
path: root/sbin/ifconfig/ifieee80211.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2004-03-30 22:59:22 +0000
committersam <sam@FreeBSD.org>2004-03-30 22:59:22 +0000
commit0242ed134b11f2e07839056e0f2d2311860e39a5 (patch)
tree1839855ab32f8f94ba4039d3dc59407653d59606 /sbin/ifconfig/ifieee80211.c
parent2f7d679f76c84769e36cfb6b9931853b49d02f1b (diff)
downloadFreeBSD-src-0242ed134b11f2e07839056e0f2d2311860e39a5.zip
FreeBSD-src-0242ed134b11f2e07839056e0f2d2311860e39a5.tar.gz
add support for setting 802.11 rtsthreshold, transmit power,
and 11g protection mode Reviewed by: imp (just code)
Diffstat (limited to 'sbin/ifconfig/ifieee80211.c')
-rw-r--r--sbin/ifconfig/ifieee80211.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 031dc8f..6f83de0 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -286,6 +286,36 @@ set80211nwkey(const char *val, int d, int s, const struct afswtch *rafp)
}
void
+set80211rtsthreshold(const char *val, int d, int s, const struct afswtch *rafp)
+{
+ set80211(s, IEEE80211_IOC_RTSTHRESHOLD, atoi(val), 0, NULL);
+}
+
+void
+set80211protmode(const char *val, int d, int s, const struct afswtch *rafp)
+{
+ int mode;
+
+ if (strcasecmp(val, "off") == 0) {
+ mode = IEEE80211_PROTMODE_OFF;
+ } else if (strcasecmp(val, "cts") == 0) {
+ mode = IEEE80211_PROTMODE_CTS;
+ } else if (strcasecmp(val, "rtscts") == 0) {
+ mode = IEEE80211_PROTMODE_RTSCTS;
+ } else {
+ err(1, "unknown protection mode");
+ }
+
+ set80211(s, IEEE80211_IOC_PROTMODE, mode, 0, NULL);
+}
+
+void
+set80211txpower(const char *val, int d, int s, const struct afswtch *rafp)
+{
+ set80211(s, IEEE80211_IOC_TXPOWER, atoi(val), 0, NULL);
+}
+
+void
ieee80211_status (int s, struct rt_addrinfo *info __unused)
{
int i;
@@ -380,6 +410,42 @@ ieee80211_status (int s, struct rt_addrinfo *info __unused)
printf("\n");
+ spacer = '\t';
+ ireq.i_type = IEEE80211_IOC_RTSTHRESHOLD;
+ if (ioctl(s, SIOCG80211, &ireq) != -1) {
+ printf("%crtsthreshold %d", spacer, ireq.i_val);
+ spacer = ' ';
+ }
+
+ ireq.i_type = IEEE80211_IOC_PROTMODE;
+ if (ioctl(s, SIOCG80211, &ireq) != -1) {
+ printf("%cprotmode", spacer);
+ switch (ireq.i_val) {
+ case IEEE80211_PROTMODE_OFF:
+ printf(" OFF");
+ break;
+ case IEEE80211_PROTMODE_CTS:
+ printf(" CTS");
+ break;
+ case IEEE80211_PROTMODE_RTSCTS:
+ printf(" RTSCTS");
+ break;
+ default:
+ printf(" UNKNOWN");
+ break;
+ }
+ spacer = ' ';
+ }
+
+ ireq.i_type = IEEE80211_IOC_TXPOWER;
+ if (ioctl(s, SIOCG80211, &ireq) != -1) {
+ printf("%ctxpower %d", spacer, ireq.i_val);
+ spacer = ' ';
+ }
+
+ if (spacer != '\t')
+ printf("\n");
+
ireq.i_type = IEEE80211_IOC_WEP;
if (ioctl(s, SIOCG80211, &ireq) != -1 &&
ireq.i_val != IEEE80211_WEP_NOSUP) {
OpenPOWER on IntegriCloud