[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.245.2.4 and 1.264

version 1.245.2.4, 2007/08/20 21:27:59 version 1.264, 2008/04/07 06:31:28
Line 230  u_long in_multihash;    /* size of hash 
Line 230  u_long in_multihash;    /* size of hash 
 int     in_multientries;                        /* total number of addrs */  int     in_multientries;                        /* total number of addrs */
 struct  in_multihashhead *in_multihashtbl;  struct  in_multihashhead *in_multihashtbl;
 struct  ifqueue ipintrq;  struct  ifqueue ipintrq;
 struct  ipstat  ipstat;  uint64_t ipstat[IP_NSTATS];
 uint16_t ip_id;  uint16_t ip_id;
   
 #ifdef PFIL_HOOKS  #ifdef PFIL_HOOKS
Line 417  ip_init(void)
Line 417  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_initid();
         ip_id = time_second & 0xfffff;          ip_id = time_second & 0xfffff;
   
         ipintrq.ifq_maxlen = ipqmaxlen;          ipintrq.ifq_maxlen = ipqmaxlen;
Line 469  ipintr(void)
Line 470  ipintr(void)
                 splx(s);                  splx(s);
                 if (m == 0)                  if (m == 0)
                         return;                          return;
                 MCLAIM(m, &ip_rx_mowner);  
                 ip_input(m);                  ip_input(m);
         }          }
 }  }
Line 511  ip_input(struct mbuf *m)
Line 511  ip_input(struct mbuf *m)
          */           */
         if (TAILQ_FIRST(&in_ifaddrhead) == 0)          if (TAILQ_FIRST(&in_ifaddrhead) == 0)
                 goto bad;                  goto bad;
         ipstat.ips_total++;          ipstat[IP_STAT_TOTAL]++;
         /*          /*
          * If the IP header is not aligned, slurp it up into a new           * If the IP header is not aligned, slurp it up into a new
          * mbuf with space for link headers, in the event we forward           * mbuf with space for link headers, in the event we forward
Line 522  ip_input(struct mbuf *m)
Line 522  ip_input(struct mbuf *m)
                 if ((m = m_copyup(m, sizeof(struct ip),                  if ((m = m_copyup(m, sizeof(struct ip),
                                   (max_linkhdr + 3) & ~3)) == NULL) {                                    (max_linkhdr + 3) & ~3)) == NULL) {
                         /* XXXJRT new stat, please */                          /* XXXJRT new stat, please */
                         ipstat.ips_toosmall++;                          ipstat[IP_STAT_TOOSMALL]++;
                         return;                          return;
                 }                  }
         } else if (__predict_false(m->m_len < sizeof (struct ip))) {          } else if (__predict_false(m->m_len < sizeof (struct ip))) {
                 if ((m = m_pullup(m, sizeof (struct ip))) == NULL) {                  if ((m = m_pullup(m, sizeof (struct ip))) == NULL) {
                         ipstat.ips_toosmall++;                          ipstat[IP_STAT_TOOSMALL]++;
                         return;                          return;
                 }                  }
         }          }
         ip = mtod(m, struct ip *);          ip = mtod(m, struct ip *);
         if (ip->ip_v != IPVERSION) {          if (ip->ip_v != IPVERSION) {
                 ipstat.ips_badvers++;                  ipstat[IP_STAT_BADVERS]++;
                 goto bad;                  goto bad;
         }          }
         hlen = ip->ip_hl << 2;          hlen = ip->ip_hl << 2;
         if (hlen < sizeof(struct ip)) { /* minimum header length */          if (hlen < sizeof(struct ip)) { /* minimum header length */
                 ipstat.ips_badhlen++;                  ipstat[IP_STAT_BADHLEN]++;
                 goto bad;                  goto bad;
         }          }
         if (hlen > m->m_len) {          if (hlen > m->m_len) {
                 if ((m = m_pullup(m, hlen)) == 0) {                  if ((m = m_pullup(m, hlen)) == 0) {
                         ipstat.ips_badhlen++;                          ipstat[IP_STAT_BADHLEN]++;
                         return;                          return;
                 }                  }
                 ip = mtod(m, struct ip *);                  ip = mtod(m, struct ip *);
Line 554  ip_input(struct mbuf *m)
Line 554  ip_input(struct mbuf *m)
          * not allowed.           * not allowed.
          */           */
         if (IN_MULTICAST(ip->ip_src.s_addr)) {          if (IN_MULTICAST(ip->ip_src.s_addr)) {
                 ipstat.ips_badaddr++;                  ipstat[IP_STAT_BADADDR]++;
                 goto bad;                  goto bad;
         }          }
   
Line 562  ip_input(struct mbuf *m)
Line 562  ip_input(struct mbuf *m)
         if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||          if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||
             (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) {              (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) {
                 if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) {                  if ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) {
                         ipstat.ips_badaddr++;                          ipstat[IP_STAT_BADADDR]++;
                         goto bad;                          goto bad;
                 }                  }
         }          }
