(solaris) 8059309: network tests fail with "java.net.SocketException: Couldn't obtain phys addr" when run as "root"

Daniel Fuchs daniel.fuchs at oracle.com
Mon Mar 2 10:49:56 UTC 2020


Hi Bernd,

On 28/02/2020 22:06, Bernd Eckenfels wrote:
> What is the MAC address of the loopback interface on Solaris anyway? 

I'd expect there's none. "null" is what is consistently returned
after the fix (before you either get "null" or "SocketException")

> Maybe it's enough to assume there is none if the execution fails?

I believe that's what the fix is doing (by returning 0).

There's no special case for the loopback - and the issue here is
that a SocketException is thrown instead of returning null.
Regardless of whether the loopback interface is being queried or
not - I believe that return 0 when the query is not supported
is the right thing to do here.

best regards,

-- daniel

> 
> 
> -- 
> http://bernd.eckenfels.net
> ------------------------------------------------------------------------
> *Von:* net-dev <net-dev-bounces at openjdk.java.net> im Auftrag von Daniel 
> Fuchs <daniel.fuchs at oracle.com>
> *Gesendet:* Friday, February 28, 2020 4:41:51 PM
> *An:* OpenJDK Network Dev list <net-dev at openjdk.java.net>
> *Betreff:* (solaris) 8059309: network tests fail with 
> "java.net.SocketException: Couldn't obtain phys addr" when run as "root"
> Hi,
> 
> Please find below a fix for:
> 
> 8059309: network tests fail with "java.net.SocketException:
>            Couldn't obtain phys addr" when run as "root"
> https://bugs.openjdk.java.net/browse/JDK-8059309
> 
> http://cr.openjdk.java.net/~dfuchs/webrev_8059309/webrev.00/
> 
> Recent reports have shown that the failure occurs when the tests
> are run with super user privileges.
> 
> The NetworkInterface code on Solaris attempts to use the DLPI interface,
> but this requires root privilege. If it fails to open the device, it
> falls back to using the ARP tables instead.
> 
> Apparently using the DLPI interface to query the mac address from
> the loopback isn't supported, which is causing the exception.
> 
> The fix is to examine the error status returned by the ACK
> message and if that's DL_UNSUPPORTED, returns 0 to trigger the
> fallback mechanism instead of throwing the socket exception.
> 
> best regards,
> 
> -- daniel



More information about the net-dev mailing list