- register struct ether_header *eh = (struct ether_header *) frame_header;
- register struct ifqueue *inq=0;
- u_short ether_type;
- int s;
- u_int16_t ptype = -1;
- unsigned char buf[18];
-
-#if NETAT
- register struct llc *l;
-#endif
-
- if ((ifp->if_flags & IFF_UP) == 0) {
- m_freem(m);
- return EJUSTRETURN;
- }
-
- ifp->if_lastchange = time;
-
- if (eh->ether_dhost[0] & 1) {
- if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,
- sizeof(etherbroadcastaddr)) == 0)
- m->m_flags |= M_BCAST;
- else
- m->m_flags |= M_MCAST;
- }
- if (m->m_flags & (M_BCAST|M_MCAST))
- ifp->if_imcasts++;
-
- ether_type = ntohs(eh->ether_type);
-
-#if NVLAN > 0
- if (ether_type == vlan_proto) {
- if (vlan_input(eh, m) < 0)
- ifp->if_data.ifi_noproto++;
- return EJUSTRETURN;
- }
-#endif /* NVLAN > 0 */
-
- if (ether_type > ETHERMTU)
- return ENOENT;
-
-#if NETAT
- l = mtod(m, struct llc *);
-
- switch (l->llc_dsap) {
- case LLC_SNAP_LSAP:
-
- /* Temporary hack: check for AppleTalk and AARP packets */
- /* WARNING we're checking only on the "ether_type" (the 2 bytes
- * of the SNAP header. This shouldn't be a big deal,
- * AppleTalk pat_input is making sure we have the right packets
- * because it needs to discrimante AARP from EtherTalk packets.
- */
-
- if (l->llc_ssap == LLC_SNAP_LSAP &&
- l->llc_un.type_snap.control == 0x03) {
-
-#ifdef APPLETALK_DEBUG
- printf("new_ether_input: SNAP Cntrol type=0x%x Src=%s\n",
- l->llc_un.type_snap.ether_type,
- ether_sprintf(buf, &eh->ether_shost));
- printf(" Dst=%s\n",
- ether_sprintf(buf, &eh->ether_dhost));
-#endif /* APPLETALK_DEBUG */
-
- if ((l->llc_un.type_snap.ether_type == 0x809B) ||
- (l->llc_un.type_snap.ether_type == 0x80F3)) {
-
-
- /*
- * note: for AppleTalk we need to pass the enet header of the
- * packet up stack. To do so, we made sure in that the FULL packet
- * is copied in the mbuf by the mace driver, and only the m_data and
- * length have been shifted to make IP and the other guys happy.
- */
-
- m->m_data -= sizeof(*eh);
- m->m_len += sizeof(*eh);
- m->m_pkthdr.len += sizeof(*eh);
-#ifdef APPLETALK_DEBUG
- l == (struct llc *)(eh+1);
- if (l->llc_un.type_snap.ether_type == 0x80F3) {
- kprintf("new_ether_input: RCV AppleTalk type=0x%x Src=%s\n",
- l->llc_un.type_snap.ether_type,
- ether_sprintf(buf, &eh->ether_shost));
- kprintf(" Dst=%s\n",
- ether_sprintf(buf, &eh->ether_dhost));
- }
-#endif /* APPLETALK_DEBUG */
- schednetisr(NETISR_APPLETALK);
- inq = &atalkintrq ;
-
- break;
- }
- }
-
- break;
-
-
- default:
- return ENOENT;
- }
-