[158349] in North American Network Operators' Group
Re: "Programmers can't get IPv6 thus that is why they do not have
daemon@ATHENA.MIT.EDU (Owen DeLong)
Wed Nov 28 14:41:16 2012
From: Owen DeLong <owen@delong.com>
In-Reply-To: <50B65C49.6070909@xip.at>
Date: Wed, 28 Nov 2012 11:37:10 -0800
To: Ingo Flaschberger <if@xip.at>
Cc: nanog@nanog.org
Errors-To: nanog-bounces+nanog.discuss=bloom-picayune.mit.edu@nanog.org
On Nov 28, 2012, at 10:47 AM, Ingo Flaschberger <if@xip.at> wrote:
> Am 28.11.2012 19:30, schrieb david peahi:
>> Many years ago the standard books on application network programming =
were
>> based on C language. Books such as "Adventures in UNIX Network
>> Programming", and Professor Comer's "Internetworking with TCP/IP Vol =
3"
>> detailed how to write C programs using BSD sockets where binding to a
>> socket brought the program up in listening mode on an 2 tuple IP v4 =
IP
>> address/TCP well known port. Once the program opened and bound to a =
socket
>> "netstat -n" would show that program to be "listening" on the =
2-tuple.
>>=20
>> Do today's programmers still use basic BSD socket programming? Is =
there an
>> equivalent set of called procedures for IPv6 network application
>> programming?
>>=20
>> On the practical side: Have all programmers created a 128 bit field =
to
>> store the IPv6 address, where IPv4 programs use a 32 bit field to =
store the
>> IP address? This would seem to be similar to the year 2000 case where
>> almost all programs required auditing to see if they took into =
account
>> dates after 1999.
>=20
> on linux/unix: if the program only opens a tcp-connection or listen on =
it, it's simple.
> socket =3D socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) -> socket =3D =
socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP)
>=20
You left out some structure changes an the need to use =
getaddrinfo()/getnameinfo() in place of
get*by*().
Depending on your implementation, you might also need to make some =
changes to your bind() call and/or the way you iterate through the =
returns from getaddrinfo() calling connect().
> It's more work, to build a dual-stack program - then 2 sockets needs =
to be opened and handled.
> But overall - it's trivial.
Not if your system properly supports IPV6_V6ONLY=3Dfalse default sock =
opt.
If you're stuck on something based on BSD or WinSock where this is =
broken, then, yes, you may have to open 2 sockets or at the very least =
make a deliberate setsockopt() call or specify the option in the =
socket() call.
Owen