Line 600  ip_input(struct mbuf *m)
Line 600  ip_input(struct mbuf *m)
          * Check for additional length bogosity           * Check for additional length bogosity
          */           */
         if (len < hlen) {          if (len < hlen) {
                 ipstat.ips_badlen++;                  ipstat[IP_STAT_BADLEN]++;
                 goto bad;                  goto bad;
         }          }
   
Line 611  ip_input(struct mbuf *m)
Line 611  ip_input(struct mbuf *m)
          * Drop packet if shorter than we expect.           * Drop packet if shorter than we expect.
          */           */
         if (m->m_pkthdr.len < len) {          if (m->m_pkthdr.len < len) {
                 ipstat.ips_tooshort++;                  ipstat[IP_STAT_TOOSHORT]++;
                 goto bad;                  goto bad;
         }          }
         if (m->m_pkthdr.len > len) {          if (m->m_pkthdr.len > len) {
Line 780  ip_input(struct mbuf *m)
Line 780  ip_input(struct mbuf *m)
                          * ip_output().)                           * ip_output().)
                          */                           */
                         if (ip_mforward(m, m->m_pkthdr.rcvif) != 0) {                          if (ip_mforward(m, m->m_pkthdr.rcvif) != 0) {
                                 ipstat.ips_cantforward++;                                  ipstat[IP_STAT_CANTFORWARD]++;
                                 m_freem(m);                                  m_freem(m);
                                 return;                                  return;
                         }                          }
Line 792  ip_input(struct mbuf *m)
Line 792  ip_input(struct mbuf *m)
                          */                           */
                         if (ip->ip_p == IPPROTO_IGMP)                          if (ip->ip_p == IPPROTO_IGMP)
                                 goto ours;                                  goto ours;
                         ipstat.ips_forward++;                          ipstat[IP_STAT_CANTFORWARD]++;
                 }                  }
 #endif  #endif
                 /*                  /*
Line 801  ip_input(struct mbuf *m)
Line 801  ip_input(struct mbuf *m)
                  */                   */
                 IN_LOOKUP_MULTI(ip->ip_dst, m->m_pkthdr.rcvif, inm);                  IN_LOOKUP_MULTI(ip->ip_dst, m->m_pkthdr.rcvif, inm);
                 if (inm == NULL) {                  if (inm == NULL) {
                         ipstat.ips_cantforward++;                          ipstat[IP_STAT_CANTFORWARD]++;
                         m_freem(m);                          m_freem(m);
                         return;                          return;
                 }                  }
