Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4922568

IsReachable returns true for IPv6

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      sparc
    • OS:
      solaris_7
    • Verification:
      Verified

      Description

      The IsReachable API returns true for IPv6 addresses from an IPv4 solaris host.

      Steps to reproduce the bug :
      1. Copy the code below to a file.
      2. Compile the code.
      3. Execute the code by giving an IPv6 address on the command line.
      4. An Exception should be thrown or a false value should be returned.

      -----------------BEGIN CODE-----------------------------
      import java.net.*;
      import java.io.*;

      public class IsHostReachableBug {
          public static void main(String[] args) throws Exception{
                      String hostName = "yamlok.india";
                      BufferedReader in = null;
                      FileWriter fw = null;
                      String inString = " ";
                      if (args.length > 0)
                              hostName = args[0];

                      InetAddress addr = InetAddress.getByName(hostName);
                      System.out.println("InetAddress is : " + addr);
                      System.out.println("Is InetAddress instance of Inet6Address ? " + (addr instanceof Inet6Address));
                      if (!addr.isReachable(10000)){
                              System.out.println(hostName + " is not reachable");
                      }else {
                              System.out.println(hostName + " is reachable");
                      }


          }
      }
      ----------------END CODE----------------------------

      ---------------BEGIN OUTPUT-------------------------
      sqindia: <150> $$JHOME/bin/java IsHostReachableBug fe80::a00:20ff:fefe:3440
      InetAddress is : /fe80:0:0:0:a00:20ff:fefe:3440
      Is InetAddress instance of Inet6Address ? true
      fe80::a00:20ff:fefe:3440 is reachable
      sqindia: <151> $
      sqindia: <151> $
      sqindia: <151> $ping fe80::a00:20ff:fefe:3440
      ping: unknown host fe80::a00:20ff:fefe:3440
      sqindia: <152> $
      sqindia: <152> $
      sqindia: <152> $ifconfig -a
      lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232
              inet 127.0.0.1 netmask ff000000
      hme0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
              inet 10.12.151.12 netmask ffffff00 broadcast 10.12.151.255
      sqindia: <153> $
      --------------------------END OUTPUT---------------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jccollet Jean-Christophe Collet (Inactive)
              Reporter:
              kjethisunw Kanishk Jethi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: