java.net.NetworkInterface.getNetworkInterfaces does not work properly on AIX with IPv6
neil.richards at ngmr.net
Thu Oct 20 06:16:26 PDT 2011
On Thu, 2011-10-20 at 17:12 +0800, Jonathan Lu wrote:
> On 10/20/2011 02:35 PM, Steve Poole wrote:
> Thanks Steve, I've updated the test case and patch, see the attachments.
> I've added IBM portions copyright comment to both headers.
> - Jonathan
For ease of review, I've uploaded the suggested fix as a webrev .
Whilst creating this, I stripped the (large amount of) extraneous
trailing whitespace characters from the lines added by the patch.
(It would be helpful to check for this when posting patches).
Looking at the change, I have some concerns.
Firstly, the added AIX-specific code (between lines 1102-1187) has been
placed in a block of code that looks to be Linux-specific (lines
1013-1365, protected by '#ifdef __linux__').
So it's unclear why any of this code will be used by AIX.
Secondly, if an exception occurs whilst the list of interfaces is being
compiled, both Linux and Solaris look to return the list compiled up to
the point of the exception (blocks starting at lines 1222 & 1505).
In the suggested AIX code, however, the compiled interface list is freed
up in this situation, and NULL returned (block starting at line 1174).
It seems to me that these routines should present similar semantics
(across the 3 platforms).
As the interface list returned is an augmentation of an interface list
that is originally given to the function (the original value of 'ifs'),
the suggested AIX code may free off entries in the list that it was not
responsible for allocating, which runs the risk of resulting in
duplicate calls to free().
Could you please investigate where the responsibilities properly lie for
allocation and deallocation of the entries in the interface list given
to the enumIPv6Interfaces() function, then update the proposal /
Also, I'm concerned that the name of the testcase provided is overly
vague (what _specifically_ about NetworkInterface does it test?), and
that the @summary description does not describe what the intention of
the test is.
In particular, there is nothing platform-specific about the testcase, so
I would not expect its description to be in terms of something
Hope this helps,
Unless stated above:
IBM email: neil_richards at uk.ibm.com
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
More information about the net-dev