[Ns-developers] Implementation of an IPv6 stack for NS-3
mathieu.lacage at sophia.inria.fr
Tue Jun 17 08:40:37 PDT 2008
On Tue, 2008-06-17 at 10:03 +0200, Sébastien Vincent wrote:
> > Another issue I wonder about is what the socket API looks like. I have
> > to confess that I know next to nothing about ipv6 so, I would like to
> > know how OSes actually export ipv6 sockets ? How can I specify (in a
> > real OS) that I want an ipv6 tcp socket ? Can I specify that I want a
> > tcp socket to listen both on ipv4 and ipv6 on the same port ?
> Simply put AF_INET6 for the "domain" parameter of socket()
> i.e. for TCP : int sock=socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
> other useful C function :
> - getaddrinfo : to retrieve IPv6 address from a DNS name (for bind(),
> connect(), ...);
> - getnameinfo : to retriev name (hostname, ...) from IPv6 address;
> - inet_ntop / inet_pton (with AF_INET6 value for "af" parameter).
> The IPv6 socket by default can receive both IPv4 and IPv6 if it is bind
> with the unspecified address (::). The IPv4 address will be represented
> as IPv4-mapped address (i.e. ::ffff:192.168.0.1). T**he setsockopt
> option IPV6_V6ONLY can disable this.
I see. Thanks for the explanation.
> In IPv4 under GNU/Linux, when you want more than one address per
> interface, you have to deals with alias (ifconfig eth0:1 10.0.0.1) and
> it "creates" another interface. So your way to have multipe
> Ipv4Interface on same NetDevice is the same as Linux (for IPv4). But in
> IPv6 you have all the addresses in the same interface name. So my first
> impression was to do have a list of addresses as Linux and Unix do.
> eth1 Link encap:Ethernet HWaddr 00:xx:xx:xx:xx:xx
> inet adr:192.168.0.1 Bcast:192.168.0.255 Masque:255.255.255.0
> adr inet6: 2001:db80:aaaa::1234/64 Scope:Global
> adr inet6:2001:db80:bbbb::1234/64 Scope:Global
> adr inet6: fe80::1234/64 Scope:Lien
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:5382749 errors:0 dropped:0 overruns:0 frame:0
> TX packets:917577 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 lg file transmission:1000
> RX bytes:1189822564 (1.1 GiB) TX bytes:243898797 (232.6 MiB)
Ok. I would be curious to know why they have taken these different
approaches in linux.
More information about the Ns-developers