summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-04-10 08:48:24 +0000
committermpi <mpi@openbsd.org>2015-04-10 08:48:24 +0000
commitf074e7d461c6e3fdf7124987027f28d88c3b8cec (patch)
tree260da3b3de0c045ce26df81276c5e14c82771d71 /sys/net/if_ethersubr.c
parentAdd support for CRC-enabled elantech v3 touchpads. (diff)
downloadwireguard-openbsd-f074e7d461c6e3fdf7124987027f28d88c3b8cec.tar.xz
wireguard-openbsd-f074e7d461c6e3fdf7124987027f28d88c3b8cec.zip
Run detach hook and similar before cleaning up any other resource when
an interface is destroyed/removed. This way we can ensure pseudo-driver changes done after attaching an interface are undone before detaching it. Note: it is safe to call if_deactivate() multiple times as the interface should not have any attached pseudo-interface after the first call. ok deraadt@, dlg@
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 292b6871401..2bd2e75acae 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.191 2015/04/07 10:46:20 mpi Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.192 2015/04/10 08:48:24 mpi Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -802,6 +802,9 @@ ether_ifdetach(struct ifnet *ifp)
struct ifih *ether_ifih;
struct ether_multi *enm;
+ /* Undo pseudo-driver changes. */
+ if_deactivate(ifp);
+
ether_ifih = SLIST_FIRST(&ifp->if_inputs);
SLIST_REMOVE_HEAD(&ifp->if_inputs, ifih_next);