Line 815  ip_input(struct mbuf *m)
Line 815  ip_input(struct mbuf *m)
          * Not for us; forward if possible and desirable.           * Not for us; forward if possible and desirable.
          */           */
         if (ipforwarding == 0) {          if (ipforwarding == 0) {
                 ipstat.ips_cantforward++;                  ipstat[IP_STAT_CANTFORWARD]++;
                 m_freem(m);                  m_freem(m);
         } else {          } else {
                 /*                  /*
Line 826  ip_input(struct mbuf *m)
Line 826  ip_input(struct mbuf *m)
                  */                   */
                 if (downmatch) {                  if (downmatch) {
                         icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);                          icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0);
                         ipstat.ips_cantforward++;                          ipstat[IP_STAT_CANTFORWARD]++;
                         return;                          return;
                 }                  }
 #ifdef IPSEC  #ifdef IPSEC
Line 859  ip_input(struct mbuf *m)
Line 859  ip_input(struct mbuf *m)
                 KEY_FREESP(&sp);                  KEY_FREESP(&sp);
                 splx(s);                  splx(s);
                 if (error) {                  if (error) {
                         ipstat.ips_cantforward++;                          ipstat[IP_STAT_CANTFORWARD]++;
                         goto bad;                          goto bad;
                 }                  }
   
Line 897  ours:
Line 897  ours:
          * 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 & ~htons(IP_DF|IP_RF)) {          if (ip->ip_off & ~htons(IP_DF|IP_RF)) {
                   uint16_t off;
                   /*
                    * Prevent TCP blind data attacks by not allowing non-initial
                    * fragments to start at less than 68 bytes (minimal fragment
                    * size) and making sure the first fragment is at least 68
                    * bytes.
                    */
                   off = (ntohs(ip->ip_off) & IP_OFFMASK) << 3;
                   if ((off > 0 ? off + hlen : len) < IP_MINFRAGSIZE - 1) {
                           ipstat[IP_STAT_BADFRAGS]++;
                           goto bad;
                   }
                 /*                  /*
                  * Look for queue of fragments                   * Look for queue of fragments
                  * of this datagram.                   * of this datagram.
Line 908  ours:
Line 919  ours:
                         if (ip->ip_id == fp->ipq_id &&                          if (ip->ip_id == fp->ipq_id &&
                             in_hosteq(ip->ip_src, fp->ipq_src) &&                              in_hosteq(ip->ip_src, fp->ipq_src) &&
                             in_hosteq(ip->ip_dst, fp->ipq_dst) &&                              in_hosteq(ip->ip_dst, fp->ipq_dst) &&
                             ip->ip_p == fp->ipq_p)                              ip->ip_p == fp->ipq_p) {
                                   /*
                                    * Make sure the TOS is matches previous
                                    * fragments.
                                    */
                                   if (ip->ip_tos != fp->ipq_tos) {
                                           ipstat[IP_STAT_BADFRAGS]++;
                                           goto bad;
                                   }
                                 goto found;                                  goto found;
                           }
                 }                  }
                 fp = 0;                  fp = 0;
 found:  found:
Line 929  found:
Line 948  found:
                          */                           */
                         if (ntohs(ip->ip_len) == 0 ||                          if (ntohs(ip->ip_len) == 0 ||
                             (ntohs(ip->ip_len) & 0x7) != 0) {                              (ntohs(ip->ip_len) & 0x7) != 0) {
                                 ipstat.ips_badfrags++;                                  ipstat[IP_STAT_BADFRAGS]++;
                                 IPQ_UNLOCK();                                  IPQ_UNLOCK();
                                 goto bad;                                  goto bad;
                         }                          }
