summaryrefslogtreecommitdiffstats
path: root/sys/net/if_vlan.c
diff options
context:
space:
mode:
authorjfv <jfv@FreeBSD.org>2008-08-28 22:05:19 +0000
committerjfv <jfv@FreeBSD.org>2008-08-28 22:05:19 +0000
commite4ffb4bcce93ec96d96a47298d3ac371133bf089 (patch)
tree0455bd41bee7a2d4fe4230c4939643572d23d77c /sys/net/if_vlan.c
parentced937913865e9e584a26b5ab698a53ac8a2a98c (diff)
downloadFreeBSD-src-e4ffb4bcce93ec96d96a47298d3ac371133bf089.zip
FreeBSD-src-e4ffb4bcce93ec96d96a47298d3ac371133bf089.tar.gz
Fix to bug kern/126850. Only dispatch event hander if the
interface had a parent (was attached). Reviewed by: EvilSam MFC after: 1 week
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 439d14a..3f93883 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);
}
OpenPOWER on IntegriCloud