[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.93.2.1 and 1.114.4.7

version 1.93.2.1, 2000/11/20 18:10:29 version 1.114.4.7, 2002/02/26 20:57:03
Line 120 
Line 120 
 #include <sys/proc.h>  #include <sys/proc.h>
 #include <sys/pool.h>  #include <sys/pool.h>
   
 #include <uvm/uvm_extern.h>  #include <vm/vm.h>
   
 #include <sys/sysctl.h>  #include <sys/sysctl.h>
   
 #include <net/if.h>  #include <net/if.h>
Line 139 
Line 138 
 /* just for gif_ttl */  /* just for gif_ttl */
 #include <netinet/in_gif.h>  #include <netinet/in_gif.h>
 #include "gif.h"  #include "gif.h"
   #include <net/if_gre.h>
   #include "gre.h"
   
 #ifdef MROUTING  #ifdef MROUTING
 #include <netinet/ip_mroute.h>  #include <netinet/ip_mroute.h>
Line 147 
Line 148 
 #ifdef IPSEC  #ifdef IPSEC
 #include <netinet6/ipsec.h>  #include <netinet6/ipsec.h>
 #include <netkey/key.h>  #include <netkey/key.h>
   #include <netkey/key_debug.h>
 #endif  #endif
   
 #ifndef IPFORWARDING  #ifndef IPFORWARDING
Line 207  u_int16_t ip_id;
Line 209  u_int16_t ip_id;
   
 struct ipqhead ipq;  struct ipqhead ipq;
 int     ipq_locked;  int     ipq_locked;
   int     ip_nfragpackets = 0;
   int     ip_maxfragpackets = 200;
   
 static __inline int ipq_lock_try __P((void));  static __inline int ipq_lock_try __P((void));
 static __inline void ipq_unlock __P((void));  static __inline void ipq_unlock __P((void));
Line 459  ip_input(struct mbuf *m)
Line 463  ip_input(struct mbuf *m)
 #endif  #endif
   
 #ifdef PFIL_HOOKS  #ifdef PFIL_HOOKS
   #ifdef IPSEC
           /*
            * let ipfilter look at packet on the wire,
            * not the decapsulated packet.
            */
           if (ipsec_gethist(m, NULL))
                   goto nofilt;
   #endif
         /*          /*
          * Run through list of hooks for input packets.  If there are any           * Run through list of hooks for input packets.  If there are any
          * filters which require that additional packets in the flow are           * filters which require that additional packets in the flow are
Line 479  ip_input(struct mbuf *m)
Line 491  ip_input(struct mbuf *m)
                                 return;                                  return;
                         ip = mtod(m, struct ip *);                          ip = mtod(m, struct ip *);
                 }                  }
   #ifdef IPSEC
   nofilt:;
   #endif
 #endif /* PFIL_HOOKS */  #endif /* PFIL_HOOKS */
   
         /*          /*
Line 687  found:
Line 702  found:
                 IPQ_UNLOCK();                  IPQ_UNLOCK();
         }          }
   
   #ifdef IPSEC
           /*
            * enforce IPsec policy checking if we are seeing last header.
            * note that we do not visit this with protocols with pcb layer
            * code - like udp/tcp/raw ip.
            */
           if ((inetsw[ip_protox[ip->ip_p]].pr_flags & PR_LASTHDR) != 0 &&
               ipsec4_in_reject(m, NULL)) {
                   ipsecstat.in_polvio++;
                   goto bad;
           }
   #endif
   
         /*          /*
          * Switch out to protocol's input routine.           * Switch out to protocol's input routine.
          */           */
Line 735  ip_reass(ipqe, fp)
Line 763  ip_reass(ipqe, fp)
          * If first fragment to arrive, create a reassembly queue.           * If first fragment to arrive, create a reassembly queue.
          */           */
         if (fp == 0) {          if (fp == 0) {
                   /*
                    * Enforce upper bound on number of fragmented packets
                    * for which we attempt reassembly;
                    * If maxfrag is 0, never accept fragments.
                    * If maxfrag is -1, accept all fragments without limitation.
                    */
                   if (ip_maxfragpackets < 0)
                           ;
                   else if (ip_nfragpackets >= ip_maxfragpackets)
                           goto dropfrag;
                   ip_nfragpackets++;
                 MALLOC(fp, struct ipq *, sizeof (struct ipq),                  MALLOC(fp, struct ipq *, sizeof (struct ipq),
                     M_FTABLE, M_NOWAIT);                      M_FTABLE, M_NOWAIT);
                 if (fp == NULL)                  if (fp == NULL)
Line 850  insert:
Line 889  insert:
         ip->ip_dst = fp->ipq_dst;          ip->ip_dst = fp->ipq_dst;
         LIST_REMOVE(fp, ipq_q);          LIST_REMOVE(fp, ipq_q);
         FREE(fp, M_FTABLE);          FREE(fp, M_FTABLE);
           ip_nfragpackets--;
         m->m_len += (ip->ip_hl << 2);          m->m_len += (ip->ip_hl << 2);
         m->m_data -= (ip->ip_hl << 2);          m->m_data -= (ip->ip_hl << 2);
         /* some debugging cruft by sklower, below, will go away soon */          /* some debugging cruft by sklower, below, will go away soon */
Line 888  ip_freef(fp)
Line 928  ip_freef(fp)
         }          }
         LIST_REMOVE(fp, ipq_q);          LIST_REMOVE(fp, ipq_q);
         FREE(fp, M_FTABLE);          FREE(fp, M_FTABLE);
           ip_nfragpackets--;
 }  }
   
 /*  /*
Line 909  ip_slowtimo()
Line 950  ip_slowtimo()
                         ip_freef(fp);                          ip_freef(fp);
                 }                  }
         }          }
           /*
            * If we are over the maximum number of fragments
            * (due to the limit being lowered), drain off
            * enough to get down to the new limit.
            */
           if (ip_maxfragpackets < 0)
                   ;
           else {
                   while (ip_nfragpackets > ip_maxfragpackets && ipq.lh_first)
                           ip_freef(ipq.lh_first);
           }
         IPQ_UNLOCK();          IPQ_UNLOCK();
 #ifdef GATEWAY  #ifdef GATEWAY
         ipflow_slowtimo();          ipflow_slowtimo();
