summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in.c10
-rw-r--r--sys/netinet/ip_carp.c12
2 files changed, 11 insertions, 11 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index a9a56e2b325..50e922c95a6 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.165 2019/11/07 13:25:44 bluhm Exp $ */
+/* $OpenBSD: in.c,v 1.166 2019/11/08 07:16:29 dlg Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -390,7 +390,7 @@ in_ioctl_set_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp,
in_ifscrub(ifp, ia);
error = in_ifinit(ifp, ia, sin, newifaddr);
if (!error)
- dohooks(ifp->if_addrhooks, 0);
+ if_addrhooks_run(ifp);
NET_UNLOCK();
return error;
@@ -503,7 +503,7 @@ in_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp,
if (error)
break;
}
- dohooks(ifp->if_addrhooks, 0);
+ if_addrhooks_run(ifp);
break;
}
case SIOCDIFADDR:
@@ -523,7 +523,7 @@ in_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp,
* the scrub but before the other steps?
*/
in_purgeaddr(&ia->ia_ifa);
- dohooks(ifp->if_addrhooks, 0);
+ if_addrhooks_run(ifp);
break;
default:
@@ -946,7 +946,7 @@ in_ifdetach(struct ifnet *ifp)
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
in_purgeaddr(ifa);
- dohooks(ifp->if_addrhooks, 0);
+ if_addrhooks_run(ifp);
}
if (ifp->if_xflags & IFXF_AUTOCONF4)
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index bd6d5465615..7e5bfdf4c9f 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.340 2019/11/07 07:36:32 dlg Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.341 2019/11/08 07:16:29 dlg Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -131,7 +131,7 @@ struct carp_softc {
struct arpcom sc_ac;
#define sc_if sc_ac.ac_if
#define sc_carpdev sc_ac.ac_if.if_carpdev
- void *ah_cookie;
+ struct task sc_atask;
struct task sc_ltask;
struct task sc_dtask;
struct ip_moptions sc_imo;
@@ -808,6 +808,7 @@ carp_clone_create(struct if_clone *ifc, int unit)
return (ENOMEM);
}
+ task_set(&sc->sc_atask, carp_addr_updated, sc);
task_set(&sc->sc_ltask, carp_carpdev_state, sc);
task_set(&sc->sc_dtask, carpdetach, sc);
@@ -841,8 +842,7 @@ carp_clone_create(struct if_clone *ifc, int unit)
ifp->if_link_state = LINK_STATE_INVALID;
/* Hook carp_addr_updated to cope with address and route changes. */
- sc->ah_cookie = hook_establish(sc->sc_if.if_addrhooks, 0,
- carp_addr_updated, sc);
+ if_addrhook_add(&sc->sc_if, &sc->sc_atask);
return (0);
}
@@ -893,10 +893,10 @@ carp_clone_destroy(struct ifnet *ifp)
{
struct carp_softc *sc = ifp->if_softc;
+ if_addrhook_del(&sc->sc_if, &sc->sc_atask);
+
NET_LOCK();
carpdetach(sc);
- if (sc->ah_cookie != NULL)
- hook_disestablish(sc->sc_if.if_addrhooks, sc->ah_cookie);
NET_UNLOCK();
ether_ifdetach(ifp);