Don't use s6_addr[16|32] anymore.
[tinc] / src / route.c
index 097dd13..dcf43e4 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: route.c,v 1.1.2.33 2002/03/15 14:41:57 guus Exp $
+    $Id: route.c,v 1.1.2.37 2002/03/19 00:08:23 guus Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
@@ -264,8 +264,8 @@ cp
       if(debug_lvl >= DEBUG_TRAFFIC)
         {
           syslog(LOG_WARNING, _("Cannot route packet: neighbor solicitation request for unknown address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"),
       if(debug_lvl >= DEBUG_TRAFFIC)
         {
           syslog(LOG_WARNING, _("Cannot route packet: neighbor solicitation request for unknown address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"),
-                 ntohs(ns->nd_ns_target.s6_addr16[0]), ntohs(ns->nd_ns_target.s6_addr16[1]), ntohs(ns->nd_ns_target.s6_addr16[2]), ntohs(ns->nd_ns_target.s6_addr16[3]),
-                 ntohs(ns->nd_ns_target.s6_addr16[4]), ntohs(ns->nd_ns_target.s6_addr16[5]), ntohs(ns->nd_ns_target.s6_addr16[6]), ntohs(ns->nd_ns_target.s6_addr16[7]));
+                 ntohs(((uint16_t *)&ns->nd_ns_target)[0]), ntohs(((uint16_t *)&ns->nd_ns_target)[1]), ntohs(((uint16_t *)&ns->nd_ns_target)[2]), ntohs(((uint16_t *)&ns->nd_ns_target)[3]),
+                 ntohs(((uint16_t *)&ns->nd_ns_target)[4]), ntohs(((uint16_t *)&ns->nd_ns_target)[5]), ntohs(((uint16_t *)&ns->nd_ns_target)[6]), ntohs(((uint16_t *)&ns->nd_ns_target)[7]));
         }
 
       return;
         }
 
       return;
@@ -275,7 +275,7 @@ cp
   
   if(subnet->owner == myself)
     return;    /* silently ignore */
   
   if(subnet->owner == myself)
     return;    /* silently ignore */
+
   /* Create neighbor advertation reply */
 
   memcpy(packet->data, packet->data + ETHER_ADDR_LEN, ETHER_ADDR_LEN); /* copy destination address */
   /* Create neighbor advertation reply */
 
   memcpy(packet->data, packet->data + ETHER_ADDR_LEN, ETHER_ADDR_LEN); /* copy destination address */
@@ -305,6 +305,8 @@ cp
   checksum = inet_checksum((unsigned short int *)&pseudo, sizeof(pseudo)/2, ~0);
   checksum = inet_checksum((unsigned short int *)ns, sizeof(*ns)/2 + 4, checksum);
 
   checksum = inet_checksum((unsigned short int *)&pseudo, sizeof(pseudo)/2, ~0);
   checksum = inet_checksum((unsigned short int *)ns, sizeof(*ns)/2 + 4, checksum);
 
+  ns->nd_ns_hdr.icmp6_cksum = htons(checksum);
+
   write_packet(packet);
 cp
 }
   write_packet(packet);
 cp
 }
@@ -393,12 +395,12 @@ cp
               n = route_ipv4(packet);
               break;
             case 0x86DD:
               n = route_ipv4(packet);
               break;
             case 0x86DD:
-              n = route_ipv6(packet);
-             if(!n && packet->data[0] == 0x33 && packet->data[1] == 0x33 && packet->data[2] == 0xff)
+              if(packet->data[20] == IPPROTO_ICMPV6 && packet->data[54] == ND_NEIGHBOR_SOLICIT)
                {
                  route_neighborsol(packet);
                  return;
                }
                {
                  route_neighborsol(packet);
                  return;
                }
+              n = route_ipv6(packet);
               break;
             case 0x0806:
               route_arp(packet);
               break;
             case 0x0806:
               route_arp(packet);