diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2006-08-29 17:19:44 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2006-08-29 17:19:44 +0000 |
commit | 259f992f28716b6799e779ff01d78085092928cb (patch) | |
tree | bf5d7aa3edc3671e3ef8ad8f50b64d3b07d4b861 /sys/net/if.c | |
parent | 4c9ce0468df11ab505859a603630ffe74ced1ea3 (diff) |
allow the carp demotion counter to be changed by arbitary values as long
as the resulting demotion counter value is in range. previously, we only
allowed +/- 1. ok mpf mcbride deraadt
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 55834ba8447..b2dc894310d 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.148 2006/07/18 09:23:43 mickey Exp $ */ +/* $OpenBSD: if.c,v 1.149 2006/08/29 17:19:43 henning Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1774,13 +1774,11 @@ if_setgroupattribs(caddr_t data) return (ENOENT); demote = ifgr->ifgr_attrib.ifg_carp_demoted; - if (demote > 1 || demote < -1) - return (E2BIG); + if (demote + ifg->ifg_carp_demoted > 0xff || + demote + ifg->ifg_carp_demoted < 0) + return (ERANGE); - if (demote + ifg->ifg_carp_demoted >= 0) - ifg->ifg_carp_demoted += demote; - else - ifg->ifg_carp_demoted = 0; + ifg->ifg_carp_demoted += demote; return (0); } |