if_vlan.c (181803) | if_vlan.c (182413) |
---|---|
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 181803 2008-08-17 23:27:27Z bz $ | 29 * $FreeBSD: head/sys/net/if_vlan.c 182413 2008-08-28 22:05:19Z jfv $ |
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 --- 1051 unchanged lines hidden (view full) --- 1089 struct ifvlan *ifv; 1090 struct ifnet *parent; 1091 int error; 1092 1093 VLAN_LOCK_ASSERT(); 1094 1095 ifv = ifp->if_softc; 1096 trunk = ifv->ifv_trunk; | 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 --- 1051 unchanged lines hidden (view full) --- 1089 struct ifvlan *ifv; 1090 struct ifnet *parent; 1091 int error; 1092 1093 VLAN_LOCK_ASSERT(); 1094 1095 ifv = ifp->if_softc; 1096 trunk = ifv->ifv_trunk; |
1097 parent = PARENT(ifv); | 1097 parent = NULL; |
1098 | 1098 |
1099 if (trunk) { | 1099 if (trunk != NULL) { |
1100 struct sockaddr_dl sdl; | 1100 struct sockaddr_dl sdl; |
1101 struct ifnet *p = trunk->parent; | |
1102 1103 TRUNK_LOCK(trunk); | 1101 1102 TRUNK_LOCK(trunk); |
1103 parent = trunk->parent; |
|
1104 1105 /* 1106 * Since the interface is being unconfigured, we need to 1107 * empty the list of multicast groups that we may have joined 1108 * while we were alive from the parent's list. 1109 */ 1110 bzero((char *)&sdl, sizeof(sdl)); 1111 sdl.sdl_len = sizeof(sdl); 1112 sdl.sdl_family = AF_LINK; | 1104 1105 /* 1106 * Since the interface is being unconfigured, we need to 1107 * empty the list of multicast groups that we may have joined 1108 * while we were alive from the parent's list. 1109 */ 1110 bzero((char *)&sdl, sizeof(sdl)); 1111 sdl.sdl_len = sizeof(sdl); 1112 sdl.sdl_family = AF_LINK; |
1113 sdl.sdl_index = p->if_index; | 1113 sdl.sdl_index = parent->if_index; |
1114 sdl.sdl_type = IFT_ETHER; 1115 sdl.sdl_alen = ETHER_ADDR_LEN; 1116 1117 while ((mc = SLIST_FIRST(&ifv->vlan_mc_listhead)) != NULL) { 1118 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), 1119 ETHER_ADDR_LEN); | 1114 sdl.sdl_type = IFT_ETHER; 1115 sdl.sdl_alen = ETHER_ADDR_LEN; 1116 1117 while ((mc = SLIST_FIRST(&ifv->vlan_mc_listhead)) != NULL) { 1118 bcopy((char *)&mc->mc_addr, LLADDR(&sdl), 1119 ETHER_ADDR_LEN); |
1120 error = if_delmulti(p, (struct sockaddr *)&sdl); | 1120 error = if_delmulti(parent, (struct sockaddr *)&sdl); |
1121 if (error) 1122 return (error); 1123 SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries); 1124 free(mc, M_VLAN); 1125 } 1126 1127 vlan_setflags(ifp, 0); /* clear special flags on parent */ 1128#ifdef VLAN_ARRAY --- 24 unchanged lines hidden (view full) --- 1153 1154 /* Disconnect from parent. */ 1155 if (ifv->ifv_pflags) 1156 if_printf(ifp, "%s: ifv_pflags unclean\n", __func__); 1157 ifp->if_mtu = ETHERMTU; 1158 ifp->if_link_state = LINK_STATE_UNKNOWN; 1159 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 1160 | 1121 if (error) 1122 return (error); 1123 SLIST_REMOVE_HEAD(&ifv->vlan_mc_listhead, mc_entries); 1124 free(mc, M_VLAN); 1125 } 1126 1127 vlan_setflags(ifp, 0); /* clear special flags on parent */ 1128#ifdef VLAN_ARRAY --- 24 unchanged lines hidden (view full) --- 1153 1154 /* Disconnect from parent. */ 1155 if (ifv->ifv_pflags) 1156 if_printf(ifp, "%s: ifv_pflags unclean\n", __func__); 1157 ifp->if_mtu = ETHERMTU; 1158 ifp->if_link_state = LINK_STATE_UNKNOWN; 1159 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 1160 |
1161 EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_tag); | 1161 /* 1162 * Only dispatch an event if vlan was 1163 * attached, otherwise there is nothing 1164 * to cleanup anyway. 1165 */ 1166 if (parent != NULL) 1167 EVENTHANDLER_INVOKE(vlan_unconfig, parent, ifv->ifv_tag); |
1162 1163 return (0); 1164} 1165 1166/* Handle a reference counted flag that should be set on the parent as well */ 1167static int 1168vlan_setflag(struct ifnet *ifp, int flag, int status, 1169 int (*func)(struct ifnet *, int)) --- 247 unchanged lines hidden --- | 1168 1169 return (0); 1170} 1171 1172/* Handle a reference counted flag that should be set on the parent as well */ 1173static int 1174vlan_setflag(struct ifnet *ifp, int flag, int status, 1175 int (*func)(struct ifnet *, int)) --- 247 unchanged lines hidden --- |