[Vm-dev] [commit] update resolver local address discovery;
it seem gethostbyaddr has been compromised by OS changes recently.
David T. Lewis
lewis at mail.msen.com
Mon Nov 16 00:08:12 UTC 2015
On Thu, Nov 05, 2015 at 12:57:18PM -0800, tim Rowledge wrote:
> > On 05-11-2015, at 12:53 PM, commits at squeakvm.org wrote:
> > Revision: 3485
> > Author: rowledge
> > Date: 2015-11-05 12:53:44 -0800 (Thu, 05 Nov 2015)
> > Log Message:
> > -----------
> > update resolver local address discovery; it seem gethostbyaddr has been compromised by OS changes recently. Change to using ifgetaddrs and scanning for eth0 or wlan0 addresses, which looks like a good change on Raspbian at least.
> I???m very much a guess-and-hope guy when it comes to sockets, so please offer any improvements you can think of.
I just committed a small patch (in SVN trunk and oscog) for UDP connect that
makes Bert's approach work:
| s local |
s := Socket newUDP setPeer: (NetNameResolver addressForName: '184.108.40.206') port: 0.l.
local := s localAddress.
local "==> #[172 16 0 10]"
This works when the "Enable IPv6 and new network support" preference is
enabled, and it also may be safer for Scratch in the sense that it does
not require the VM to think very hard about the problem, so if Debian
and/or the networking hardware on Pi change, it may have a better chance
of still working.
More information about the Vm-dev