Patch for NetworkInterface.c to fix incorrect returned values for broadcast address and net mask on Linux

Doychin Bondzhev doychin at dsoft-bg.com
Tue Jan 20 20:20:10 UTC 2015


Hi,

Please review this patch
http://dmitryalexandrov.net/~bgjug/network-interface/webrev.00/

It fixes the problem described in this thread

http://mail.openjdk.java.net/pipermail/net-dev/2014-December/008806.html

Also in order to setup dummy interface with test values you can use these
commands:

ip link add dummy0 type dummy

ip addr add 10.5.5.1/28 brd 10.5.5.15 dev dummy0
ip addr add 10.6.0.1/23 brd 10.6.1.255 dev dummy0
ip addr add 10.7.0.1/25 brd 10.7.0.127 dev dummy0

The output from NetworkInterface test
test/java/net/NetworkInterface/NetParamsTest.java for this interface is:

dummy0 :
    Status: DOWN
    Hardware Address: 56:ffffffd4:fffffffd:ffffffc2:ffffffec:ffffff82:
    Loopback: false
    Point to Point: false
    Virtual: false
    Multicast: false
    MTU: 1500
    Bindings:
        /10.7.0.1/25 [/10.7.0.127]
        /10.6.0.1/23 [/10.6.1.255]
        /10.5.5.1/28 [/10.5.5.15]

This is the output from Java 1.8.0_25. Same output is produced with
existing version of NetworkInterface.c in JDK 9

dummy0 :
    Status: DOWN
    Hardware Address: 56:ffffffd4:fffffffd:ffffffc2:ffffffec:ffffff82:
    Loopback: false
    Point to Point: false
    Virtual: false
    Multicast: false
    MTU: 1500
    Bindings:
        /10.7.0.1/28 [/10.5.5.15]
        /10.6.0.1/28 [/10.5.5.15]
        /10.5.5.1/28 [/10.5.5.15]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20150120/6b133830/attachment-0001.html>


More information about the net-dev mailing list