[squeak-dev] sqConnectToAddressSize: Address family not supported by protocol

Bert Freudenberg bert at freudenbergs.de
Tue Sep 24 15:08:57 UTC 2013


On 2013-09-24, at 11:03, Frank Shearar <frank.shearar at gmail.com> wrote:

> It's actually harder to tell than that. If you say "connect to
> www.kame.net" you'll issue some kind of DNS request. IPv6 addresses
> are stored in AAAA records and IPv4 addresses in A records, so if you
> ask for both you could end up connecting using either IPv6 or IPv4,
> depending on how the socket code's written.
> 
> For instance you could write the socket connection logic to say
> 'resolve for AAAA and A, and iterate over the AAAA records trying to
> connect to each IPv6 address in turn, falling back to the A records,
> and bailing as a last resort'. I have no idea how Squeak's network
> code will do this. Running strace would tell you the OS level calls
> Squeak made, which should shed some light on the problem.
> 
> Just yesterday I ran into a problem at work where 'localhost' meant
> 127.0.0.1 on my machine, and ::1 on a build slave. That wasn't fun to
> understand.
> 
> frank


The old socket plugin code uses gethostbyname() and returns the first of the list of answers, without even checking that the answer is, in fact, an IPv4 address.

The new socket plugin code uses getaddrinfo() and answers the full list of addresses, so the image can figure out which one it prefers.

Both old and new is still supported in the plugin so it's up to the image to use either.

NetNameResolver addressesForName: 'www.google.com'
==> an OrderedCollection(
	173.194.44.51(muc03s08-in-f19.1e100.net),0(0)-inet4-stream-tcp
	173.194.44.48(muc03s08-in-f16.1e100.net),0(0)-inet4-stream-tcp
	173.194.44.49(muc03s08-in-f17.1e100.net),0(0)-inet4-stream-tcp
	173.194.44.52(muc03s08-in-f20.1e100.net),0(0)-inet4-stream-tcp
	173.194.44.50(muc03s08-in-f18.1e100.net),0(0)-inet4-stream-tcp
	2a00:1450:4016:803::1011(muc03s08-in-x11.1e100.net),0(0)-inet6-stream-tcp)

If you use "NetNameResolver addressForName: ..." then it will either use the old code (if forced by preference) or answer the first of the addresses.

I myself cannot easily test IPv6 as it's not natively supported by my ISP, yet.

If it did, then both of these should work equally:

	HTTPSocket httpGetDocument: 'ipv4.whatismyv6.com'
	HTTPSocket httpGetDocument: 'ipv6.whatismyv6.com'


- Bert -




More information about the Squeak-dev mailing list