summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-09-30 13:11:49 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-09-30 13:11:49 +0000
commit38b9690ff1fc84f3365efd6bb02ea31945832825 (patch)
tree7bcbe92b474dd82e30e60a6f649f16ced36d15c9 /sbin
parent3e87d33336075436081410e5efb42e48d51e5cee (diff)
compress powersleep commands into one; ok damien
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifconfig.812
-rw-r--r--sbin/ifconfig/ifconfig.c32
2 files changed, 13 insertions, 31 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 2bd303a7677..df08bd5e7bf 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.170 2008/09/10 14:54:47 jmc Exp $
+.\" $OpenBSD: ifconfig.8,v 1.171 2008/09/30 13:11:48 deraadt Exp $
.\" $NetBSD: ifconfig.8,v 1.11 1996/01/04 21:27:29 pk Exp $
.\" $FreeBSD: ifconfig.8,v 1.16 1998/02/01 07:03:29 steve Exp $
.\"
@@ -31,7 +31,7 @@
.\"
.\" @(#)ifconfig.8 8.4 (Berkeley) 6/1/94
.\"
-.Dd $Mdocdate: September 10 2008 $
+.Dd $Mdocdate: September 30 2008 $
.Dt IFCONFIG 8
.Os
.Sh NAME
@@ -563,8 +563,7 @@ will begin advertising as master.
.Op Oo Fl Oc Ns Cm nwflag Ar flag
.Op Oo Fl Oc Cm nwid Ar id
.Op Oo Fl Oc Cm nwkey Ar key
-.Op Oo Fl Oc Cm powersave
-.Op Cm powersavesleep Ar duration
+.Op Oo Fl Oc Cm powersave Op Ar duration
.Op Oo Fl Oc Cm txpower Ar dBm
.Op Oo Fl Oc Cm wmm
.Op Oo Fl Oc Cm wpa
@@ -676,12 +675,11 @@ to the persistent memory of the network card, and
enable WEP encryption for IEEE 802.11-based wireless network interfaces
using that
.Ar key .
-.It Cm powersave
+.It Cm powersave Op Ar duration
Enable 802.11 power saving mode.
+Optionally set the receiver sleep duration (in milliseconds).
.It Fl powersave
Disable 802.11 power saving mode.
-.It Cm powersavesleep Ar duration
-Set the receiver sleep duration (in milliseconds) for 802.11 power saving mode.
.It Cm txpower Ar dBm
Set the transmit power for IEEE 802.11-based wireless network interfaces.
The driver will disable any auto level and transmit power controls in this
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 4be45ab7b0a..da76930676e 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.205 2008/09/09 20:45:23 reyk Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.206 2008/09/30 13:11:48 deraadt Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -160,7 +160,6 @@ void setifwpapsk(const char *, int);
void setifchan(const char *, int);
void setiftxpower(const char *, int);
void setifpowersave(const char *, int);
-void setifpowersavesleep(const char *, int);
void setifnwflag(const char *, int);
void unsetifnwflag(const char *, int);
void setifnetmask(const char *, int);
@@ -313,9 +312,8 @@ const struct cmd {
{ "-wpapsk", -1, 0, setifwpapsk },
{ "chan", NEXTARG0, 0, setifchan },
{ "-chan", -1, 0, setifchan },
- { "powersave", 1, 0, setifpowersave },
+ { "powersave", NEXTARG0, 0, setifpowersave },
{ "-powersave", 0, 0, setifpowersave },
- { "powersavesleep", NEXTARG, 0, setifpowersavesleep },
{ "broadcast", NEXTARG, 0, setifbroadaddr },
{ "ipdst", NEXTARG, 0, setifipdst },
{ "prefixlen", NEXTARG, 0, setifprefixlen},
@@ -1714,23 +1712,6 @@ void
setifpowersave(const char *val, int d)
{
struct ieee80211_power power;
-
- (void)strlcpy(power.i_name, name, sizeof(power.i_name));
- if (ioctl(s, SIOCG80211POWER, (caddr_t)&power) == -1) {
- warn("SIOCG80211POWER");
- return;
- }
-
- power.i_enabled = d;
- if (ioctl(s, SIOCS80211POWER, (caddr_t)&power) == -1)
- warn("SIOCS80211POWER");
-}
-
-/* ARGSUSED */
-void
-setifpowersavesleep(const char *val, int d)
-{
- struct ieee80211_power power;
const char *errmsg = NULL;
(void)strlcpy(power.i_name, name, sizeof(power.i_name));
@@ -1739,10 +1720,13 @@ setifpowersavesleep(const char *val, int d)
return;
}
- power.i_maxsleep = strtonum(val, 0, INT_MAX, &errmsg);
- if (errmsg)
- errx(1, "powersavesleep %s: %s", val, errmsg);
+ if (val) {
+ power.i_maxsleep = strtonum(val, 0, INT_MAX, &errmsg);
+ if (errmsg)
+ errx(1, "powersave %s: %s", val, errmsg);
+ }
+ power.i_enabled = d;
if (ioctl(s, SIOCS80211POWER, (caddr_t)&power) == -1)
warn("SIOCS80211POWER");
}