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

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

Diff for /src/sys/netinet6/ip6_input.c between version 1.94.2.5 and 1.99

version 1.94.2.5, 2007/05/17 13:41:51 version 1.99, 2007/03/23 14:24:22
Line 237  ip6intr()
Line 237  ip6intr()
         }          }
 }  }
   
 extern struct   route ip6_forward_rt;  extern struct   route_in6 ip6_forward_rt;
   
 void  void
 ip6_input(struct mbuf *m)  ip6_input(struct mbuf *m)
 {  {
         struct ip6_hdr *ip6;          struct ip6_hdr *ip6;
         int hit, off = sizeof(struct ip6_hdr), nest;          int off = sizeof(struct ip6_hdr), nest;
         u_int32_t plen;          u_int32_t plen;
         u_int32_t rtalert = ~0;          u_int32_t rtalert = ~0;
         int nxt, ours = 0, rh_present = 0;          int nxt, ours = 0;
         struct ifnet *deliverifp = NULL;          struct ifnet *deliverifp = NULL;
         int srcrt = 0;          int srcrt = 0;
         const struct rtentry *rt;  
         union {  
                 struct sockaddr         dst;  
                 struct sockaddr_in6     dst6;  
         } u;  
 #ifdef FAST_IPSEC  #ifdef FAST_IPSEC
         struct m_tag *mtag;          struct m_tag *mtag;
         struct tdb_ident *tdbi;          struct tdb_ident *tdbi;
Line 479  ip6_input(struct mbuf *m)
Line 474  ip6_input(struct mbuf *m)
                 goto hbhcheck;                  goto hbhcheck;
         }          }
   
         sockaddr_in6_init(&u.dst6, &ip6->ip6_dst, 0, 0, 0);  
   
         /*          /*
          *  Unicast check           *  Unicast check
          */           */
         rt = rtcache_lookup2(&ip6_forward_rt, &u.dst, 1, &hit);          if (!IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,
         if (hit)              &((const struct sockaddr_in6 *)rtcache_getdst((const struct route *)&ip6_forward_rt))->sin6_addr))
                 ip6stat.ip6s_forward_cachehit++;                  rtcache_free((struct route *)&ip6_forward_rt);
         else          else
                   rtcache_check((struct route *)&ip6_forward_rt);
           if (ip6_forward_rt.ro_rt != NULL) {
                   /* XXX Revalidated route is accounted wrongly. */
                   ip6stat.ip6s_forward_cachehit++;
           } else {
                   struct sockaddr_in6 *dst6;
   
                 ip6stat.ip6s_forward_cachemiss++;                  ip6stat.ip6s_forward_cachemiss++;
   
                   dst6 = &ip6_forward_rt.ro_dst;
                   memset(dst6, 0, sizeof(*dst6));
                   dst6->sin6_len = sizeof(struct sockaddr_in6);
                   dst6->sin6_family = AF_INET6;
                   dst6->sin6_addr = ip6->ip6_dst;
   
                   rtcache_init((struct route *)&ip6_forward_rt);
           }
   
 #define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key))  #define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key))
   
         /*          /*
Line 501  ip6_input(struct mbuf *m)
Line 510  ip6_input(struct mbuf *m)
          * But we think it's even useful in some situations, e.g. when using           * But we think it's even useful in some situations, e.g. when using
          * a special daemon which wants to intercept the packet.           * a special daemon which wants to intercept the packet.
          */           */
         if (rt != NULL &&          if (ip6_forward_rt.ro_rt != NULL &&
             (rt->rt_flags & (RTF_HOST|RTF_GATEWAY)) == RTF_HOST &&              (ip6_forward_rt.ro_rt->rt_flags &
             !(rt->rt_flags & RTF_CLONED) &&               (RTF_HOST|RTF_GATEWAY)) == RTF_HOST &&
               !(ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) &&
 #if 0  #if 0
             /*              /*
              * The check below is redundant since the comparison of               * The check below is redundant since the comparison of
              * the destination and the key of the rtentry has               * the destination and the key of the rtentry has
              * already done through looking up the routing table.               * already done through looking up the routing table.
              */               */
             IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &rt6_key(rt)->sin6_addr) &&              IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,
               &rt6_key(ip6_forward_rt.ro_rt)->sin6_addr) &&
 #endif  #endif
             rt->rt_ifp->if_type == IFT_LOOP) {              ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_LOOP) {
                 struct in6_ifaddr *ia6 = (struct in6_ifaddr *)rt->rt_ifa;                  struct in6_ifaddr *ia6 =
                           (struct in6_ifaddr *)ip6_forward_rt.ro_rt->rt_ifa;
                 if (ia6->ia6_flags & IN6_IFF_ANYCAST)                  if (ia6->ia6_flags & IN6_IFF_ANYCAST)
                         m->m_flags |= M_ANYCAST6;                          m->m_flags |= M_ANYCAST6;
                 /*                  /*
Line 541  ip6_input(struct mbuf *m)
Line 553  ip6_input(struct mbuf *m)
          */           */
 #if defined(NFAITH) && 0 < NFAITH  #if defined(NFAITH) && 0 < NFAITH
         if (ip6_keepfaith) {          if (ip6_keepfaith) {
                 if (rt != NULL && rt->rt_ifp != NULL &&                  if (ip6_forward_rt.ro_rt != NULL &&
                     rt->rt_ifp->if_type == IFT_FAITH) {                      ip6_forward_rt.ro_rt->rt_ifp != NULL &&
                       ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) {
                         /* XXX do we need more sanity checks? */                          /* XXX do we need more sanity checks? */
                         ours = 1;                          ours = 1;
                         deliverifp = rt->rt_ifp; /* faith */                          deliverifp = ip6_forward_rt.ro_rt->rt_ifp; /* faith */
                         goto hbhcheck;                          goto hbhcheck;
                 }                  }
         }          }
Line 739  ip6_input(struct mbuf *m)
Line 752  ip6_input(struct mbuf *m)
         in6_ifstat_inc(deliverifp, ifs6_in_deliver);          in6_ifstat_inc(deliverifp, ifs6_in_deliver);
         nest = 0;          nest = 0;
   
         rh_present = 0;  
         while (nxt != IPPROTO_DONE) {          while (nxt != IPPROTO_DONE) {
                 if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) {                  if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) {
                         ip6stat.ip6s_toomanyhdr++;                          ip6stat.ip6s_toomanyhdr++;
                         in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_hdrerr);  
                         goto bad;                          goto bad;
                 }                  }
   
