Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(12221)

Issue 11921043: code review 11921043: go.crypto/ssh: add workaround for broken port forwarding in (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by hanwen-google
Modified:
10 years, 8 months ago
Reviewers:
jmp
CC:
agl1, dfc, golang-dev
Visibility:
Public.

Description

go.crypto/ssh: add workaround for broken port forwarding in OpenSSH 5. Tested with OpenSSH_5.9

Patch Set 1 #

Patch Set 2 : diff -r c0932d3462e8 https://code.google.com/p/go.crypto #

Patch Set 3 : diff -r c0932d3462e8 https://code.google.com/p/go.crypto #

Total comments: 8

Patch Set 4 : diff -r c0932d3462e8 https://code.google.com/p/go.crypto #

Patch Set 5 : diff -r c0932d3462e8 https://code.google.com/p/go.crypto #

Patch Set 6 : diff -r c0932d3462e8 https://code.google.com/p/go.crypto #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+75 lines, -32 lines) Patch
M ssh/client.go View 1 2 chunks +3 lines, -0 lines 0 comments Download
M ssh/tcpip.go View 1 2 3 4 5 3 chunks +54 lines, -4 lines 1 comment Download
A ssh/tcpip_test.go View 1 2 3 4 5 1 chunk +16 lines, -0 lines 0 comments Download
M ssh/test/forward_unix_test.go View 1 2 chunks +2 lines, -28 lines 0 comments Download

Messages

Total messages: 8
hanwen-google
Hello agl@golang.org, dave@cheney.net (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go.crypto
10 years, 9 months ago (2013-07-26 14:56:49 UTC) #1
agl1
https://codereview.appspot.com/11921043/diff/7001/ssh/tcpip.go File ssh/tcpip.go (right): https://codereview.appspot.com/11921043/diff/7001/ssh/tcpip.go#newcode45 ssh/tcpip.go:45: var openSSHVersionRegexp = regexp.MustCompile("OpenSSH_([0-9]+)") regexps are great for human ...
10 years, 9 months ago (2013-07-26 15:06:22 UTC) #2
hanwen-google
https://codereview.appspot.com/11921043/diff/7001/ssh/tcpip.go File ssh/tcpip.go (right): https://codereview.appspot.com/11921043/diff/7001/ssh/tcpip.go#newcode45 ssh/tcpip.go:45: var openSSHVersionRegexp = regexp.MustCompile("OpenSSH_([0-9]+)") On 2013/07/26 15:06:22, agl1 wrote: ...
10 years, 9 months ago (2013-07-26 17:27:17 UTC) #3
agl1
*** Submitted as https://code.google.com/p/go/source/detail?r=752ba0444fdd&repo=crypto *** go.crypto/ssh: add workaround for broken port forwarding in OpenSSH 5. ...
10 years, 8 months ago (2013-07-26 18:38:05 UTC) #4
jmp
The random port picker in this CL is not really random. addr.Port = 1024 + ...
10 years, 8 months ago (2013-07-27 16:13:49 UTC) #5
hanwen-google
You're completely right. I had forgotten about the deterministic seed. I think we can init ...
10 years, 8 months ago (2013-07-28 22:33:11 UTC) #6
hanwen-google
*** Abandoned ***
10 years, 8 months ago (2013-07-29 13:00:42 UTC) #7
hanwen-google
10 years, 8 months ago (2013-07-29 13:14:17 UTC) #8
It produces the same sequence, but the random generator is shared with
everything else, and a second call will not start with the same port
number. That said,

this change

 https://codereview.appspot.com/12027043

should fix things.


On Sat, Jul 27, 2013 at 1:13 PM, Jonathan Pittman
<jonathan.mark.pittman@gmail.com> wrote:
> The random port picker in this CL is not really random.
>
> addr.Port = 1024 + rand.Intn(60000)
>
> It will always produce the same set of values each time.  For a loop of 10,
> they would be (in order):
>
> 39105
> 8911
> 32871
> 25083
> 23105
> 22342
> 15449
> 3564
> 41480
> 4324
>
> Is that acceptable for the purpose of this CL?  You could use crypto/rand,
> but simpler might be to have the seed change using something like:
>
> 1024 + rand.Intn(int(time.Now().Unix()%60000))
>
> This is still predictable, but it will generate different sets of values
> since the seed will change every second and only see a repeat every 60000
> seconds (16h40m).  I would think this is better than always trying the same
> first 10 ports each time it gets run.  See
> http://play.golang.org/p/wXlwVvwcOj for an example, but try running it on a
> local machine instead of in the playground since time in the playground is
> always the same.
>
>
> On Fri, Jul 26, 2013 at 2:38 PM, <agl@golang.org> wrote:
>>
>> *** Submitted as
>> https://code.google.com/p/go/source/detail?r=752ba0444fdd&repo=crypto
>> ***
>>
>>
>> go.crypto/ssh: add workaround for broken port forwarding in
>> OpenSSH 5.
>>
>> Tested with OpenSSH_5.9
>>
>> R=agl, dave
>> CC=golang-dev
>> https://codereview.appspot.com/11921043
>>
>> Committer: Adam Langley <agl@golang.org>
>>
>>
>>
>> https://codereview.appspot.com/11921043/diff/16001/ssh/tcpip.go
>> File ssh/tcpip.go (right):
>>
>> https://codereview.appspot.com/11921043/diff/16001/ssh/tcpip.go#newcode62
>> ssh/tcpip.go:62: fmt.Printf("V %q", versionStr[i:j])
>> Looks like debugging - will remove before landing.
>>
>>
>> https://codereview.appspot.com/11921043/
>>
>> --
>>
>> ---You received this message because you are subscribed to the Google
>> Groups "golang-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-dev+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>



-- 
Han-Wen Nienhuys
Google Munich
hanwen@google.com
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b