Line 942  found:
Line 961  found:
                  * attempt reassembly; if it succeeds, proceed.                   * attempt reassembly; if it succeeds, proceed.
                  */                   */
                 if (mff || ip->ip_off != htons(0)) {                  if (mff || ip->ip_off != htons(0)) {
                         ipstat.ips_fragments++;                          ipstat[IP_STAT_FRAGMENTS]++;
                         s = splvm();                          s = splvm();
                         ipqe = pool_get(&ipqent_pool, PR_NOWAIT);                          ipqe = pool_get(&ipqent_pool, PR_NOWAIT);
                         splx(s);                          splx(s);
                         if (ipqe == NULL) {                          if (ipqe == NULL) {
                                 ipstat.ips_rcvmemdrop++;                                  ipstat[IP_STAT_RCVMEMDROP]++;
                                 IPQ_UNLOCK();                                  IPQ_UNLOCK();
                                 goto bad;                                  goto bad;
                         }                          }
Line 959  found:
Line 978  found:
                                 IPQ_UNLOCK();                                  IPQ_UNLOCK();
                                 return;                                  return;
                         }                          }
                         ipstat.ips_reassembled++;                          ipstat[IP_STAT_REASSEMBLED]++;
                         ip = mtod(m, struct ip *);                          ip = mtod(m, struct ip *);
                         hlen = ip->ip_hl << 2;                          hlen = ip->ip_hl << 2;
                         ip->ip_len = htons(ntohs(ip->ip_len) + hlen);                          ip->ip_len = htons(ntohs(ip->ip_len) + hlen);
Line 1013  found:
Line 1032  found:
                         /* XXX error stat??? */                          /* XXX error stat??? */
                         error = EINVAL;                          error = EINVAL;
 DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/  DPRINTF(("ip_input: no SP, packet discarded\n"));/*XXX*/
                         goto bad;  
                 }                  }
                 splx(s);                  splx(s);
                 if (error)                  if (error)
