aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_vlan.c
diff options
context:
space:
mode:
authorJack F Vogel <jfv@FreeBSD.org>2008-08-28 22:05:19 +0000
committerJack F Vogel <jfv@FreeBSD.org>2008-08-28 22:05:19 +0000
commit22893351e5bb57c3fcccd119cd1db11e60b71e63 (patch)
tree0455bd41bee7a2d4fe4230c4939643572d23d77c /sys/net/if_vlan.c
parent46e4a5d582c422db04396e550713ed0f2517cf42 (diff)
downloadsrc-22893351e5bb57c3fcccd119cd1db11e60b71e63.tar.gz
src-22893351e5bb57c3fcccd119cd1db11e60b71e63.zip
Fix to bug kern/126850. Only dispatch event hander if the
interface had a parent (was attached). Reviewed by: EvilSam MFC after: 1 week
Notes
Notes: svn path=/head/; revision=182413
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r--sys/net/if_vlan.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 439d14a06633..3f9388334a96 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1094,13 +1094,13 @@ vlan_unconfig_locked(struct ifnet *ifp)
ifv = ifp->if_softc;
trunk = ifv->ifv_trunk;
- parent = PARENT(ifv);
+ parent = NULL;
- if (trunk) {
+ if (trunk != NULL) {
struct sockaddr_dl sdl;
- struct ifnet *p = trunk->parent;
TRUNK_LOCK(trunk);
+ parent = trunk->parent;
/*
* Since the interface is being unconfigured, we need to
@@ -1110,14 +1110,14 @@ vlan_unconfig_locked(struct ifnet *ifp)
bzero((char *)&sdl, sizeof(sdl));
sdl.sdl_len = sizeof(sdl);
sdl.sdl_family = AF_LINK;
- sdl.sdl_index = p->if_index;
+ sdl.sdl_index = parent->if_index;
sdl.sdl_type = IFT_ETHER;
sdl.sdl_alen = ETHER_ADDR_LEN;
while ((mc = SLIST_FIRST(&ifv->vlan_mc_listhead)) != NULL) {
bcopy((char *)&mc->mc_addr, LLADDR(&sdl),
ETHER_ADDR_LEN);
- error = if_delmulti(p, (struct sockaddr *)&sdl);
+ error = if_delmulti(parent, (struct sockaddr *)&sdl);
if (error)
return (error);
SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries);
@@ -1158,7 +1158,13 @@ vlan_unconfig_locked(struct ifnet *ifp)
ifp->if_link_state = LINK_STATE_UNKNOWN;
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
- EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_tag);
+ /*
+ * Only dispatch an event if vlan was
+ * attached, otherwise there is nothing
+ * to cleanup anyway.
+ */
+ if (parent != NULL)
+ EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_tag);
return (0);
}