Line 757  ip6_input(struct mbuf *m)
Line 768  ip6_input(struct mbuf *m)
                         goto bad;                          goto bad;
                 }                  }
   
                 if (nxt == IPPROTO_ROUTING) {  
                         if (rh_present++) {  
                                 in6_ifstat_inc(m->m_pkthdr.rcvif,  
                                     ifs6_in_hdrerr);  
                                 ip6stat.ip6s_badoptions++;  
                                 goto bad;  
                         }  
                 }  
   
 #ifdef IPSEC  #ifdef IPSEC
                 /*                  /*
                  * enforce IPsec policy checking if we are seeing last header.                   * enforce IPsec policy checking if we are seeing last header.
Line 1609  ip6_delaux(m)
Line 1611  ip6_delaux(m)
  * we could reduce this value, call ip6flow_reap();   * we could reduce this value, call ip6flow_reap();
  */   */
 static int  static int
 sysctl_net_inet6_ip6_maxflows(SYSCTLFN_ARGS)  sysctl_net_inet_ip6_maxflows(SYSCTLFN_ARGS)
 {  {
         int s;          int s;
   
         s = sysctl_lookup(SYSCTLFN_CALL(rnode));          s = sysctl_lookup(SYSCTLFN_CALL(rnode));
         if (s || newp == NULL)          if (s)
                 return (s);                  return (s);
   
         s = splsoftnet();          s = splsoftnet();
Line 1942  SYSCTL_SETUP(sysctl_net_inet6_ip6_setup,
Line 1944  SYSCTL_SETUP(sysctl_net_inet6_ip6_setup,
                         CTLFLAG_PERMANENT|CTLFLAG_READWRITE,                          CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                         CTLTYPE_INT, "maxflows",                          CTLTYPE_INT, "maxflows",
                         SYSCTL_DESCR("Number of flows for fast forwarding (IPv6)"),                          SYSCTL_DESCR("Number of flows for fast forwarding (IPv6)"),
                         sysctl_net_inet6_ip6_maxflows, 0, &ip6_maxflows, 0,                          sysctl_net_inet_ip6_maxflows, 0, &ip6_maxflows, 0,
                         CTL_NET, PF_INET6, IPPROTO_IPV6,                          CTL_NET, PF_INET6, IPPROTO_IPV6,
                         CTL_CREATE, CTL_EOL);                          CTL_CREATE, CTL_EOL);
         sysctl_createv(clog, 0, NULL, NULL,          sysctl_createv(clog, 0, NULL, NULL,

Legend:
Removed from v.1.94.2.5  
changed lines
  Added in v.1.99

CVSweb <webmaster@jp.NetBSD.org>