summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-11-21 09:08:55 +0000
committerpatrick <patrick@openbsd.org>2017-11-21 09:08:55 +0000
commit28a6a44e6734088dac88f091510fc85e7cc976b6 (patch)
tree643a6fd5eede8a360b70924a92f00b4d434e45ee
parentThe compiler is generally free to allocate general purpose registers in whatever (diff)
downloadwireguard-openbsd-28a6a44e6734088dac88f091510fc85e7cc976b6.tar.xz
wireguard-openbsd-28a6a44e6734088dac88f091510fc85e7cc976b6.zip
Move the addrhook disestablish from carpdetach() to carp_clone_destroy()
to make it symmetric to the addrhook establish which is being done in carp_clone_create(). This fixes the issue that carp does not recognize address changes on the carp after an interface has detached, which could cause issues like carp not recovering or even panics. Unfortunately there are more bugs lurking in carp. ok bluhm@
-rw-r--r--sys/netinet/ip_carp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 2d975a715b7..7b4e0b194d5 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.318 2017/11/20 10:35:24 mpi Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.319 2017/11/21 09:08:55 patrick Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -882,6 +882,8 @@ carp_clone_destroy(struct ifnet *ifp)
NET_LOCK();
carpdetach(sc);
+ if (sc->ah_cookie != NULL)
+ hook_disestablish(sc->sc_if.if_addrhooks, sc->ah_cookie);
NET_UNLOCK();
ether_ifdetach(ifp);
@@ -924,9 +926,6 @@ carpdetach(struct carp_softc *sc)
carp_setrun_all(sc, 0);
carp_multicast_cleanup(sc);
- if (sc->ah_cookie != NULL)
- hook_disestablish(sc->sc_if.if_addrhooks, sc->ah_cookie);
-
ifp0 = sc->sc_carpdev;
if (ifp0 == NULL)
return;