[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.78.2.3 and 1.90.2.1.2.2

version 1.78.2.3, 2007/02/26 09:11:52 version 1.90.2.1.2.2, 2007/09/23 21:36:35
Line 237  ip6intr()
Line 237  ip6intr()
 extern struct   route_in6 ip6_forward_rt;  extern struct   route_in6 ip6_forward_rt;
   
 void  void
 ip6_input(struct mbuf *m)  ip6_input(m)
           struct mbuf *m;
 {  {
         struct ip6_hdr *ip6;          struct ip6_hdr *ip6;
         int off = sizeof(struct ip6_hdr), nest;          int off = sizeof(struct ip6_hdr), nest;
Line 276  ip6_input(struct mbuf *m)
Line 277  ip6_input(struct mbuf *m)
                 else                  else
                         ip6stat.ip6s_mext1++;                          ip6stat.ip6s_mext1++;
         } else {          } else {
 #define M2MMAX  __arraycount(ip6stat.ip6s_m2m)  #define M2MMAX  (sizeof(ip6stat.ip6s_m2m)/sizeof(ip6stat.ip6s_m2m[0]))
                 if (m->m_next) {                  if (m->m_next) {
                         if (m->m_flags & M_LOOP) {                          if (m->m_flags & M_LOOP) {
                                 ip6stat.ip6s_m2m[lo0ifp->if_index]++; /* XXX */                                  ip6stat.ip6s_m2m[lo0ifp->if_index]++; /* XXX */
Line 463  ip6_input(struct mbuf *m)
Line 464  ip6_input(struct mbuf *m)
         /*          /*
          *  Unicast check           *  Unicast check
          */           */
         if (!IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,          if (ip6_forward_rt.ro_rt != NULL &&
             &((const struct sockaddr_in6 *)rtcache_getdst((const struct route *)&ip6_forward_rt))->sin6_addr))              (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 &&
                 rtcache_free((struct route *)&ip6_forward_rt);              IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,
         else              &((struct sockaddr_in6 *)(&ip6_forward_rt.ro_dst))->sin6_addr))
                 rtcache_check((struct route *)&ip6_forward_rt);  
         if (ip6_forward_rt.ro_rt != NULL) {  
                 /* XXX Revalidated route is accounted wrongly. */  
                 ip6stat.ip6s_forward_cachehit++;                  ip6stat.ip6s_forward_cachehit++;
         } else {          else {
                 struct sockaddr_in6 *dst6;                  struct sockaddr_in6 *dst6;
   
                 ip6stat.ip6s_forward_cachemiss++;                  if (ip6_forward_rt.ro_rt) {
                           /* route is down or destination is different */
                           ip6stat.ip6s_forward_cachemiss++;
                           RTFREE(ip6_forward_rt.ro_rt);
                           ip6_forward_rt.ro_rt = 0;
                   }
   
                 dst6 = &ip6_forward_rt.ro_dst;                  bzero(&ip6_forward_rt.ro_dst, sizeof(struct sockaddr_in6));
                 memset(dst6, 0, sizeof(*dst6));                  dst6 = (struct sockaddr_in6 *)&ip6_forward_rt.ro_dst;
                 dst6->sin6_len = sizeof(struct sockaddr_in6);                  dst6->sin6_len = sizeof(struct sockaddr_in6);
                 dst6->sin6_family = AF_INET6;                  dst6->sin6_family = AF_INET6;
                 dst6->sin6_addr = ip6->ip6_dst;                  dst6->sin6_addr = ip6->ip6_dst;
   
                 rtcache_init((struct route *)&ip6_forward_rt);                  rtalloc((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 496  ip6_input(struct mbuf *m)
Line 499  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 (ip6_forward_rt.ro_rt != NULL &&          if (ip6_forward_rt.ro_rt &&
             (ip6_forward_rt.ro_rt->rt_flags &              (ip6_forward_rt.ro_rt->rt_flags &
              (RTF_HOST|RTF_GATEWAY)) == RTF_HOST &&               (RTF_HOST|RTF_GATEWAY)) == RTF_HOST &&
             !(ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) &&              !(ip6_forward_rt.ro_rt->rt_flags & RTF_CLONED) &&
Line 539  ip6_input(struct mbuf *m)
Line 542  ip6_input(struct mbuf *m)
          */           */
 #if defined(NFAITH) && 0 < NFAITH  #if defined(NFAITH) && 0 < NFAITH
         if (ip6_keepfaith) {          if (ip6_keepfaith) {
                 if (ip6_forward_rt.ro_rt != NULL &&                  if (ip6_forward_rt.ro_rt && ip6_forward_rt.ro_rt->rt_ifp &&
                     ip6_forward_rt.ro_rt->rt_ifp != NULL &&  
                     ip6_forward_rt.ro_rt->rt_ifp->if_type == IFT_FAITH) {                      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;
Line 558  ip6_input(struct mbuf *m)
Line 560  ip6_input(struct mbuf *m)
          * working right.           * working right.
          */           */
         struct ifaddr *ifa;          struct ifaddr *ifa;
         TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrlist, ifa_list) {          for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first;
                ifa;
                ifa = ifa->ifa_list.tqe_next) {
                 if (ifa->ifa_addr == NULL)                  if (ifa->ifa_addr == NULL)
                         continue;       /* just for safety */                          continue;       /* just for safety */
                 if (ifa->ifa_addr->sa_family != AF_INET6)                  if (ifa->ifa_addr->sa_family != AF_INET6)
Line 798  ip6_input(struct mbuf *m)
Line 802  ip6_input(struct mbuf *m)
                         /* XXX error stat??? */                          /* XXX error stat??? */
                         error = EINVAL;                          error = EINVAL;
                         DPRINTF(("ip6_input: no SP, packet discarded\n"));/*XXX*/                          DPRINTF(("ip6_input: no SP, packet discarded\n"));/*XXX*/
                         goto bad;  
                 }                  }
                 splx(s);                  splx(s);
                 if (error)                  if (error)
Line 1297  ip6_savecontrol(in6p, mp, ip6, m)
Line 1300  ip6_savecontrol(in6p, mp, ip6, m)
   
   
 void  void
 ip6_notify_pmtu(struct in6pcb *in6p, const struct sockaddr_in6 *dst,  ip6_notify_pmtu(struct in6pcb *in6p, struct sockaddr_in6 *dst, uint32_t *mtu)
     uint32_t *mtu)  
 {  {
         struct socket *so;          struct socket *so;
         struct mbuf *m_mtu;          struct mbuf *m_mtu;
Line 1324  ip6_notify_pmtu(struct in6pcb *in6p, con
Line 1326  ip6_notify_pmtu(struct in6pcb *in6p, con
             IPV6_PATHMTU, IPPROTO_IPV6)) == NULL)              IPV6_PATHMTU, IPPROTO_IPV6)) == NULL)
                 return;                  return;
   
         if (sbappendaddr(&so->so_rcv, (const struct sockaddr *)dst, NULL, m_mtu)          if (sbappendaddr(&so->so_rcv, (struct sockaddr *)dst, NULL, m_mtu)
             == 0) {              == 0) {
                 m_freem(m_mtu);                  m_freem(m_mtu);
                 /* XXX: should count statistics */                  /* XXX: should count statistics */
Line 1591  ip6_delaux(m)
Line 1593  ip6_delaux(m)
                 m_tag_delete(m, mtag);                  m_tag_delete(m, mtag);
 }  }
   
   static int
   sysctl_net_inet6_ip6_rht0(SYSCTLFN_ARGS)
   {
           int error, tmp;
           struct sysctlnode node;
   
           node = *rnode;
           tmp = ip6_rht0;
           node.sysctl_data = &tmp;
           error = sysctl_lookup(SYSCTLFN_CALL(&node));
           if (error || newp == NULL)
                   return error;
   
           switch (tmp) {
           case -1:        /* disable processing */
           case 0:         /* disable for host, enable for router */
           case 1:         /* enable for all */
                   break;
           default:
                   return EINVAL;
           }
           ip6_rht0 = tmp;
           return 0;
   }
   
 /*  /*
  * System control for IP6   * System control for IP6
  */   */
Line 1874  SYSCTL_SETUP(sysctl_net_inet6_ip6_setup,
Line 1901  SYSCTL_SETUP(sysctl_net_inet6_ip6_setup,
                        NULL, 0, &ip6_mcast_pmtu, 0,                         NULL, 0, &ip6_mcast_pmtu, 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,
                           CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                           CTLTYPE_INT, "rht0",
                           SYSCTL_DESCR("Processing of routing header type 0 (IPv6)"),
                           sysctl_net_inet6_ip6_rht0, 0, &ip6_rht0, 0,
                           CTL_NET, PF_INET6, IPPROTO_IPV6,
                           CTL_CREATE, CTL_EOL);
 }  }

Legend:
Removed from v.1.78.2.3  
changed lines
  Added in v.1.90.2.1.2.2

CVSweb <webmaster@jp.NetBSD.org>