RFR (S) JDK-8160174: java.net.NetworkInterface - fixes and improvements for network interface listing

Christos Zoulas christos at zoulas.com
Mon Jul 11 14:44:23 UTC 2016


On Jul 11,  1:36pm, christoph.langer at sap.com ("Langer, Christoph") wrote:
-- Subject: RE: RFR (S) JDK-8160174: java.net.NetworkInterface - fixes and im

| Hi Chris (or anyone who is holding a stake in the NetworkInterface native i=
| mplementation),
| 
| I've spent some time on cleaning up NetworkInterface.c and came up with a b=
| igger change: http://cr.openjdk.java.net/~clanger/webrevs/8160174.2/
| 
| With this I attempted to consolidate the interface listing functionality of=
|  the 2 main categories - one is ioctl (used on Linux IPv4, Solaris and AIX)=
|  and the other is getifaddrs (used on MacOS). I introduced some defines to =
| switch between the implementations. I also consolidated the functionality f=
| or the ioctl based network interface listings by using an #ifdef section to=
|  distinguish between the Linux/AIX versus Solaris field and constant names.=
| 
| 
| I've spent some time testing on the platforms and in principal it works. Bu=
| t as it is a matter of taste, I'd like to ask you if you support this type =
| of change or have any hints or recommendations before going forward to fina=
| lize this.
| 
| For Linux I'm also suggesting to use the getifaddrs approach - I tested and=
|  found it working everywhere and with this we could get rid of the implemen=
| tation to read /proc/net for IPv6.
| 
| Furthermore I'm generally setting Null for the IPv6 broadcast address - whi=
| ch I think is common sense for IPv6.
| 

Christoph,

I think that it is probably even better to create a getifaddrs(3)
compatibility layer for the OS's the still use ioctl(2), and put
all of it in a separate file.  You can probably use the code from
one of the BSD's with minor modifications.

Best,

christos


More information about the net-dev mailing list