summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2013-09-17 13:34:19 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2013-09-17 13:34:19 +0000
commitd003e91419ce243928bcdb54855eff8037df793f (patch)
treeeafb0a4acf3c0b2466e430d264b13c4ab39c40b0 /sys/net/if.c
parent92650dc8fdb9f824ab967b34b3c634debbe89d02 (diff)
Change vlan(4) detach procedure to not use a hook but a list of vlans
on the parent interface. This is similar to what bridge(4), trunk(4) or carp(4) are doing and allows us to get rid of the detachhook. ok reyk@, mikeb@
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 33cae85cc45..dba8e334780 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.265 2013/09/12 09:52:46 mpi Exp $ */
+/* $OpenBSD: if.c,v 1.266 2013/09/17 13:34:17 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -65,9 +65,10 @@
#include "bpfilter.h"
#include "bridge.h"
#include "carp.h"
+#include "ether.h"
#include "pf.h"
#include "trunk.h"
-#include "ether.h"
+#include "vlan.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -133,6 +134,10 @@
#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 *);
@@ -281,6 +286,10 @@ 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);
}
@@ -440,9 +449,6 @@ 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
@@ -502,8 +508,10 @@ if_detach(struct ifnet *ifp)
ifp->if_ioctl = if_detached_ioctl;
ifp->if_watchdog = if_detached_watchdog;
- /* Call detach hooks, ie. to remove vlan interfaces */
- dohooks(ifp->if_detachhooks, HOOK_REMOVE | HOOK_FREE);
+#if NVLAN > 0
+ if (!LIST_EMPTY(&ifp->if_vlist))
+ vlan_ifdetach(ifp);
+#endif
#if NTRUNK > 0
if (ifp->if_type == IFT_IEEE8023ADLAG)
@@ -607,7 +615,6 @@ 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])