NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Protocol preference - ipv4 vs ipv6



On 2015-05-06 13:52, Christos Zoulas wrote:
In article <Pine.NEB.4.64.1505061638440.2440%vps1.whooppee.com@localhost>,
Paul Goyette  <paul%whooppee.com@localhost> wrote:
what controls the selection of a protocol when both are available?

More specifically, if I 'ftp ftp.netbsd.org' what causes it to try ipv6 first,
and use ipv4 as a fall back?

In a way it depends on the program. A program can explicitly ask for V4 or V6 addresses, and then obviously that is the order things will be handled. If a program calls getaddrinfo() without specifying the family, getaddrinfo() in NetBSD prefers V6 addresses over V4 addresses. This manifests itself by the result that getaddrinfo() returns have the IPv6 addresses appear first in the resulting list, and the IPv4 addresses come after. A program would normally go through the list from start to end, trying one address at a time, so then it would try IPv6 first. But of course, a program can do things differently if it wants to...

My ipv6 connectivity is via a slow vpn (from Manila to San Jose, CA!) so I
would prefer that connections default to ipv4 unless I explicitly ask for v6.

You could just throw in "-4" to the ftp command, and you will be doing IPv4 only...

FreeBSD has:

https://www.freebsd.org/cgi/man.cgi?query=ip6addrctl&sektion=8

I was thinking of copying it...

That could be handy. However, how does it work? Do getaddrinfo() then somehow lookup this preference table and sort the results based on that? Or is this somehow solved in some different way?

	Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index