Line 1028  DPRINTF(("ip_input: no SP, packet discar
Line 1046  DPRINTF(("ip_input: no SP, packet discar
         if (ia && ip)          if (ia && ip)
                 ia->ia_ifa.ifa_data.ifad_inbytes += ntohs(ip->ip_len);                  ia->ia_ifa.ifa_data.ifad_inbytes += ntohs(ip->ip_len);
 #endif  #endif
         ipstat.ips_delivered++;          ipstat[IP_STAT_DELIVERED]++;
     {      {
         int off = hlen, nh = ip->ip_p;          int off = hlen, nh = ip->ip_p;
   
Line 1040  bad:
Line 1058  bad:
         return;          return;
   
 badcsum:  badcsum:
         ipstat.ips_badsum++;          ipstat[IP_STAT_BADSUM]++;
         m_freem(m);          m_freem(m);
 }  }
   
Line 1107  ip_reass(struct ipqent *ipqe, struct ipq
Line 1125  ip_reass(struct ipqent *ipqe, struct ipq
                 fp->ipq_ttl = IPFRAGTTL;                  fp->ipq_ttl = IPFRAGTTL;
                 fp->ipq_p = ipqe->ipqe_ip->ip_p;                  fp->ipq_p = ipqe->ipqe_ip->ip_p;
                 fp->ipq_id = ipqe->ipqe_ip->ip_id;                  fp->ipq_id = ipqe->ipqe_ip->ip_id;
                   fp->ipq_tos = ipqe->ipqe_ip->ip_tos;
                 TAILQ_INIT(&fp->ipq_fragq);                  TAILQ_INIT(&fp->ipq_fragq);
                 fp->ipq_src = ipqe->ipqe_ip->ip_src;                  fp->ipq_src = ipqe->ipqe_ip->ip_src;
                 fp->ipq_dst = ipqe->ipqe_ip->ip_dst;                  fp->ipq_dst = ipqe->ipqe_ip->ip_dst;
Line 1197  insert:
Line 1216  insert:
         q = TAILQ_FIRST(&fp->ipq_fragq);          q = TAILQ_FIRST(&fp->ipq_fragq);
         ip = q->ipqe_ip;          ip = q->ipqe_ip;
         if ((next + (ip->ip_hl << 2)) > IP_MAXPACKET) {          if ((next + (ip->ip_hl << 2)) > IP_MAXPACKET) {
                 ipstat.ips_toolong++;                  ipstat[IP_STAT_TOOLONG]++;
                 ip_freef(fp);                  ip_freef(fp);
                 return (0);                  return (0);
         }          }
Line 1247  dropfrag:
Line 1266  dropfrag:
         if (fp != 0)          if (fp != 0)
                 fp->ipq_nfrags--;                  fp->ipq_nfrags--;
         ip_nfrags--;          ip_nfrags--;
         ipstat.ips_fragdropped++;          ipstat[IP_STAT_FRAGDROPPED]++;
         m_freem(m);          m_freem(m);
         s = splvm();          s = splvm();
         pool_put(&ipqent_pool, ipqe);          pool_put(&ipqent_pool, ipqe);
Line 1314  ip_reass_ttl_decr(u_int ticks)
Line 1333  ip_reass_ttl_decr(u_int ticks)
                                        0 : fp->ipq_ttl - ticks);                                         0 : fp->ipq_ttl - ticks);
                         nfp = LIST_NEXT(fp, ipq_q);                          nfp = LIST_NEXT(fp, ipq_q);
                         if (fp->ipq_ttl == 0) {                          if (fp->ipq_ttl == 0) {
                                 ipstat.ips_fragtimeout++;                                  ipstat[IP_STAT_FRAGTIMEOUT]++;
                                 ip_freef(fp);                                  ip_freef(fp);
                         } else {                          } else {
                                 nfrags += fp->ipq_nfrags;                                  nfrags += fp->ipq_nfrags;
Line 1661  ip_dooptions(struct mbuf *m)
Line 1680  ip_dooptions(struct mbuf *m)
         return (0);          return (0);
 bad:  bad:
         icmp_error(m, type, code, 0, 0);          icmp_error(m, type, code, 0, 0);
         ipstat.ips_badoptions++;          ipstat[IP_STAT_BADOPTIONS]++;
         return (1);          return (1);
 }  }
   
Line 1777  ip_srcroute(void)
Line 1796  ip_srcroute(void)
         return (m);          return (m);
 }  }
   
 /*  
  * Strip out IP options, at higher  
  * level protocol in the kernel.  
  * Second argument is buffer to which options  
  * will be moved, and return value is their length.  
  * XXX should be deleted; last arg currently ignored.  
  */  
 void  
 ip_stripoptions(struct mbuf *m, struct mbuf *mopt)  
 {  
         int i;  
         struct ip *ip = mtod(m, struct ip *);  
         void *opts;  
         int olen;  
   
         olen = (ip->ip_hl << 2) - sizeof (struct ip);  
         opts = (void *)(ip + 1);  
         i = m->m_len - (sizeof (struct ip) + olen);  
         memmove(opts, (char *)opts + olen, (unsigned)i);  
         m->m_len -= olen;  
         if (m->m_flags & M_PKTHDR)  
                 m->m_pkthdr.len -= olen;  
         ip->ip_len = htons(ntohs(ip->ip_len) - olen);  
         ip->ip_hl = sizeof (struct ip) >> 2;  
 }  
   
 const int inetctlerrmap[PRC_NCMDS] = {  const int inetctlerrmap[PRC_NCMDS] = {
         0,              0,              0,              0,          [PRC_MSGSIZE] = EMSGSIZE,
         0,              EMSGSIZE,       EHOSTDOWN,      EHOSTUNREACH,          [PRC_HOSTDEAD] = EHOSTDOWN,
         EHOSTUNREACH,   EHOSTUNREACH,   ECONNREFUSED,   ECONNREFUSED,          [PRC_HOSTUNREACH] = EHOSTUNREACH,
         EMSGSIZE,       EHOSTUNREACH,   0,              0,          [PRC_UNREACH_NET] = EHOSTUNREACH,
         0,              0,              0,              0,          [PRC_UNREACH_HOST] = EHOSTUNREACH,
         ENOPROTOOPT          [PRC_UNREACH_PROTOCOL] = ECONNREFUSED,
           [PRC_UNREACH_PORT] = ECONNREFUSED,
           [PRC_UNREACH_SRCFAIL] = EHOSTUNREACH,
           [PRC_PARAMPROB] = ENOPROTOOPT,
 };  };
   
 /*  /*
Line 1857  ip_forward(struct mbuf *m, int srcrt)
Line 1853  ip_forward(struct mbuf *m, int srcrt)
         }          }
 #endif  #endif
         if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) {          if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) {
                 ipstat.ips_cantforward++;                  ipstat[IP_STAT_CANTFORWARD]++;
                 m_freem(m);                  m_freem(m);
                 return;                  return;
         }          }
Line 1921  ip_forward(struct mbuf *m, int srcrt)
Line 1917  ip_forward(struct mbuf *m, int srcrt)
             (struct ip_moptions *)NULL, (struct socket *)NULL);              (struct ip_moptions *)NULL, (struct socket *)NULL);
   
         if (error)          if (error)
                 ipstat.ips_cantforward++;                  ipstat[IP_STAT_CANTFORWARD]++;
         else {          else {
                 ipstat.ips_forward++;                  ipstat[IP_STAT_FORWARD]++;
                 if (type)                  if (type)
                         ipstat.ips_redirectsent++;                          ipstat[IP_STAT_REDIRECTSENT]++;
                 else {                  else {
                         if (mcopy) {                          if (mcopy) {
 #ifdef GATEWAY  #ifdef GATEWAY
Line 1958  ip_forward(struct mbuf *m, int srcrt)
Line 1954  ip_forward(struct mbuf *m, int srcrt)
         case EMSGSIZE:          case EMSGSIZE:
                 type = ICMP_UNREACH;                  type = ICMP_UNREACH;
                 code = ICMP_UNREACH_NEEDFRAG;                  code = ICMP_UNREACH_NEEDFRAG;
 #if !defined(IPSEC) && !defined(FAST_IPSEC)  
                 if (ipforward_rt.ro_rt != NULL)                  if ((rt = rtcache_validate(&ipforward_rt)) != NULL) {
                         destmtu = ipforward_rt.ro_rt->rt_ifp->if_mtu;  
 #else  #if defined(IPSEC) || defined(FAST_IPSEC)
                 /*                          /*
                  * If the packet is routed over IPsec tunnel, tell the                           * If the packet is routed over IPsec tunnel, tell the
                  * originator the tunnel MTU.                           * originator the tunnel MTU.
                  *      tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz                           *      tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz
                  * XXX quickhack!!!                           * XXX quickhack!!!
                  */                           */
                 if (ipforward_rt.ro_rt != NULL) {  
                         struct secpolicy *sp;                          struct secpolicy *sp;
                         int ipsecerror;                          int ipsecerror;
                         size_t ipsechdr;                          size_t ipsechdr;
Line 1977  ip_forward(struct mbuf *m, int srcrt)
Line 1973  ip_forward(struct mbuf *m, int srcrt)
                         sp = ipsec4_getpolicybyaddr(mcopy,                          sp = ipsec4_getpolicybyaddr(mcopy,
                             IPSEC_DIR_OUTBOUND, IP_FORWARDING,                              IPSEC_DIR_OUTBOUND, IP_FORWARDING,
                             &ipsecerror);                              &ipsecerror);
   #endif
   
                         if (sp == NULL)                          destmtu = rt->rt_ifp->if_mtu;
                                 destmtu = ipforward_rt.ro_rt->rt_ifp->if_mtu;  #if defined(IPSEC) || defined(FAST_IPSEC)
                         else {                          if (sp != NULL) {
                                 /* count IPsec header size */                                  /* count IPsec header size */
                                 ipsechdr = ipsec4_hdrsiz(mcopy,                                  ipsechdr = ipsec4_hdrsiz(mcopy,
                                     IPSEC_DIR_OUTBOUND, NULL);                                      IPSEC_DIR_OUTBOUND, NULL);
Line 1994  ip_forward(struct mbuf *m, int srcrt)
Line 1991  ip_forward(struct mbuf *m, int srcrt)
                                  && sp->req->sav != NULL                                   && sp->req->sav != NULL
                                  && sp->req->sav->sah != NULL) {                                   && sp->req->sav->sah != NULL) {
                                         ro = &sp->req->sav->sah->sa_route;                                          ro = &sp->req->sav->sah->sa_route;
                                         if (ro->ro_rt && ro->ro_rt->rt_ifp) {                                          if (rt && rt->rt_ifp) {
                                                 destmtu =                                                  destmtu =
                                                     ro->ro_rt->rt_rmx.rmx_mtu ?                                                      rt->rt_rmx.rmx_mtu ?
                                                     ro->ro_rt->rt_rmx.rmx_mtu :                                                      rt->rt_rmx.rmx_mtu :
                                                     ro->ro_rt->rt_ifp->if_mtu;                                                      rt->rt_ifp->if_mtu;
                                                 destmtu -= ipsechdr;                                                  destmtu -= ipsechdr;
                                         }                                          }
                                 }                                  }
Line 2009  ip_forward(struct mbuf *m, int srcrt)
Line 2006  ip_forward(struct mbuf *m, int srcrt)
                                 KEY_FREESP(&sp);                                  KEY_FREESP(&sp);
 #endif  #endif
                         }                          }
   #endif /*defined(IPSEC) || defined(FAST_IPSEC)*/
                 }                  }
 #endif /*IPSEC*/                  ipstat[IP_STAT_CANTFRAG]++;
                 ipstat.ips_cantfrag++;  
                 break;                  break;
   
         case ENOBUFS:          case ENOBUFS:
