IPv4-mapped IPv6 addresses
Li Hong
jeff@muzi.com
Thu, 21 Dec 2000 00:19:16 +0800
**************************************************
client6 code:
sockfd = socket(AF_INET6, SOCK_STREAM, 0)
bzero(&servaddr, sizeof(servaddr));
servaddr.sin6_family = AF_INET6;
servaddr.sin6_port = htons(5000);
inet_pton(AF_INET6, argv[1], &servaddr.sin6_addr)
connect(sockfd, (SA *) &servaddr, sizeof(servaddr)
server6 code:
listenfd = Socket(AF_INET6, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin6_family = AF_INET6;
servaddr.sin6_addr = ipv6addr_any;
servaddr.sin6_port = htons(5000);
Bind(listenfd, (SA *) &servaddr, sizeof(servaddr));
connfd = Accept(listenfd, (SA *) &cliaddr, &len);
************************************************
The inet_pton function is only valid for AF_INET and AF_INET6, you can try AF_INET6 instead of PF_INET6?
I am not sure Linux box, I am using FreeBSD 4.1 as testing bed.
In my testing, the following testing cases will using IPv4-mapped IPv6 address:
1) IPv4 client communicates with IPv6 server, the server will use IPv4-mapped IPv6 address.
2) IPv6 client communicates with IPv4 server, the client will use IPv4-mapped IPv6 address
3) IPv6 client communicates with IPv6 server, the client and server will both accept IPv4-mapped IPv6 address.
Both 1,2 will use IPv4 datagram, 3 will use IPv6 datagram.
-----Original Message-----
From: itojun@iijlab.net
Date: Wed, 20 Dec 2000 21:26:19 +0900
To: Julio Baixauli <baixauli@mat.upc.es>
Subject: Re: IPv4-mapped IPv6 addresses
>
> >Li Hong wrote:
> >>
> >> I built my IPv6 client/server using IPv4-mapped IPv6 address, address format like ::ffff:a.b.c.d
> >> These two hosts were on the same Ethernet.
> > Are you sure the communication is made in IPv6? The kernel handles
> >these addresses like it would be IPv4 addresses (...I think). How you
> >can skip this default conduct?
> >
> > In my test program I make:
> >
> >socket() with PF_INET6 & SOCK_STREAM
> >connect() to ::ffff:a.b.c.d
> >
> >...and I can see, at least, ARP packets for a.b.c.d (if any route is
> >found in the route table). This implies that the connection will be made
> >in IPv4, isn't it?
> >
> > Could you send me any code that can clarify me?
>
> if the following conditions are true:
> - you have configured your (linux) node as IPv4/IPv6 dual stack node
> - linux IPv6 stack supports behavior presented in RFC2553 section 3.7
> traffic toward IPv6 mapped address (on top of AF_INET6 socket) will
> go out the node as IPv4 traffic. if you run tcpdump on loopback
> interface while you run "telnet ::ffff:127.0.0.1", you will see IPv4
> traffic. this is expected behavior and you cannot test SIIT with the
> node.
>
> if I understand correctly, SIIT specification is written to support
> IPv6-only nodes. you need to at least remove RFC2553 section 3.7
> behavior from your test node. also, you may need to remove IPv4 stack
> in your kernel. at this moment I don't think there's any stack
> capable of doing the latter.
>
> itojun
>
>
--
_______________________________________________
Get your free email from http://mail.muzi.com
Powered by Outblaze