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

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

Diff for /src/sys/netinet/ip_input.c between version 1.35 and 1.43

version 1.35, 1996/09/09 14:51:16 version 1.43, 1996/12/20 09:08:14
Line 61 
Line 61 
 #include <netinet/ip_var.h>  #include <netinet/ip_var.h>
 #include <netinet/ip_icmp.h>  #include <netinet/ip_icmp.h>
   
   #ifdef PFIL_HOOKS
   #include <net/pfil.h>
   #endif /* PFIL_HOOKS */
   
 #ifndef IPFORWARDING  #ifndef IPFORWARDING
 #ifdef GATEWAY  #ifdef GATEWAY
 #define IPFORWARDING    1       /* forward IP packets not for us */  #define IPFORWARDING    1       /* forward IP packets not for us */
Line 160  ipintr()
Line 164  ipintr()
         register struct in_ifaddr *ia;          register struct in_ifaddr *ia;
         struct ipqent *ipqe;          struct ipqent *ipqe;
         int hlen = 0, mff, len, s;          int hlen = 0, mff, len, s;
 #ifdef PACKET_FILTER  #ifdef PFIL_HOOKS
         struct packet_filter_hook *pfh;          struct packet_filter_hook *pfh;
         struct mbuf *m0;          struct mbuf *m0;
 #endif /* PACKET_FILTER */          int rv;
   #endif /* PFIL_HOOKS */
   
 next:  next:
         /*          /*
Line 239  next:
Line 244  next:
                         m_adj(m, len - m->m_pkthdr.len);                          m_adj(m, len - m->m_pkthdr.len);
         }          }
   
 #ifdef PACKET_FILTER  #ifdef PFIL_HOOKS
         /*          /*
          * Run through list of hooks for input packets.           * Run through list of hooks for input packets.
          */           */
         m0 = m;          m0 = m;
         for (pfh = pfil_hook_get(PFIL_IN); pfh; pfh = pfh->pfil_link.le_next)          for (pfh = pfil_hook_get(PFIL_IN); pfh; pfh = pfh->pfil_link.le_next)
                 if (pfh->pfil_func) {                  if (pfh->pfil_func) {
                         if (pfh->pfil_func(ip, hlen, m->m_pkthdr.rcvif, 0, &m0))                          rv = pfh->pfil_func(ip, hlen, m->m_pkthdr.rcvif, 0, &m0);
                                 goto bad;  
                         ip = mtod(m = m0, struct ip *);                          ip = mtod(m = m0, struct ip *);
                           if (rv)
                                   goto next;
                 }                  }
 #endif /* PACKET_FILTER */  #endif /* PFIL_HOOKS */
   
         /*          /*
          * Process options and, if not destined for us,           * Process options and, if not destined for us,
Line 360  ours:
Line 366  ours:
          * if the packet was previously fragmented,           * if the packet was previously fragmented,
          * but it's not worth the time; just let them time out.)           * but it's not worth the time; just let them time out.)
          */           */
         if (ip->ip_off &~ IP_DF) {          if (ip->ip_off & ~(IP_DF|IP_RF)) {
                 if (m->m_flags & M_EXT) {               /* XXX */                  if (m->m_flags & M_EXT) {               /* XXX */
                         if ((m = m_pullup(m, sizeof (struct ip))) == 0) {                          if ((m = m_pullup(m, sizeof (struct ip))) == 0) {
                                 ipstat.ips_toosmall++;                                  ipstat.ips_toosmall++;
Line 433  found:
Line 439  found:
         (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen);          (*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen);
         goto next;          goto next;
 bad:  bad:
 #ifdef PACKET_FILTER  
         m0 = m;  
         for (pfh = pfil_hook_get(PFIL_BAD); pfh; pfh = pfh->pfil_link.le_next)  
                 if (pfh->pfil_func) {  
                         (void)pfh->pfil_func(ip, hlen, m->m_pkthdr.rcvif, 2, &m0);  
                         ip = mtod(m = m0, struct ip *);  
                 }  
 #endif /* PACKET_FILTER */  
         m_freem(m);          m_freem(m);
         goto next;          goto next;
 }  }
Line 554  insert:
Line 552  insert:
                 return (0);                  return (0);
   
         /*          /*
          * Reassembly is complete; concatenate fragments.           * Reassembly is complete.  Check for a bogus message size and
            * concatenate fragments.
          */           */
         q = fp->ipq_fragq.lh_first;          q = fp->ipq_fragq.lh_first;
         ip = q->ipqe_ip;          ip = q->ipqe_ip;
           if ((next + (ip->ip_hl << 2)) > IP_MAXPACKET) {
                   ipstat.ips_toolong++;
                   ip_freef(fp);
                   return (0);
           }
         m = dtom(q->ipqe_ip);          m = dtom(q->ipqe_ip);
         t = m->m_next;          t = m->m_next;
         m->m_next = 0;          m->m_next = 0;

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.43

CVSweb <webmaster@jp.NetBSD.org>