Voidether_input (IFP, eh, m) struct ifnet *ifp; Register struct Ether_header *eh; struct MBUF *m; {register struct ifqueue *inq; Register struct LLC *l; struct arpcom *ac = (struct arpcom *) IFP; int s;
if ((Ifp->if_flags & iff_up) = = 0) {M_freem (M); Return } Ifp->if_lastchange = time; Ifp->if_ibytes + = M->m_pkthdr.len + sizeof (*EH); if (bcmp (caddr_t) etherbroadcastaddr, (caddr_t) eh->ether_dhost, sizeof (etherbroadcastaddr)) = = 0) m->m_flags |= M_bcast; else if (Eh->ether_dhost[0] & 1) m->m_flags |= m_mcast; if (M->m_flags & (m_bcast| M_mcast)) ifp->if_imcasts++;
Switch (eh->ether_type) {#ifdef INET case ETHERTYPE_IP:SCHEDNETISR (NETISR_IP); INQ = &ipintrq; Break
Case ETHERTYPE_ARP:SCHEDNETISR (NETISR_ARP); INQ = &arpintrq; break; #endif default:if (Eh->ether_type > Ethermtu) {m_freem (M); Return }/* Many of the following are ignored, leaving only the inet * *
}
s = Splimp (); if (If_qfull (INQ)) {If_drop (INQ); M_freem (m); } else If_enqueue (INQ, M); SPLX (s);}
TCP/IP protocol detailed Volume 2 the 4th Chapter Ethernet