[Vm-dev] unix nameToAddr() function appears to not work on Raspbian?

David T. Lewis lewis at mail.msen.com
Thu Sep 17 02:55:50 UTC 2015


On Wed, Sep 16, 2015 at 04:40:17PM -0700, tim Rowledge wrote:
> 
> Somebody noticed that asking for the local address on a Pi vm returns 127.0.1.1 these days, whereas on my iMac it returns the actual machine IP. That?s a much more useful thing.
> 
> The Smalltalk code is in NetNameResolver class>>localHostAddress, using prim SocketPlugin.c->primitiveResolverLocalAddress() etc. Running this under gdb shows me that we are finding the machine?s local name ok (?Pi-2? in this case) but that sqResolverLocalAddress() is using nameToAddr() and being told ?127.0.1.1? - well strictly speaking 0x7f000101 of course. I?ve tried `man nameToAddr` and googling nameToAddr and got.. nothing. I don?t even seem to find it listed in a header file out there.  Whah?
> 
> Puzzled in Qualicum...
>

Some recent related discussion:

Tobias fixed a test that was failing due to this issue:

http://lists.squeakfoundation.org/pipermail/squeak-dev/2015-September/185892.html

And he provided a link to some Debian documentation that explains why it
works that way on Debian based systems:

https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution

I replied to Tobias and claimed that primitiveSocketLocalAddress is
working as intended:

http://lists.squeakfoundation.org/pipermail/squeak-dev/2015-September/185912.html

If you look in the /etc/hosts file on your Pi, you will probably see an entry
mapping the host name for your Pi to the address 127.0.1.1. I do not know why
your iMac is giving you the more sensible and useful result, but I would like
to know the answer if you figure it out. You might want to look at /etc/hosts
on the iMac and see if it offers any obvious clues.

One small but important point - there is no such thing as an "actual machine IP"
on your Pi. The IP addresses are associated with one or more network interfaces
(e.g. wireless or ethernet interfaces), and each interface may have one or more
IP addresses associated with it. The common case for a small machine would be
one network interface with a single IP address, which of course is what you are
trying to find.

Dave
 


More information about the Vm-dev mailing list