[Vm-dev] Finding ip address for eth0?
John M McIntosh
johnmci at smalltalkconsulting.com
Wed Aug 26 19:26:56 UTC 2009
On 26-Aug-09, at 11:50 AM, Andreas Raab wrote:
> NetNameResolver
Well if you have the ipv6 new socket aware VM plus smalltalk code and
aren't running as useOldNetwork
then the network api deep down uses the class SocketAddressInformation
and returns an order collection
of which the first entry is choosen as a *best* guess.
an OrderedCollection(
fe80::21c:42ff:fe00:8%en4(Otter-2),
0(0)-inet6-stream-tcp fe80::21c:42ff:fe00:9%en4(fe80::21c:
42ff:fe00:9%en4),
0(0)-inet6-stream-tcp fe80::21b:63ff:fe02:d2db%en4(fe80::21b:
63ff:fe02:d2db%en4),
0(0)-inet6-stream-tcp 10.211.55.2(10.211.55.2),
0(0)-inet4-stream-tcp 10.37.129.2(10.37.129.2),
0(0)-inet4-stream-tcp 192.168.1.139(192.168.1.139),
0(0)-inet4-stream-tcp)
Obviously you want to look deeper than *best guess*
The code appears to call getnameinfo()
But appears to be broken (I think) since
en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST>
mtu 1500
inet6 fe80::21c:42ff:fe00:8%en4 prefixlen 64 scopeid 0x8
inet 10.211.55.2 netmask 0xffffff00 broadcast 10.211.55.255
ether 00:1c:42:00:00:08
media: autoselect status: active
supported media: autoselect
but I have a line
0(0)-inet6-stream-tcp 10.211.55.2(10.211.55.2), saying inet6
yet the inet6 address is fe80::21c:42ff:fe00:8%en4
Unhelpfully the code doesn't return the interface id (in this case
en4) for IPV4 addresses.
Maybe Ian could fix the bug above if it's a bug, and add the interface
data for ipv4, well or interface data for ipv4 & 6 if a seperate field
is needed.
Also I think the results above don't relate much to the actual
ifconfig -a
See http://bugs.squeak.org/view.php?id=7392
--
=
=
=
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> Twitter:
squeaker68882
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
=
=
=
========================================================================
More information about the Vm-dev
mailing list