if_vlan.c (106932) | if_vlan.c (109623) |
---|---|
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 106932 2002-11-14 23:43:16Z sam $ | 29 * $FreeBSD: head/sys/net/if_vlan.c 109623 2003-01-21 08:56:16Z alfred $ |
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 --- 125 unchanged lines hidden (view full) --- 163 SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries); 164 free(mc, M_VLAN); 165 } 166 167 /* Now program new ones. */ 168 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 169 if (ifma->ifma_addr->sa_family != AF_LINK) 170 continue; | 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 --- 125 unchanged lines hidden (view full) --- 163 SLIST_REMOVE_HEAD(&sc->vlan_mc_listhead, mc_entries); 164 free(mc, M_VLAN); 165 } 166 167 /* Now program new ones. */ 168 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 169 if (ifma->ifma_addr->sa_family != AF_LINK) 170 continue; |
171 mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_WAITOK); | 171 mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, 0); |
172 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 173 (char *)&mc->mc_addr, ETHER_ADDR_LEN); 174 SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries); 175 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 176 LLADDR(&sdl), ETHER_ADDR_LEN); 177 error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma); 178 if (error) 179 return(error); --- 47 unchanged lines hidden (view full) --- 227 228static int 229vlan_clone_create(struct if_clone *ifc, int unit) 230{ 231 struct ifvlan *ifv; 232 struct ifnet *ifp; 233 int s; 234 | 172 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 173 (char *)&mc->mc_addr, ETHER_ADDR_LEN); 174 SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries); 175 bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 176 LLADDR(&sdl), ETHER_ADDR_LEN); 177 error = if_addmulti(ifp_p, (struct sockaddr *)&sdl, &rifma); 178 if (error) 179 return(error); --- 47 unchanged lines hidden (view full) --- 227 228static int 229vlan_clone_create(struct if_clone *ifc, int unit) 230{ 231 struct ifvlan *ifv; 232 struct ifnet *ifp; 233 int s; 234 |
235 ifv = malloc(sizeof(struct ifvlan), M_VLAN, M_WAITOK | M_ZERO); | 235 ifv = malloc(sizeof(struct ifvlan), M_VLAN, M_ZERO); |
236 ifp = &ifv->ifv_if; 237 SLIST_INIT(&ifv->vlan_mc_listhead); 238 239 s = splnet(); 240 LIST_INSERT_HEAD(&ifv_list, ifv, ifv_list); 241 splx(s); 242 243 ifp->if_softc = ifv; --- 74 unchanged lines hidden (view full) --- 318 * tell the interface where the packet came from so that it 319 * knows how to find the VLAN tag to use, so we attach a 320 * packet tag that holds it. 321 */ 322 if (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) { 323 struct m_tag *mtag = m_tag_alloc(MTAG_VLAN, 324 MTAG_VLAN_TAG, 325 sizeof (u_int), | 236 ifp = &ifv->ifv_if; 237 SLIST_INIT(&ifv->vlan_mc_listhead); 238 239 s = splnet(); 240 LIST_INSERT_HEAD(&ifv_list, ifv, ifv_list); 241 splx(s); 242 243 ifp->if_softc = ifv; --- 74 unchanged lines hidden (view full) --- 318 * tell the interface where the packet came from so that it 319 * knows how to find the VLAN tag to use, so we attach a 320 * packet tag that holds it. 321 */ 322 if (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) { 323 struct m_tag *mtag = m_tag_alloc(MTAG_VLAN, 324 MTAG_VLAN_TAG, 325 sizeof (u_int), |
326 M_DONTWAIT); | 326 M_NOWAIT); |
327 if (mtag == NULL) { 328 ifp->if_oerrors++; 329 m_freem(m); 330 continue; 331 } 332 *(u_int*)(mtag+1) = ifv->ifv_tag; 333 m_tag_prepend(m, mtag); 334 } else { | 327 if (mtag == NULL) { 328 ifp->if_oerrors++; 329 m_freem(m); 330 continue; 331 } 332 *(u_int*)(mtag+1) = ifv->ifv_tag; 333 m_tag_prepend(m, mtag); 334 } else { |
335 M_PREPEND(m, ifv->ifv_encaplen, M_DONTWAIT); | 335 M_PREPEND(m, ifv->ifv_encaplen, M_NOWAIT); |
336 if (m == NULL) { 337 if_printf(ifp, "unable to prepend VLAN header"); 338 ifp->if_ierrors++; 339 continue; 340 } 341 /* M_PREPEND takes care of m_len, m_pkthdr.len for us */ 342 343 if (m->m_len < sizeof(*evl)) { --- 411 unchanged lines hidden --- | 336 if (m == NULL) { 337 if_printf(ifp, "unable to prepend VLAN header"); 338 ifp->if_ierrors++; 339 continue; 340 } 341 /* M_PREPEND takes care of m_len, m_pkthdr.len for us */ 342 343 if (m->m_len < sizeof(*evl)) { --- 411 unchanged lines hidden --- |