[ 
https://issues.apache.org/jira/browse/SSHD-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17580920#comment-17580920
 ] 

Thomas Wolf commented on SSHD-1287:
-----------------------------------

[~lgoldstein] I wrote about packet sizes, not window sizes, and I didn't say 
anywhere anything about not having any limits. The maximum SFTP message length 
that OpenSSH supports is 256kB, and the maximum buffer size is 255kB.

The server's maximum STFP read buffer size of 63kB is particularly unfortunate 
in Apache MINA sshd, since it will lead to gaps of about 1kB if a packet size 
of 64kB (or 64kB - 13) is used. That can't be anywhere near optimal.

> Use the maximum packet size of the communication partner
> --------------------------------------------------------
>
>                 Key: SSHD-1287
>                 URL: https://issues.apache.org/jira/browse/SSHD-1287
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.8.0
>            Reporter: Ryosuke Kanda
>            Assignee: Thomas Wolf
>            Priority: Minor
>         Attachments: ClientMain.java, ConsoleLog, ServerMain.java
>
>
> It appears that SSHD may use the maximum packet size presented by the 
> communicating party to request reception.
> RFC 4254 contains the following statement, where "maximum packet size" can be 
> read as "the maximum packet size that the sender is willing to accept" (as in 
> "initial window size").
> {code:java}
> Section 5.1 Opening a Channel
> The 'maximum packet size' specifies the maximum size of 
> 2an individual data packet that can be sent to the sender.{code}
> The client/server must comply with its own declared maximum packet size.
>  
> I encountered this issue when I was using "freeSSHd" as an SFTP server.
> The version of freeSSHd is 1.3.1.
> The event is confirmed by creating a server with SSHD.
> Attached are the client and server sources, as well as the client debug logs 
> (up to the first read request).
> When communicating with these, the client knows that its maximum packet size 
> is "32768" and the server's maximum packet size is "65536".
> {code:java}
> // client window
> [main] DEBUG org.apache.sshd.common.channel.Window - 
> init(Window[client/local](SftpChannelSubsystem[id=0, 
> recipient=-1]-ClientSessionImpl[user@localhost/127.0.0.1:10022][sftp])) 
> size=2097152, max=2097152, packet=32768
> // server window
> [sshd-SshClient[5702b3b1]-nio2-thread-3] DEBUG 
> org.apache.sshd.common.channel.Window - 
> init(Window[client/remote](SftpChannelSubsystem[id=0, 
> recipient=0]-ClientSessionImpl[user@localhost/127.0.0.1:10022][sftp])) 
> size=2097152, max=2097152, packet=65536 {code}
> And when requesting to receive a file, it requests to read 65536 bytes at a 
> time. This means that it attempts to receive packets that exceed 32768 bytes.
> {code:java}
> [main] TRACE org.apache.sshd.sftp.client.impl.SftpInputStreamAsync - 
> sendRequests(SftpInputStreamAsync[ClientSessionImpl[user@localhost/127.0.0.1:10022]][/data4M.txt])
>  enqueue pending ack: SftpAckData[id=103, offset=0, length=65536] {code}
>  
> I hope this report is helpful.
> I am doing machine translation, so please allow it to be unnatural.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to