1040N/A/*
3261N/A * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
1040N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1040N/A *
1040N/A * This code is free software; you can redistribute it and/or modify it
1040N/A * under the terms of the GNU General Public License version 2 only, as
1040N/A * published by the Free Software Foundation.
1040N/A *
1040N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1040N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1040N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1040N/A * version 2 for more details (a copy is included in the LICENSE file that
1040N/A * accompanied this code).
1040N/A *
1040N/A * You should have received a copy of the GNU General Public License version
1040N/A * 2 along with this work; if not, write to the Free Software Foundation,
1040N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1040N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1040N/A */
1040N/A
1040N/Aimport java.io.File;
1040N/Aimport java.io.IOException;
1040N/Aimport java.net.NetworkInterface;
1040N/Aimport java.net.InetAddress;
1040N/Aimport java.util.Scanner;
1040N/Aimport java.util.Enumeration;
1040N/A
1040N/A/**
1040N/A * Probes for InfiniBand devices plumbed with IP addresses.
1040N/A */
1040N/A
1040N/Apublic class ProbeIB {
1040N/A public static void main(String[] args) throws IOException {
2736N/A Scanner s = new Scanner(new File(args[0]));
1040N/A try {
1040N/A while (s.hasNextLine()) {
2736N/A String link = s.nextLine();
2736N/A NetworkInterface ni = NetworkInterface.getByName(link);
1040N/A if (ni != null) {
1040N/A Enumeration<InetAddress> addrs = ni.getInetAddresses();
1040N/A while (addrs.hasMoreElements()) {
2736N/A InetAddress addr = addrs.nextElement();
2736N/A System.out.println(addr.getHostAddress());
1040N/A }
1040N/A }
1040N/A }
1040N/A } finally {
1040N/A s.close();
1040N/A }
1040N/A }
1040N/A}