aboutsummaryrefslogtreecommitdiff
path: root/sys/net
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
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')
-rw-r--r--sys/net/if.h33
-rw-r--r--sys/net/if_vlan.c18
2 files changed, 29 insertions, 22 deletions
diff --git a/sys/net/if.h b/sys/net/if.h
index 216c5b4ad168..7712796347e0 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -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)
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);
}