[RFC] Fix socket.Connect() to throw a NoRouteToHostException when given an unreachable ip address

Omair Majid omajid at redhat.com
Fri Mar 27 07:22:10 PDT 2009


When using connect() in non-blocking mode, it can return an error other 
than EINPROGRESS immediately if there is no route to the host specified. 
The current implementation throws a ConnectException in this case. The 
Java program calling socket.Connect() receives a ConnectException 
instead of a NoRouteToHostException. The attached patch adds a check to 
deal with this case. The java/net/ipv6tests/TcpTest.java JTreg (jdk) 
test now passes with this fix for me.

2009-03-27  Omair Majid  <omajid at redhat.com>

     * patches/icedtea-network-unreachable.patch: New file. Check for
     EHOSTUNREACH and ENETUNREACH early on when establishing a
     * Makefile.am (ICEDTEA_PATCHES): Apply the above.
     * HACKING: Document the above.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: connect.patch
Type: text/x-patch
Size: 2942 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20090327/3118570f/connect.patch 

More information about the distro-pkg-dev mailing list