if_vlan.c (197010) | if_vlan.c (201196) |
---|---|
1/*- 2 * Copyright 1998 Massachusetts Institute of Technology 3 * 4 * Permission to use, copy, modify, and distribute this software and 5 * its documentation for any purpose and without fee is hereby 6 * granted, provided that both the above copyright notice and this 7 * permission notice appear in all copies, that both the above 8 * copyright notice and this permission notice appear in all --- 12 unchanged lines hidden (view full) --- 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright 1998 Massachusetts Institute of Technology 3 * 4 * Permission to use, copy, modify, and distribute this software and 5 * its documentation for any purpose and without fee is hereby 6 * granted, provided that both the above copyright notice and this 7 * permission notice appear in all copies, that both the above 8 * copyright notice and this permission notice appear in all --- 12 unchanged lines hidden (view full) --- 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/net/if_vlan.c 197010 2009-09-09 03:36:43Z emaste $ | 29 * $FreeBSD: head/sys/net/if_vlan.c 201196 2009-12-29 13:35:18Z jhb $ |
30 */ 31 32/* 33 * if_vlan.c - pseudo-device driver for IEEE 802.1Q virtual LANs. 34 * Might be extended some day to also handle IEEE 802.1p priority 35 * tagging. This is sort of sneaky in the implementation, since 36 * we need to pretend to be enough of an Ethernet implementation 37 * to make arp work. The way we do this is by telling everyone --- 423 unchanged lines hidden (view full) --- 461 CURVNET_RESTORE(); 462 return (0); 463} 464 465/* 466 * A handler for network interface departure events. 467 * Track departure of trunks here so that we don't access invalid 468 * pointers or whatever if a trunk is ripped from under us, e.g., | 30 */ 31 32/* 33 * if_vlan.c - pseudo-device driver for IEEE 802.1Q virtual LANs. 34 * Might be extended some day to also handle IEEE 802.1p priority 35 * tagging. This is sort of sneaky in the implementation, since 36 * we need to pretend to be enough of an Ethernet implementation 37 * to make arp work. The way we do this is by telling everyone --- 423 unchanged lines hidden (view full) --- 461 CURVNET_RESTORE(); 462 return (0); 463} 464 465/* 466 * A handler for network interface departure events. 467 * Track departure of trunks here so that we don't access invalid 468 * pointers or whatever if a trunk is ripped from under us, e.g., |
469 * by ejecting its hot-plug card. | 469 * by ejecting its hot-plug card. However, if an ifnet is simply 470 * being renamed, then there's no need to tear down the state. |
470 */ 471static void 472vlan_ifdetach(void *arg __unused, struct ifnet *ifp) 473{ 474 struct ifvlan *ifv; 475 int i; 476 477 /* 478 * Check if it's a trunk interface first of all 479 * to avoid needless locking. 480 */ 481 if (ifp->if_vlantrunk == NULL) 482 return; 483 | 471 */ 472static void 473vlan_ifdetach(void *arg __unused, struct ifnet *ifp) 474{ 475 struct ifvlan *ifv; 476 int i; 477 478 /* 479 * Check if it's a trunk interface first of all 480 * to avoid needless locking. 481 */ 482 if (ifp->if_vlantrunk == NULL) 483 return; 484 |
485 /* If the ifnet is just being renamed, don't do anything. */ 486 if (ifp->if_flags & IFF_RENAMING) 487 return; 488 |
|
484 VLAN_LOCK(); 485 /* 486 * OK, it's a trunk. Loop over and detach all vlan's on it. 487 * Check trunk pointer after each vlan_unconfig() as it will 488 * free it and set to NULL after the last vlan was detached. 489 */ 490#ifdef VLAN_ARRAY 491 for (i = 0; i < VLAN_ARRAY_SIZE; i++) --- 932 unchanged lines hidden --- | 489 VLAN_LOCK(); 490 /* 491 * OK, it's a trunk. Loop over and detach all vlan's on it. 492 * Check trunk pointer after each vlan_unconfig() as it will 493 * free it and set to NULL after the last vlan was detached. 494 */ 495#ifdef VLAN_ARRAY 496 for (i = 0; i < VLAN_ARRAY_SIZE; i++) --- 932 unchanged lines hidden --- |