summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/ifconfig/ifconfig.823
-rw-r--r--sbin/ifconfig/ifconfig.c12
2 files changed, 27 insertions, 8 deletions
diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8
index 78cdb263981..675dba08a9e 100644
--- a/sbin/ifconfig/ifconfig.8
+++ b/sbin/ifconfig/ifconfig.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ifconfig.8,v 1.133 2006/06/27 22:31:40 jmc Exp $
+.\" $OpenBSD: ifconfig.8,v 1.134 2006/08/29 17:22:00 henning 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 $
.\"
@@ -686,20 +686,31 @@ Set valid lifetime for the address.
.Nm ifconfig
.Fl g
.Ar group-name
-.Op Oo Fl Oc Ns Cm carpdemote
+.Oo
+.Oo Fl Oc Ns Cm carpdemote
+.Op Ar number
+.Oc
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl g Ar group-name
Specify the group.
-.It Cm carpdemote
+.It Cm carpdemote Op Ar number
Increase
.Xr carp 4
-demote count for given interface group.
-.It Fl carpdemote
+demote count for given interface group by
+.Ar number .
+If
+.Ar number
+is omitted, it is increased by 1.
+.It Fl carpdemote Op Ar number
Decrease
.Xr carp 4
-demote count for given interface group.
+demote count for given interface group by
+.Ar number .
+If
+.Ar number
+is omitted, it is decreased by 1.
.El
.\" PFSYNC
.Sh PFSYNC
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index d44ffa3ebfb..8ef266fdb72 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.173 2006/08/18 08:21:08 deraadt Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.174 2006/08/29 17:22:00 henning Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -761,6 +761,7 @@ printgroupattribs(char *groupname)
void
setgroupattribs(char *groupname, int argc, char *argv[])
{
+ const char *errstr;
char *p = argv[0];
int neg = 1;
@@ -769,8 +770,15 @@ setgroupattribs(char *groupname, int argc, char *argv[])
getsock(AF_INET);
bzero(&ifgr, sizeof(ifgr));
strlcpy(ifgr.ifgr_name, groupname, sizeof(ifgr.ifgr_name));
+
+ if (argc > 1) {
+ neg = strtonum(argv[1], 0, 128, &errstr);
+ if (errstr)
+ errx(1, "invalid carp demotion: %s", errstr);
+ }
+
if (p[0] == '-') {
- neg = -1;
+ neg = neg * -1;
p++;
}
if (!strcmp(p, "carpdemote"))