[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.226 and 1.231.2.1

version 1.226, 2006/05/08 18:50:12 version 1.231.2.1, 2006/10/22 06:07:28
Line 121  __KERNEL_RCSID(0, "$NetBSD$");
Line 121  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/kernel.h>  #include <sys/kernel.h>
 #include <sys/pool.h>  #include <sys/pool.h>
 #include <sys/sysctl.h>  #include <sys/sysctl.h>
   #include <sys/kauth.h>
   
 #include <net/if.h>  #include <net/if.h>
 #include <net/if_dl.h>  #include <net/if_dl.h>
Line 376  static struct ip_srcrt {
Line 377  static struct ip_srcrt {
 static void save_rte(u_char *, struct in_addr);  static void save_rte(u_char *, struct in_addr);
   
 #ifdef MBUFTRACE  #ifdef MBUFTRACE
 struct mowner ip_rx_mowner = { "internet", "rx" };  struct mowner ip_rx_mowner = MOWNER_INIT("internet", "rx");
 struct mowner ip_tx_mowner = { "internet", "tx" };  struct mowner ip_tx_mowner = MOWNER_INIT("internet", "tx");
 #endif  #endif
   
 /*  /*
Line 414  ip_init(void)
Line 415  ip_init(void)
         for (i = 0; i < IPREASS_NHASH; i++)          for (i = 0; i < IPREASS_NHASH; i++)
                 LIST_INIT(&ipq[i]);                  LIST_INIT(&ipq[i]);
   
         ip_id = time.tv_sec & 0xfffff;          ip_id = time_second & 0xfffff;
   
         ipintrq.ifq_maxlen = ipqmaxlen;          ipintrq.ifq_maxlen = ipqmaxlen;
         ip_nmbclusters_changed();          ip_nmbclusters_changed();
Line 445  ip_init(void)
Line 446  ip_init(void)
 #endif /* MBUFTRACE */  #endif /* MBUFTRACE */
 }  }
   
 struct  sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET };  struct  sockaddr_in ipaddr = {
           .sin_len = sizeof(ipaddr),
           .sin_family = AF_INET,
   };
 struct  route ipforward_rt;  struct  route ipforward_rt;
   
 /*  /*
Line 484  ip_input(struct mbuf *m)
Line 488  ip_input(struct mbuf *m)
         int downmatch;          int downmatch;
         int checkif;          int checkif;
         int srcrt = 0;          int srcrt = 0;
           int s;
         u_int hash;          u_int hash;
 #ifdef FAST_IPSEC  #ifdef FAST_IPSEC
         struct m_tag *mtag;          struct m_tag *mtag;
         struct tdb_ident *tdbi;          struct tdb_ident *tdbi;
         struct secpolicy *sp;          struct secpolicy *sp;
         int s, error;          int error;
 #endif /* FAST_IPSEC */  #endif /* FAST_IPSEC */
   
         MCLAIM(m, &ip_rx_mowner);          MCLAIM(m, &ip_rx_mowner);
