Fix to bug kern/126850. Only dispatch event hander if the

interface had a parent (was attached).

Reviewed by: EvilSam
MFC after: 1 week
This commit is contained in:
jfv 2008-08-28 22:05:19 +00:00
parent ced9379138
commit e4ffb4bcce
2 changed files with 29 additions and 22 deletions

View File

@ -199,22 +199,23 @@ struct if_data {
* more detailed or differenciated than IFCAP_*.
* Hwassist features are defined CSUM_* in sys/mbuf.h
*/
#define IFCAP_RXCSUM 0x0001 /* can offload checksum on RX */
#define IFCAP_TXCSUM 0x0002 /* can offload checksum on TX */
#define IFCAP_NETCONS 0x0004 /* can be a network console */
#define IFCAP_VLAN_MTU 0x0008 /* VLAN-compatible MTU */
#define IFCAP_VLAN_HWTAGGING 0x0010 /* hardware VLAN tag support */
#define IFCAP_JUMBO_MTU 0x0020 /* 9000 byte MTU supported */
#define IFCAP_POLLING 0x0040 /* driver supports polling */
#define IFCAP_VLAN_HWCSUM 0x0080 /* can do IFCAP_HWCSUM on VLANs */
#define IFCAP_TSO4 0x0100 /* can do TCP Segmentation Offload */
#define IFCAP_TSO6 0x0200 /* can do TCP6 Segmentation Offload */
#define IFCAP_LRO 0x0400 /* can do Large Receive Offload */
#define IFCAP_WOL_UCAST 0x0800 /* wake on any unicast frame */
#define IFCAP_WOL_MCAST 0x1000 /* wake on any multicast frame */
#define IFCAP_WOL_MAGIC 0x2000 /* wake on any Magic Packet */
#define IFCAP_TOE4 0x4000 /* interface can offload TCP */
#define IFCAP_TOE6 0x8000 /* interface can offload TCP6 */
#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */
#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */
#define IFCAP_NETCONS 0x00004 /* can be a network console */
#define IFCAP_VLAN_MTU 0x00008 /* VLAN-compatible MTU */
#define IFCAP_VLAN_HWTAGGING 0x00010 /* hardware VLAN tag support */
#define IFCAP_JUMBO_MTU 0x00020 /* 9000 byte MTU supported */
#define IFCAP_POLLING 0x00040 /* driver supports polling */
#define IFCAP_VLAN_HWCSUM 0x00080 /* can do IFCAP_HWCSUM on VLANs */
#define IFCAP_TSO4 0x00100 /* can do TCP Segmentation Offload */
#define IFCAP_TSO6 0x00200 /* can do TCP6 Segmentation Offload */
#define IFCAP_LRO 0x00400 /* can do Large Receive Offload */
#define IFCAP_WOL_UCAST 0x00800 /* wake on any unicast frame */
#define IFCAP_WOL_MCAST 0x01000 /* wake on any multicast frame */
#define IFCAP_WOL_MAGIC 0x02000 /* wake on any Magic Packet */
#define IFCAP_TOE4 0x04000 /* interface can offload TCP */
#define IFCAP_TOE6 0x08000 /* interface can offload TCP6 */
#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)

View File

@ -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);
}