[BACK]Return to if_ethersubr.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / net

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/net/if_ethersubr.c between version 1.252 and 1.253

version 1.252, 2018/01/15 10:27:51 version 1.253, 2018/01/15 11:57:27
Line 566  ether_input(struct ifnet *ifp, struct mb
Line 566  ether_input(struct ifnet *ifp, struct mb
 #endif  #endif
   
         KASSERT(!cpu_intr_p());          KASSERT(!cpu_intr_p());
           KASSERT((m->m_flags & M_PKTHDR) != 0);
   
         if ((ifp->if_flags & IFF_UP) == 0) {          if ((ifp->if_flags & IFF_UP) == 0) {
                 m_freem(m);                  m_freem(m);
Line 639  ether_input(struct ifnet *ifp, struct mb
Line 640  ether_input(struct ifnet *ifp, struct mb
                     (uint8_t *)&eh->ether_dhost, eh->ether_type) == 0)                      (uint8_t *)&eh->ether_dhost, eh->ether_type) == 0)
                         return;                          return;
         }          }
 #endif /* NCARP > 0 */  #endif
   
         if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&          if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
             (ifp->if_flags & IFF_PROMISC) != 0 &&              (ifp->if_flags & IFF_PROMISC) != 0 &&
Line 656  ether_input(struct ifnet *ifp, struct mb
Line 657  ether_input(struct ifnet *ifp, struct mb
   
                 eh = mtod(m, struct ether_header *);                  eh = mtod(m, struct ether_header *);
                 etype = ntohs(eh->ether_type);                  etype = ntohs(eh->ether_type);
                 ehlen = sizeof(*eh);  
         }          }
   
 #if NAGR > 0  #if NAGR > 0
