summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2013-10-19 14:05:15 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2013-10-19 14:05:15 +0000
commitb7d38d24b7faf2ecc3898d5dd3868958ef75811f (patch)
tree94e9da3b46c1e2f69583865fe766331c01e17e56 /sys/net/if.c
parent297282c11fd855a31b783ffdbc18e0e867564c46 (diff)
Bring back the if_detachhook. We're going to have more users now.
ok mpi@ henning@ benno@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index a8328ad155f..b65736c5c26 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.269 2013/10/19 11:11:24 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.270 2013/10/19 14:05:14 reyk Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -65,10 +65,9 @@
#include "bpfilter.h"
#include "bridge.h"
#include "carp.h"
-#include "ether.h"
#include "pf.h"
#include "trunk.h"
-#include "vlan.h"
+#include "ether.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -135,10 +134,6 @@
#include <net/pfvar.h>
#endif
-#if NVLAN > 0
-#include <net/if_vlan_var.h>
-#endif
-
void if_attachsetup(struct ifnet *);
void if_attachdomain1(struct ifnet *);
void if_attach_common(struct ifnet *);
@@ -293,10 +288,6 @@ if_attachsetup(struct ifnet *ifp)
pfi_attach_ifnet(ifp);
#endif
-#if NVLAN > 0
- LIST_INIT(&ifp->if_vlist);
-#endif
-
/* Announce the interface. */
rt_ifannouncemsg(ifp, IFAN_ARRIVAL);
}
@@ -456,6 +447,9 @@ if_attach_common(struct ifnet *ifp)
ifp->if_linkstatehooks = malloc(sizeof(*ifp->if_linkstatehooks),
M_TEMP, M_WAITOK);
TAILQ_INIT(ifp->if_linkstatehooks);
+ ifp->if_detachhooks = malloc(sizeof(*ifp->if_detachhooks),
+ M_TEMP, M_WAITOK);
+ TAILQ_INIT(ifp->if_detachhooks);
}
void
@@ -515,10 +509,8 @@ if_detach(struct ifnet *ifp)
ifp->if_ioctl = if_detached_ioctl;
ifp->if_watchdog = if_detached_watchdog;
-#if NVLAN > 0
- if (!LIST_EMPTY(&ifp->if_vlist))
- vlan_ifdetach(ifp);
-#endif
+ /* Call detach hooks, ie. to remove vlan interfaces */
+ dohooks(ifp->if_detachhooks, HOOK_REMOVE | HOOK_FREE);
#if NTRUNK > 0
if (ifp->if_type == IFT_IEEE8023ADLAG)
@@ -621,6 +613,7 @@ do { \
free(ifp->if_addrhooks, M_TEMP);
free(ifp->if_linkstatehooks, M_TEMP);
+ free(ifp->if_detachhooks, M_TEMP);
for (dp = domains; dp; dp = dp->dom_next) {
if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family])