On 10/19/2011 06:03 PM, Steve Poole wrote:
On Mon, 2011-10-17 at 15:14 +0800, Jonathan Lu wrote:
Hi net-devs,
I've got a problem on AIX operating system when IPv6 is enabled,which
can be easily reproduced by attached test case NetworkInterfaceTest.java.
On AIX paltform, the /proc file system behaves differently from Linux,
so we cannot just read required lines from /proc/net/if_inet6 but to
call ioctl to get needed information. A patch is available for OpenJDK8
code base, see attachment patch.diff.
Is anybody interested in this topic?
I'm quite aware of the fact that so far there's no publicly available
building scripts for OpenJDK8 on AIX operating system, but before
everything settles down, is anybody willing to review the patch? any
ideas about how to integrate it?
Best regards!
Hi Jonathan - can you add a copyright header to the testcase and see if
you can make the testcase fit into a jtreg test format?
Hi Steve,
Thanks for your suggestion.
I've updated the test case to fit into a jtreg format, see the
attachment NetworkInterfaceTest.java.
- Jonathan
/*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import java.net.*;
import java.util.*;
/* @test NetworkInterfaceTest
* @summary java.net.NetworkInterface.getNetworkInterfaces() does not work properly on AIX with IPv6
*/
public class NetworkInterfaceTest {
java.net.NetworkInterface pnics;
java.util.Enumeration nics1;
NetworkInterfaceTest() throws Exception{
java.net.NetworkInterface jnic;
java.util.Enumeration<NetworkInterface> nics;
List lst = new ArrayList();
List lst1 = new ArrayList();
try {
nics = java.net.NetworkInterface.getNetworkInterfaces();
while (nics.hasMoreElements()) {
jnic = (java.net.NetworkInterface) nics.nextElement();
lst = jnic.getInterfaceAddresses();
nics1 = jnic.getInetAddresses();
while (nics1.hasMoreElements()) {
InetAddress addr1 = (InetAddress) nics1.nextElement();
if (!(lst1.contains(addr1))) {
lst1.add(addr1);
}
}
if(lst.size() != lst1.size()){
throw new Exception("NetworkInterfaceTest Failed");
}
lst1.clear();
}
} catch (java.lang.Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception{
new NetworkInterfaceTest();
}
}