Line 938  found:
Line 943  found:
                  */                   */
                 if (mff || ip->ip_off != htons(0)) {                  if (mff || ip->ip_off != htons(0)) {
                         ipstat.ips_fragments++;                          ipstat.ips_fragments++;
                           s = splvm();
                         ipqe = pool_get(&ipqent_pool, PR_NOWAIT);                          ipqe = pool_get(&ipqent_pool, PR_NOWAIT);
                           splx(s);
                         if (ipqe == NULL) {                          if (ipqe == NULL) {
                                 ipstat.ips_rcvmemdrop++;                                  ipstat.ips_rcvmemdrop++;
                                 IPQ_UNLOCK();                                  IPQ_UNLOCK();
Line 1051  ip_reass(struct ipqent *ipqe, struct ipq
Line 1058  ip_reass(struct ipqent *ipqe, struct ipq
         struct ip *ip;          struct ip *ip;
         struct mbuf *t;          struct mbuf *t;
         int hlen = ipqe->ipqe_ip->ip_hl << 2;          int hlen = ipqe->ipqe_ip->ip_hl << 2;
         int i, next;          int i, next, s;
   
         IPQ_LOCK_CHECK();          IPQ_LOCK_CHECK();
   
Line 1156  ip_reass(struct ipqent *ipqe, struct ipq
Line 1163  ip_reass(struct ipqent *ipqe, struct ipq
                 nq = TAILQ_NEXT(q, ipqe_q);                  nq = TAILQ_NEXT(q, ipqe_q);
                 m_freem(q->ipqe_m);                  m_freem(q->ipqe_m);
                 TAILQ_REMOVE(&fp->ipq_fragq, q, ipqe_q);                  TAILQ_REMOVE(&fp->ipq_fragq, q, ipqe_q);
                   s = splvm();
                 pool_put(&ipqent_pool, q);                  pool_put(&ipqent_pool, q);
                   splx(s);
                 fp->ipq_nfrags--;                  fp->ipq_nfrags--;
                 ip_nfrags--;                  ip_nfrags--;
         }          }
Line 1197  insert:
Line 1206  insert:
         m->m_next = 0;          m->m_next = 0;
         m_cat(m, t);          m_cat(m, t);
         nq = TAILQ_NEXT(q, ipqe_q);          nq = TAILQ_NEXT(q, ipqe_q);
           s = splvm();
         pool_put(&ipqent_pool, q);          pool_put(&ipqent_pool, q);
           splx(s);
         for (q = nq; q != NULL; q = nq) {          for (q = nq; q != NULL; q = nq) {
                 t = q->ipqe_m;                  t = q->ipqe_m;
                 nq = TAILQ_NEXT(q, ipqe_q);                  nq = TAILQ_NEXT(q, ipqe_q);
                   s = splvm();
                 pool_put(&ipqent_pool, q);                  pool_put(&ipqent_pool, q);
                   splx(s);
                 m_cat(m, t);                  m_cat(m, t);
         }          }
         ip_nfrags -= fp->ipq_nfrags;          ip_nfrags -= fp->ipq_nfrags;
Line 1236  dropfrag:
Line 1249  dropfrag:
         ip_nfrags--;          ip_nfrags--;
         ipstat.ips_fragdropped++;          ipstat.ips_fragdropped++;
         m_freem(m);          m_freem(m);
           s = splvm();
         pool_put(&ipqent_pool, ipqe);          pool_put(&ipqent_pool, ipqe);
           splx(s);
         return (0);          return (0);
 }  }
   
Line 1249  ip_freef(struct ipq *fp)
Line 1264  ip_freef(struct ipq *fp)
 {  {
         struct ipqent *q, *p;          struct ipqent *q, *p;
         u_int nfrags = 0;          u_int nfrags = 0;
           int s;
   
         IPQ_LOCK_CHECK();          IPQ_LOCK_CHECK();
   
Line 1257  ip_freef(struct ipq *fp)
Line 1273  ip_freef(struct ipq *fp)
                 m_freem(q->ipqe_m);                  m_freem(q->ipqe_m);
                 nfrags++;                  nfrags++;
                 TAILQ_REMOVE(&fp->ipq_fragq, q, ipqe_q);                  TAILQ_REMOVE(&fp->ipq_fragq, q, ipqe_q);
                   s = splvm();
                 pool_put(&ipqent_pool, q);                  pool_put(&ipqent_pool, q);
                   splx(s);
         }          }
   
         if (nfrags != fp->ipq_nfrags)          if (nfrags != fp->ipq_nfrags)
Line 1776  ip_srcroute(void)
Line 1794  ip_srcroute(void)
  * XXX should be deleted; last arg currently ignored.   * XXX should be deleted; last arg currently ignored.
  */   */
 void  void
 ip_stripoptions(struct mbuf *m, struct mbuf *mopt)  ip_stripoptions(struct mbuf *m, struct mbuf *mopt __unused)
 {  {
         int i;          int i;
         struct ip *ip = mtod(m, struct ip *);          struct ip *ip = mtod(m, struct ip *);
Line 2093  ip_savecontrol(struct inpcb *inp, struct
Line 2111  ip_savecontrol(struct inpcb *inp, struct
 }  }
   
 /*  /*
    * sysctl helper routine for net.inet.ip.forwsrcrt.
    */
   static int
   sysctl_net_inet_ip_forwsrcrt(SYSCTLFN_ARGS)
   {
           int error, tmp;
           struct sysctlnode node;
   
           node = *rnode;
           tmp = ip_forwsrcrt;
           node.sysctl_data = &tmp;
           error = sysctl_lookup(SYSCTLFN_CALL(&node));
           if (error || newp == NULL)
                   return (error);
   
           if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_FORWSRCRT,
               0, NULL, NULL, NULL))
                   return (EPERM);
   
           ip_forwsrcrt = tmp;
   
           return (0);
   }
   
   /*
  * sysctl helper routine for net.inet.ip.mtudisctimeout.  checks the   * sysctl helper routine for net.inet.ip.mtudisctimeout.  checks the
  * range of the new value and tweaks timers if it changes.   * range of the new value and tweaks timers if it changes.
  */   */
Line 2193  SYSCTL_SETUP(sysctl_net_inet_ip_setup, "
Line 2236  SYSCTL_SETUP(sysctl_net_inet_ip_setup, "
                        IPCTL_DEFMTU, CTL_EOL);                         IPCTL_DEFMTU, CTL_EOL);
 #endif /* IPCTL_DEFMTU */  #endif /* IPCTL_DEFMTU */
         sysctl_createv(clog, 0, NULL, NULL,          sysctl_createv(clog, 0, NULL, NULL,
                        CTLFLAG_PERMANENT|CTLFLAG_READONLY1,                         CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                        CTLTYPE_INT, "forwsrcrt",                         CTLTYPE_INT, "forwsrcrt",
                        SYSCTL_DESCR("Enable forwarding of source-routed "                         SYSCTL_DESCR("Enable forwarding of source-routed "
                                     "datagrams"),                                      "datagrams"),
                        NULL, 0, &ip_forwsrcrt, 0,                         sysctl_net_inet_ip_forwsrcrt, 0, &ip_forwsrcrt, 0,
                        CTL_NET, PF_INET, IPPROTO_IP,                         CTL_NET, PF_INET, IPPROTO_IP,
                        IPCTL_FORWSRCRT, CTL_EOL);                         IPCTL_FORWSRCRT, CTL_EOL);
         sysctl_createv(clog, 0, NULL, NULL,          sysctl_createv(clog, 0, NULL, NULL,

Legend:
Removed from v.1.226  
changed lines
  Added in v.1.231.2.1

CVSweb <webmaster@jp.NetBSD.org>