Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_ethersubr.c
| Show First 20 Lines • Show All 884 Lines • ▼ Show 20 Lines | ether_demux(struct ifnet *ifp, struct mbuf *m) | ||||
| */ | */ | ||||
| if ((ifp->if_flags & IFF_PPROMISC) == 0 && (m->m_flags & M_PROMISC)) { | if ((ifp->if_flags & IFF_PPROMISC) == 0 && (m->m_flags & M_PROMISC)) { | ||||
| m_freem(m); | m_freem(m); | ||||
| return; | return; | ||||
| } | } | ||||
| /* | /* | ||||
| * Reset layer specific mbuf flags to avoid confusing upper layers. | * Reset layer specific mbuf flags to avoid confusing upper layers. | ||||
| * Strip off Ethernet header. | |||||
| */ | */ | ||||
| m->m_flags &= ~M_VLANTAG; | m->m_flags &= ~M_VLANTAG; | ||||
| m_clrprotoflags(m); | m_clrprotoflags(m); | ||||
| m_adj(m, ETHER_HDR_LEN); | |||||
| /* | /* | ||||
| * Dispatch frame to upper layer. | * Dispatch frame to upper layer. | ||||
| */ | */ | ||||
| switch (ether_type) { | switch (ether_type) { | ||||
| #ifdef INET | #ifdef INET | ||||
| case ETHERTYPE_IP: | case ETHERTYPE_IP: | ||||
| isr = NETISR_IP; | isr = NETISR_IP; | ||||
| Show All 11 Lines | |||||
| #ifdef INET6 | #ifdef INET6 | ||||
| case ETHERTYPE_IPV6: | case ETHERTYPE_IPV6: | ||||
| isr = NETISR_IPV6; | isr = NETISR_IPV6; | ||||
| break; | break; | ||||
| #endif | #endif | ||||
| default: | default: | ||||
| goto discard; | goto discard; | ||||
| } | } | ||||
| /* Strip off Ethernet header. */ | |||||
| m_adj(m, ETHER_HDR_LEN); | |||||
| netisr_dispatch(isr, m); | netisr_dispatch(isr, m); | ||||
| return; | return; | ||||
| discard: | discard: | ||||
| /* | /* | ||||
| * Packet is to be discarded. If netgraph is present, | * Packet is to be discarded. If netgraph is present, | ||||
| * hand the packet to it for last chance processing; | * hand the packet to it for last chance processing; | ||||
| * otherwise dispose of it. | * otherwise dispose of it. | ||||
| */ | */ | ||||
| if (ifp->if_l2com != NULL) { | if (ifp->if_l2com != NULL) { | ||||
| KASSERT(ng_ether_input_orphan_p != NULL, | KASSERT(ng_ether_input_orphan_p != NULL, | ||||
| ("ng_ether_input_orphan_p is NULL")); | ("ng_ether_input_orphan_p is NULL")); | ||||
| /* | |||||
| * Put back the ethernet header so netgraph has a | |||||
| * consistent view of inbound packets. | |||||
| */ | |||||
| M_PREPEND(m, ETHER_HDR_LEN, M_NOWAIT); | |||||
| (*ng_ether_input_orphan_p)(ifp, m); | (*ng_ether_input_orphan_p)(ifp, m); | ||||
| return; | return; | ||||
| } | } | ||||
| m_freem(m); | m_freem(m); | ||||
| } | } | ||||
| /* | /* | ||||
| * Convert Ethernet address to printable (loggable) representation. | * Convert Ethernet address to printable (loggable) representation. | ||||
| ▲ Show 20 Lines • Show All 541 Lines • Show Last 20 Lines | |||||