updated relay_6bed4_plain_unicast
[6bed4] / router.c
index 7aa8f3c..256d59c 100644 (file)
--- a/router.c
+++ b/router.c
@@ -186,7 +186,7 @@ int setup_tunnel (void) {
        int ok = 1;
        struct ifreq ifreq;
        memset (&ifreq, 0, sizeof (ifreq));
-       strncpy (ifreq.ifr_name, "6bed4_rfc", IFNAMSIZ);
+       strncpy (ifreq.ifr_name, "6bed4", IFNAMSIZ);
        ifreq.ifr_flags = IFF_TUN;
        if (ok && (ioctl (v6sox, TUNSETIFF, (void *) &ifreq) == -1)) {
                ok = 0;
@@ -503,7 +503,7 @@ printf ("Writing IPv6, result = %d\n",
  * Hop Limit has been altered, and this is not part of the
  * checksum calculations.
  */
-void relay_6bed4_plain_unicast (ssize_t v4datalen, struct in6_addr *ip6) {
+void relay_6bed4_plain_unicast (uint8_t* data, ssize_t v4datalen, struct in6_addr *ip6) {
        v4name.sin_port = htons (ip6->s6_addr [9] << 8 | ip6->s6_addr [8] ^ 0x02);
        uint8_t *addr = (uint8_t *) &v4name.sin_addr.s_addr;
        addr [0] = ip6->s6_addr [10];
@@ -515,7 +515,7 @@ printf ("Relaying over 6bed4 Network to %d.%d.%d.%d:%d, result = %d\n",
 ((uint8_t *) &v4name.sin_addr.s_addr) [3],
 ntohs (v4name.sin_port),
        sendto (v4sox,
-                       v4data, v4datalen,
+                       data, v4datalen,
                        MSG_DONTWAIT,
                        (struct sockaddr *) &v4name, sizeof (v4name)));
 }
@@ -566,7 +566,7 @@ void handle_4to6 (void) {
                                return;
                        }
                        if (prefix_6bed4 (v4dst6)) {
-                               relay_6bed4_plain_unicast (buflen, v4dst6);
+                               relay_6bed4_plain_unicast (v4data, buflen, v4dst6);
                        } else {
                                handle_4to6_plain_unicast (buflen);
                        }
@@ -610,6 +610,7 @@ void handle_6to4 (void) {
                return;         /* hop limit exceeded, drop */
        }
        if ((v6dst6->s6_addr [0] == 0xff) /* TODO:UDP_PORT_NOT_YET_FORCED_TO_EVEN || (v6dst6->s6_addr [8] & 0x01) */ ) {
+printf ("Received multicast IPv6 data, flags=0x%04x, proto=0x%04x\n", v6tuncmd.flags, v6tuncmd.proto);
                //OPTIONAL// handle_6to4_plain_multicast ()
                return;         /* multicast, drop */
        }
@@ -622,7 +623,7 @@ printf ("Received plain unicast IPv6 data, flags=0x%04x, proto=0x%04x\n", v6tunc
        }
        //
        // Harvest socket address data from destination IPv6, then send
-       relay_6bed4_plain_unicast (rawlen - sizeof (struct tun_pi), v6dst6);
+       relay_6bed4_plain_unicast (v6data, rawlen - sizeof (struct tun_pi), v6dst6);
 }