summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-05-29 04:33:28 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-05-29 04:33:28 +0000
commitffa405206783be34fe83b6f39923147b56630fa2 (patch)
tree2b36a0b37f74569fc4889ee77937ec1aa067f66f /sys/netinet
parent6ede13814c0f015d453b5e45d72adf61ecef6f2a (diff)
carp_ioctl() happens after ifioctl(); check flags correctly so that
'ifconfig carp0 down' and 'ifconfig carp0 up' work as expected.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_carp.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 2ba69e75051..74056be2075 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.54 2004/05/25 02:32:07 jolan Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.55 2004/05/29 04:33:27 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -1642,8 +1642,7 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr)
break;
case SIOCSIFFLAGS:
- if (sc->sc_ac.ac_if.if_flags & IFF_UP &&
- (ifr->ifr_flags & IFF_UP) == 0) {
+ if (sc->sc_state != INIT && !(ifr->ifr_flags & IFF_UP)) {
sc->sc_ac.ac_if.if_flags &= ~IFF_UP;
timeout_del(&sc->sc_ad_tmo);
timeout_del(&sc->sc_md_tmo);
@@ -1652,11 +1651,8 @@ carp_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr)
carp_send_ad(sc);
carp_set_state(sc, INIT);
carp_setrun(sc, 0);
- }
- if (ifr->ifr_flags & IFF_UP &&
- (sc->sc_ac.ac_if.if_flags & IFF_UP) == 0) {
+ } else if (sc->sc_state == INIT && (ifr->ifr_flags & IFF_UP)) {
sc->sc_ac.ac_if.if_flags |= IFF_UP;
- carp_set_state(sc, INIT);
carp_setrun(sc, 0);
}
break;