[kaffe] NetworkInterfaceTest failed

Ito Kazumitsu ito.kazumitsu at mail.hidec.co.jp
Fri May 21 05:57:02 PDT 2004


> The network interface ed0 has two addresses:
>        inet 192.168.0.4 netmask 0xffffff00 broadcast 192.168.0.255
>        inet6 fe80::290:99ff:fe5f:4cb2%ed0 prefixlen 64 scopeid 0x2

> In this case, I think, java.net.getNetworkInterfaces() should
> return one interface, [ed0 {192.168.0.4, fe80::290:99ff:fe5f:4cb2}],
> but actually returns two interfaces, [ed0 {192.168.0.4}] and
> [ed0 {fe80::290:99ff:fe5f:4cb2}].

Suppose a network interface I has two IP addresses A1 and A2.
NetworkInterface.getNetworkInterfaces() should return one interface
[I, {A1, A2}].  But now two interfaces [I, {A1}] and [I, {A2}]
are returned.  Before the recent change to NetworkInterface,
only one interface [I, {A1}] was returned.

This can be explained as follows.

In NetworkInterface.c, detectInterfaces() returns the list
([I, {A1}], [I, {A2}]).

Formerly,  the network interfaces were kept in a hashtable
and before putting a new object into the hashtable,
NetworkInterface checked whether the interface with the
same name existed in the hashtable.  Thus only the first
one was put in the hashtable.  This is why  only [I, {A1}]
was returned.

Now NetworkInterface uses a vector for keeping network interfaces.
So both [I, {A1}] and [I, {A2}] are stored.  This is why
both [I, {A1}] and [I, {A2}] are returned now.

I think we should somehow create [I, {A1, A2}] from
([I, {A1}], [I, {A2}]).





More information about the kaffe mailing list