Line 666  ether_input(struct ifnet *ifp, struct mb
Line 666  ether_input(struct ifnet *ifp, struct mb
                 agr_input(ifp, m);                  agr_input(ifp, m);
                 return;                  return;
         }          }
 #endif /* NAGR > 0 */  #endif
   
         /*          /*
          * If VLANs are configured on the interface, check to           * If VLANs are configured on the interface, check to
Line 693  ether_input(struct ifnet *ifp, struct mb
Line 693  ether_input(struct ifnet *ifp, struct mb
         switch (etype) {          switch (etype) {
         case ETHERTYPE_VLAN: {          case ETHERTYPE_VLAN: {
                 struct ether_vlan_header *evl = (void *)eh;                  struct ether_vlan_header *evl = (void *)eh;
   
                 /*                  /*
                  * If there is a tag of 0, then the VLAN header was probably                   * If there is a tag of 0, then the VLAN header was probably
                  * just being used to store the priority.  Extract the ether                   * just being used to store the priority.  Extract the ether
                  * type, and if IP or IPV6, let them deal with it.                   * type, and if IP or IPV6, let them deal with it.
                  */                   */
                 if (m->m_len <= sizeof(*evl)                  if (m->m_len <= sizeof(*evl) &&
                     && EVL_VLANOFTAG(evl->evl_tag) == 0) {                      EVL_VLANOFTAG(evl->evl_tag) == 0) {
                         etype = ntohs(evl->evl_proto);                          etype = ntohs(evl->evl_proto);
                         ehlen = sizeof(*evl);                          ehlen = sizeof(*evl);
                         if ((m->m_flags & M_PROMISC) == 0                          if ((m->m_flags & M_PROMISC) == 0 &&
                             && (etype == ETHERTYPE_IP                              (etype == ETHERTYPE_IP ||
                                 || etype == ETHERTYPE_IPV6))                               etype == ETHERTYPE_IPV6))
                                 break;                                  break;
                 }                  }
   
 #if NVLAN > 0  #if NVLAN > 0
                 /*                  /*
                  * vlan_input() will either recursively call ether_input()                   * vlan_input() will either recursively call ether_input()
                  * or drop the packet.                   * or drop the packet.
                  */                   */
                 if (((struct ethercom *)ifp)->ec_nvlans != 0)                  if (ec->ec_nvlans != 0)
                         vlan_input(ifp, m);                          vlan_input(ifp, m);
                 else                  else
 #endif /* NVLAN > 0 */  #endif
                         m_freem(m);                          m_freem(m);
   
                 return;                  return;
         }          }
   
 #if NPPPOE > 0  #if NPPPOE > 0
         case ETHERTYPE_PPPOEDISC:          case ETHERTYPE_PPPOEDISC:
                 pppoedisc_input(ifp, m);                  pppoedisc_input(ifp, m);
                 return;                  return;
   
         case ETHERTYPE_PPPOE:          case ETHERTYPE_PPPOE:
                 pppoe_input(ifp, m);                  pppoe_input(ifp, m);
                 return;                  return;
 #endif /* NPPPOE > 0 */  #endif
   
         case ETHERTYPE_SLOWPROTOCOLS: {          case ETHERTYPE_SLOWPROTOCOLS: {
                 uint8_t subtype;                  uint8_t subtype;
   
 #if defined(DIAGNOSTIC)                  KASSERTMSG((m->m_pkthdr.len < sizeof(*eh) + sizeof(subtype)),
                 if (m->m_pkthdr.len < sizeof(*eh) + sizeof(subtype)) {                          "too short slow protocol packet");
                         panic("ether_input: too short slow protocol packet");  
                 }  
 #endif  
                 m_copydata(m, sizeof(*eh), sizeof(subtype), &subtype);                  m_copydata(m, sizeof(*eh), sizeof(subtype), &subtype);
                 switch (subtype) {                  switch (subtype) {
 #if NAGR > 0  #if NAGR > 0
Line 752  ether_input(struct ifnet *ifp, struct mb
Line 756  ether_input(struct ifnet *ifp, struct mb
                         }                          }
                         break;                          break;
 #endif /* NAGR > 0 */  #endif /* NAGR > 0 */
   
                 default:                  default:
                         if (subtype == 0 || subtype > 10) {                          if (subtype == 0 || subtype > 10) {
                                 /* illegal value */                                  /* illegal value */
Line 763  ether_input(struct ifnet *ifp, struct mb
Line 768  ether_input(struct ifnet *ifp, struct mb
                 }                  }
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         }          }
   
         default:          default:
                 if (m->m_flags & M_PROMISC) {                  if (m->m_flags & M_PROMISC) {
                         m_freem(m);                          m_freem(m);
Line 776  ether_input(struct ifnet *ifp, struct mb
Line 782  ether_input(struct ifnet *ifp, struct mb
                 m->m_flags &= ~M_HASFCS;                  m->m_flags &= ~M_HASFCS;
         }          }
   
         if (etype > ETHERMTU + sizeof (struct ether_header)) {          if (etype > ETHERMTU + sizeof(struct ether_header)) {
                 /* Strip off the Ethernet header. */                  /* Strip off the Ethernet header. */
                 m_adj(m, ehlen);                  m_adj(m, ehlen);
   
Line 799  ether_input(struct ifnet *ifp, struct mb
Line 805  ether_input(struct ifnet *ifp, struct mb
                         revarpinput(m); /* XXX queue? */                          revarpinput(m); /* XXX queue? */
                         return;                          return;
 #endif  #endif
   
 #ifdef INET6  #ifdef INET6
                 case ETHERTYPE_IPV6:                  case ETHERTYPE_IPV6:
                         if (__predict_false(!in6_present)) {                          if (__predict_false(!in6_present)) {
Line 812  ether_input(struct ifnet *ifp, struct mb
Line 819  ether_input(struct ifnet *ifp, struct mb
                         pktq = ip6_pktq;                          pktq = ip6_pktq;
                         break;                          break;
 #endif  #endif
   
 #ifdef NETATALK  #ifdef NETATALK
                 case ETHERTYPE_ATALK:                  case ETHERTYPE_ATALK:
                         isr = NETISR_ATALK;                          isr = NETISR_ATALK;
                         inq = &atintrq1;                          inq = &atintrq1;
                         break;                          break;
   
                 case ETHERTYPE_AARP:                  case ETHERTYPE_AARP:
                         /* probably this should be done with a NETISR as well */                          aarpinput(ifp, m); /* XXX queue? */
                         aarpinput(ifp, m); /* XXX */  
                         return;                          return;
 #endif /* NETATALK */  #endif
   
 #ifdef MPLS  #ifdef MPLS
                 case ETHERTYPE_MPLS:                  case ETHERTYPE_MPLS:
                         isr = NETISR_MPLS;                          isr = NETISR_MPLS;
                         inq = &mplsintrq;                          inq = &mplsintrq;
                         break;                          break;
 #endif  #endif
   
                 default:                  default:
                         m_freem(m);                          m_freem(m);
                         return;                          return;
Line 1013  ether_ifdetach(struct ifnet *ifp)
Line 1023  ether_ifdetach(struct ifnet *ifp)
         ETHER_UNLOCK(ec);          ETHER_UNLOCK(ec);
   
         mutex_obj_free(ec->ec_lock);          mutex_obj_free(ec->ec_lock);
           ec->ec_lock = NULL;
   
         ifp->if_mowner = NULL;          ifp->if_mowner = NULL;
         MOWNER_DETACH(&ec->ec_rx_mowner);          MOWNER_DETACH(&ec->ec_rx_mowner);

Legend:
Removed from v.1.252  
changed lines
  Added in v.1.253

CVSweb <webmaster@jp.NetBSD.org>