Line 2079  ip_savecontrol(struct inpcb *inp, struct
Line 2076  ip_savecontrol(struct inpcb *inp, struct
         if (inp->inp_flags & INP_RECVIF) {          if (inp->inp_flags & INP_RECVIF) {
                 struct sockaddr_dl sdl;                  struct sockaddr_dl sdl;
   
                 sockaddr_dl_init(&sdl, (m->m_pkthdr.rcvif != NULL) ?                  sockaddr_dl_init(&sdl, sizeof(sdl),
                     m->m_pkthdr.rcvif->if_index : 0, 0, NULL, 0, NULL, 0);                      (m->m_pkthdr.rcvif != NULL)
                           ?  m->m_pkthdr.rcvif->if_index
                           : 0,
                           0, NULL, 0, NULL, 0);
                 *mp = sbcreatecontrol(&sdl, sdl.sdl_len, IP_RECVIF, IPPROTO_IP);                  *mp = sbcreatecontrol(&sdl, sdl.sdl_len, IP_RECVIF, IPPROTO_IP);
                 if (*mp)                  if (*mp)
                         mp = &(*mp)->m_next;                          mp = &(*mp)->m_next;
Line 2391  SYSCTL_SETUP(sysctl_net_inet_ip_setup, "
Line 2391  SYSCTL_SETUP(sysctl_net_inet_ip_setup, "
                        CTLFLAG_PERMANENT,                         CTLFLAG_PERMANENT,
                        CTLTYPE_STRUCT, "stats",                         CTLTYPE_STRUCT, "stats",
                        SYSCTL_DESCR("IP statistics"),                         SYSCTL_DESCR("IP statistics"),
                        NULL, 0, &ipstat, sizeof(ipstat),                         NULL, 0, ipstat, sizeof(ipstat),
                        CTL_NET, PF_INET, IPPROTO_IP, IPCTL_STATS,                         CTL_NET, PF_INET, IPPROTO_IP, IPCTL_STATS,
                        CTL_EOL);                         CTL_EOL);
 }  }

Legend:
Removed from v.1.245.2.4  
changed lines
  Added in v.1.264

CVSweb <webmaster@jp.NetBSD.org>