netdev
[Top] [All Lists]

ipv6 address types and routing

To: netdev@xxxxxxxxxxx
Subject: ipv6 address types and routing
From: Sogor Laszlo <sogor@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Apr 2000 12:34:25 +0200 (CEST)
Sender: owner-netdev@xxxxxxxxxxx
Hello!

We want to do a SIIT (Stateless IP/ICMP Translator, RFC2765) for Linux, so
we need the IPv6 Translated address type. (to route an IPv6 Mapped
destination address packet to an IPv6 Translated address) The Linux kernel 
don't know the IPv6 Translated address. We put it into the kernel, it
works, but it would be better, if it were in the official kernel.

it works, but is it correct?
into net/ipv6/addrconf.c

210. line:
return (IPV6_ADDR_COMPATv4 | IPV6_ADDR_UNICAST);
}

>if (addr->s6_addr32[2] == __constant_htonl(0xffff0000))
>       return (IPV6_ADDR_TRANSLATED|IPV6_ADDR_UNICAST);

if (addr->s6_addr32[2] == __constant_htonl(0x0000ffff))

into include/net/ipv6.h
65. line
#define IPV6_ADDR_SITELOCAL     0x0040U

>#define IPV6_ADDR_TRANSLATED    0x0100U

#define IPV6_ADDR_COMPATv4      0x0080U

on the other hand, we have a problem with IPv6 packet sending. we need
some help about it. after we get the IPv4 packet, we store some
information from it, drop the ipv4 header, caclulate the IPv6 source and
destination addresses, get a route, put the ipv6 header into the packet, 
fill it, and send the packet. it crashes the machine, but we don't know,
why. because we have no documentation, we don't know what we have to
correctly do.
we need some description about ip6_route_output. we tried:

...

        struct  flowi fl;
        struct  in6_addr *saddr6;
        struct  in6_addr *daddr6;       
        __u8    protocol;

...

        fl.proto = protocol;
        fl.fl6_src = saddr6;
        fl.fl6_dst = daddr6;
        fl.fl6_flowlabel = __constant_htonl(0);
        fl.oif = 0;
        fl.uli_u.data = 0;

        dst_release(skb->dst);  //drop the old dst_entry
        skb->dst = NULL;
        skb->dst = ip6_route_output(NULL, &fl);

        if (skb->dst->error != 0) {
                printk(KERN_INFO "siit: (4->6) Couldn't get route\n");
                goto tx_error_4;
        }

then we fill the IPv6 header.

        skb->protocol = __constant_htons(ETH_P_IPV6);
        skb->dst->output(skb);

the last line crashes the kernel, totally. 

it seems, ip6_route_output gives a correct dst_entry, if we put the
following line into the module:

        printk(KERN_INFO "siit: (4->6) out device=%s\n",skb->dst->dev->name);

we get the correct output device (eth0, in this case)

shogy (Laszlo Sogor)




<Prev in Thread] Current Thread [Next in Thread>
  • ipv6 address types and routing, Sogor Laszlo <=