RFR: 7100957 : Java doesn't correctly handle the SOCKS protocol when used over IPv6
Chris Hegarty
chris.hegarty at oracle.com
Tue Jan 14 00:28:46 PST 2014
On 13 Jan 2014, at 19:29, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> On 13 Jan 2014, at 19:23, Dimitar Mavrodiev <dmavrodiev at gmail.com> wrote:
>
>> Hi Chris,
>>
>> I can't open the link, but yet I wouldn't mind if you folded your patch into mine.
>
> How embarrassing. Our public facing server is temporarily offline so I copied the webrev to a temporary server just to verify it, then obviously forgot it was an internal link. Sorry about this. I’ll repost a mail when the public server is back online.
http://cr.openjdk.java.net/~chegar/7100957/webrev.00/webrev/
-Chris.
>
> -Chris.
>
>>
>> Thanks,
>> Dimitar
>>
>> Sent from my mobile device.
>>
>> On Jan 13, 2014 9:11 PM, "Chris Hegarty" <chris.hegarty at oracle.com> wrote:
>> Hi Dimitar,
>>
>> Thank you for following up with this. I came to the same conclusion as you earlier today, though I noticed it because the test SocksServer was sending a single byte at a time, for the initial reply.
>>
>> I took your latest patch and applied a few minor cleanups, as follows:
>> http://t4.ie.oracle.com/~chhegar/webrevs/7100957/webrev.00/webrev/
>>
>> If you agree, I’ll fold my patch into yours, run the changes through our automated build and test system, then push if all passes ok.
>>
>> -Chris.
>>
>> On 13 Jan 2014, at 18:21, Dimitar Mavrodiev <dmavrodiev at gmail.com> wrote:
>>
>>> Hi Alan,
>>>
>>> I believe to have found and fixed what was causing the failures on Windows. Here's the webrev https://googledrive.com/host/0B2CI6Ih--1t5bVVwbVlBRmpVMDg/5/index.html.
>>>
>>> I modified java.net.SocksSocketImpl#readSocksReply(..) so that it doesn't give up on reading after the 3rd attempt, but instead keeps on trying until a timeout occurs or end of stream is reached (much like DataInputStream#readFully(..)).
>>>
>>> -Dimitar
>>>
>>> On Sat, Jan 11, 2014 at 2:58 PM, Dimitar Mavrodiev <dmavrodiev at gmail.com> wrote:
>>> Hi Alan,
>>>
>>> I finally had the chance to put together a windows build environment(Win7) and I'm now seeing the same error crop up every once in a while.
>>>
>>> To isolate the problem I replaced the socks server (jdk/test/java/net/Socks/SocksServer.java) I've been using in my test with JSocks and the test now runs successfully (I ran it at least a dozen of times). The culprit for these intermittent failures on Windows seems to be jdk/test/java/net/Socks/SocksServer.java, I haven't exactly located the problem yet.
>>>
>>> -Dimitar
>>>
>>>
>>> On Wed, Jan 8, 2014 at 12:08 PM, Dimitar Mavrodiev <dmavrodiev at gmail.com> wrote:
>>> Unfortunately I don't have a Windows environment. I'll try to setup one and look into this.
>>>
>>> -Dimitar
>>>
>>>
>>> On Tue, Jan 7, 2014 at 11:36 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>>> On 07/01/2014 12:29, Dimitar Mavrodiev wrote:
>>> Hi Alan,
>>>
>>> I've fixed that. Here's the webrev https://googledrive.com/host/0B2CI6Ih--1t5bVVwbVlBRmpVMDg/4/index.html.
>>>
>>> Thanks for the update, it seems to be okay now for IPv6 disabled case.
>>>
>>> One thing I do see though is that the test fails intermittently on Windows (in my case Windows Server 2012) when IPv6 is enabled. The typical output is attached. I haven't dug into yet.
>>>
>>> -Alan
>>>
>>> [TestNG] Running:
>>> java/net/Socks/SocksIPv6Test.java
>>>
>>> config SocksIPv6Test.setUp(): success
>>> test SocksIPv6Test.testSocksOverIPv6(): failure
>>> java.net.SocketException: Reply from SOCKS server has bad length
>>> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:505)
>>> at java.net.Socket.connect(Socket.java:585)
>>> at java.net.Socket.connect(Socket.java:534)
>>> at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
>>> at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
>>> at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
>>> at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
>>> at sun.net.www.http.HttpClient.New(HttpClient.java:308)
>>> at sun.net.www.http.HttpClient.New(HttpClient.java:326)
>>> at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1122)
>>> at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1101)
>>> at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:942)
>>> at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:940)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.security.AccessController.doPrivileged(AccessController.java:713)
>>> at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:939)
>>> at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:886)
>>> at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1466)
>>> at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90)
>>> at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1386)
>>> at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1384)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.security.AccessController.doPrivileged(AccessController.java:713)
>>> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1383)
>>> at SocksIPv6Test.testSocksOverIPv6(SocksIPv6Test.java:133)
>>>
>>>
>>>
>>>
>>
>
More information about the net-dev
mailing list