if_ethersubr.c (228571) | if_ethersubr.c (232487) |
---|---|
1/*- 2 * Copyright (c) 1982, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 | 1/*- 2 * Copyright (c) 1982, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 |
30 * $FreeBSD: head/sys/net/if_ethersubr.c 228571 2011-12-16 12:16:56Z glebius $ | 30 * $FreeBSD: head/sys/net/if_ethersubr.c 232487 2012-03-04 11:11:03Z zec $ |
31 */ 32 33#include "opt_atalk.h" 34#include "opt_inet.h" 35#include "opt_inet6.h" 36#include "opt_ipx.h" 37#include "opt_netgraph.h" 38#include "opt_mbuf_profiling.h" --- 617 unchanged lines hidden (view full) --- 656 657 /* Handle input from a lagg(4) port */ 658 if (ifp->if_type == IFT_IEEE8023ADLAG) { 659 KASSERT(lagg_input_p != NULL, 660 ("%s: if_lagg not loaded!", __func__)); 661 m = (*lagg_input_p)(ifp, m); 662 if (m != NULL) 663 ifp = m->m_pkthdr.rcvif; | 31 */ 32 33#include "opt_atalk.h" 34#include "opt_inet.h" 35#include "opt_inet6.h" 36#include "opt_ipx.h" 37#include "opt_netgraph.h" 38#include "opt_mbuf_profiling.h" --- 617 unchanged lines hidden (view full) --- 656 657 /* Handle input from a lagg(4) port */ 658 if (ifp->if_type == IFT_IEEE8023ADLAG) { 659 KASSERT(lagg_input_p != NULL, 660 ("%s: if_lagg not loaded!", __func__)); 661 m = (*lagg_input_p)(ifp, m); 662 if (m != NULL) 663 ifp = m->m_pkthdr.rcvif; |
664 else | 664 else { 665 CURVNET_RESTORE(); |
665 return; | 666 return; |
667 } |
|
666 } 667 668 /* 669 * If the hardware did not process an 802.1Q tag, do this now, 670 * to allow 802.1P priority frames to be passed to the main input 671 * path correctly. 672 * TODO: Deal with Q-in-Q frames, but not arbitrary nesting levels. 673 */ 674 if ((m->m_flags & M_VLANTAG) == 0 && etype == ETHERTYPE_VLAN) { 675 struct ether_vlan_header *evl; 676 677 if (m->m_len < sizeof(*evl) && 678 (m = m_pullup(m, sizeof(*evl))) == NULL) { 679#ifdef DIAGNOSTIC 680 if_printf(ifp, "cannot pullup VLAN header\n"); 681#endif 682 ifp->if_ierrors++; 683 m_freem(m); | 668 } 669 670 /* 671 * If the hardware did not process an 802.1Q tag, do this now, 672 * to allow 802.1P priority frames to be passed to the main input 673 * path correctly. 674 * TODO: Deal with Q-in-Q frames, but not arbitrary nesting levels. 675 */ 676 if ((m->m_flags & M_VLANTAG) == 0 && etype == ETHERTYPE_VLAN) { 677 struct ether_vlan_header *evl; 678 679 if (m->m_len < sizeof(*evl) && 680 (m = m_pullup(m, sizeof(*evl))) == NULL) { 681#ifdef DIAGNOSTIC 682 if_printf(ifp, "cannot pullup VLAN header\n"); 683#endif 684 ifp->if_ierrors++; 685 m_freem(m); |
686 CURVNET_RESTORE(); |
|
684 return; 685 } 686 687 evl = mtod(m, struct ether_vlan_header *); 688 m->m_pkthdr.ether_vtag = ntohs(evl->evl_tag); 689 m->m_flags |= M_VLANTAG; 690 691 bcopy((char *)evl, (char *)evl + ETHER_VLAN_ENCAP_LEN, --- 714 unchanged lines hidden --- | 687 return; 688 } 689 690 evl = mtod(m, struct ether_vlan_header *); 691 m->m_pkthdr.ether_vtag = ntohs(evl->evl_tag); 692 m->m_flags |= M_VLANTAG; 693 694 bcopy((char *)evl, (char *)evl + ETHER_VLAN_ENCAP_LEN, --- 714 unchanged lines hidden --- |