TCP/IP protocol detailed Volume 2 the 4th Chapter Ethernet

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.