Line 1439  ip_forward(m, srcrt)
Line 1491  ip_forward(m, srcrt)
   
 #ifdef IPSEC  #ifdef IPSEC
         /* Don't lookup socket in forwading case */          /* Don't lookup socket in forwading case */
         ipsec_setsocket(m, NULL);          (void)ipsec_setsocket(m, NULL);
 #endif  #endif
         error = ip_output(m, (struct mbuf *)0, &ipforward_rt,          error = ip_output(m, (struct mbuf *)0, &ipforward_rt,
             (IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)), 0);              (IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)), 0);
Line 1720  ip_sysctl(name, namelen, oldp, oldlenp, 
Line 1772  ip_sysctl(name, namelen, oldp, oldlenp, 
                                   &ip_gif_ttl));                                    &ip_gif_ttl));
 #endif  #endif
   
   #if NGRE > 0
           case IPCTL_GRE_TTL:
                   return(sysctl_int(oldp, oldlenp, newp, newlen,
                                     &ip_gre_ttl));
   #endif
   
 #ifndef IPNOPRIVPORTS  #ifndef IPNOPRIVPORTS
         case IPCTL_LOWPORTMIN:          case IPCTL_LOWPORTMIN:
                 old = lowportmin;                  old = lowportmin;
Line 1745  ip_sysctl(name, namelen, oldp, oldlenp, 
Line 1803  ip_sysctl(name, namelen, oldp, oldlenp, 
                 return (error);                  return (error);
 #endif  #endif
   
           case IPCTL_MAXFRAGPACKETS:
                   return (sysctl_int(oldp, oldlenp, newp, newlen,
                       &ip_maxfragpackets));
   
         default:          default:
                 return (EOPNOTSUPP);                  return (EOPNOTSUPP);
         }          }

Legend:
Removed from v.1.93.2.1  
changed lines
  Added in v.1.114.4.7

CVSweb <webmaster@jp.NetBSD.org>