[kaffe] CVS kaffe (guilhem): Fix for getAllByName when it is dealing with IPV6 address.

Kaffe CVS cvs-commits at kaffe.org
Tue Sep 9 09:37:02 PDT 2003


PatchSet 4022 
Date: 2003/09/09 16:34:58
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fix for getAllByName when it is dealing with IPV6 address.

Members: 
	ChangeLog:1.1618->1.1619 
	libraries/javalib/java/net/InetAddress.java:1.16->1.17 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1618 kaffe/ChangeLog:1.1619
--- kaffe/ChangeLog:1.1618	Fri Sep  5 23:12:54 2003
+++ kaffe/ChangeLog	Tue Sep  9 16:34:58 2003
@@ -1,3 +1,9 @@
+2003-09-09  Guilhem Lavaux <guilhem at kaffe.org>
+
+	* libraries/javalib/java/net/InetAddress.java:
+	(getAllByName) check whether getHostByName returns IPV6 address. If it
+	is the case we build Inet6Address instead of InetAddress.
+
 2003-09-05  Jim Pick  <jim at kaffe.org>
 
 	* include/kaffe/jmalloc.h:
Index: kaffe/libraries/javalib/java/net/InetAddress.java
diff -u kaffe/libraries/javalib/java/net/InetAddress.java:1.16 kaffe/libraries/javalib/java/net/InetAddress.java:1.17
--- kaffe/libraries/javalib/java/net/InetAddress.java:1.16	Fri Sep  5 17:56:57 2003
+++ kaffe/libraries/javalib/java/net/InetAddress.java	Tue Sep  9 16:35:00 2003
@@ -306,14 +306,18 @@
 
     for (int i = 0; i < iplist.length; i++)
       {
-        if (iplist[i].length != 4)
+        if (iplist[i].length != 4 && iplist[i].length != 16)
           throw new UnknownHostException (hostname);
 
         // Don't store the hostname in order to force resolution of the
         // canonical names of these ip's when the user asks for the hostname
         // But do specify the host alias so if the IP returned won't
         // reverse lookup we don't throw an exception.
-        addresses[i] = new InetAddress (iplist[i], null, hostname);
+	// If the length is equal to 16 this is an IPV6 address.
+	if (iplist[i].length == 16)
+	  addresses[i] = new Inet6Address (iplist[i], hostname);
+	else
+	  addresses[i] = new InetAddress (iplist[i], null, hostname);
       }
 
     addToCache (hostname, addresses);




More information about the kaffe mailing list