www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: Bad window size in WINDOW_ADJUST from SSH.COM ssh server

Bad window size in WINDOW_ADJUST from SSH.COM ssh server

From: <robs_maillists_at_cotrone.com>
Date: Thu, 11 Jun 2009 15:21:48 -0400

There seems to be an issue with libssh2 1.1 with SFTP while opening a
transfer with ssh.com SSH server.

We initially had curl and libssh2 0.18 but that was failing when
sending to a Globescape sftp server.

We upgraded to libssh2 1.1 and now it is failing to ssh.com SSH server.
I've also tested with the latest 1.1.1-20090611 release.

When doing an SFTP via the example code sftp_write.c and sftpdir.c to
ssh.com ssh server.

The connection fails with "Bad window size in WINDOW_ADJUST"

On the server it says
sshd2[28945]: [ID 702911 auth.info] Local disconnected: Bad window
size in WINDOW_ADJUST.
sshd2[28945]: [ID 702911 auth.warning] Protocol error in local: 'Bad
window size in WINDOW_ADJUST.'

on the libssh2 trace it says.

[libssh2] 1.693161 Transport: Disconnect(2): Bad window size in
WINDOW_ADJUST.(en)

I enabled debugging in the log and received the following log (as
enclosed at the bottom).

What I did notice that is different from libssh 0.18 is the size of a
window adjust as copied.

[libssh2] 1.337098 Conn: Adjusting window 39321600 bytes for data on
channel 0/0 ....

In the libssh2 0.18 it said Queueing 37 bytes rather then this large buffer.

In checking possible boundary limits in the ssh.com source for 3.2.9
(Old I know, but there are a huge number of our machines running it).

I found the following chunk.

   /* Check that the window size is sensible. */
   if (bytes_to_add < 0 || bytes_to_add > MAX_WINDOW_SIZE ||
       channel->outgoing_window_remaining + bytes_to_add > MAX_WINDOW_SIZE)
     {
       ssh_conn_send_disconnect(conn, SSH_DISCONNECT_PROTOCOL_ERROR,
                                "Bad window size in WINDOW_ADJUST.");
       return;
     }

which resolved to
sshconn.c:#define MAX_WINDOW_SIZE (16*1024*1024)

This fails going to

SSH-1.99-3.2.0 SSH Secure Shell
SSH-2.0-3.2.9 SSH Secure Shell
SSH-2.0-4.4.4.44 SSH Secure Shell

I have not tried with later versions as we do not have a license.

What is the proper max window size?
Is there anyway to for a limit in libssh2 so I can communicate with
the SSH.COM server?

Related links.
http://www.ssh.com/products/infrastructure/client-server/

TRACELOG

libssh2_sftp_init()!
[libssh2] 1.288981 SFTP: Initializing SFTP subsystem
[libssh2] 1.288987 Conn: Allocated new channel ID#0
[libssh2] 1.288992 Conn: Opening Channel - win 65536 pack 32768
=> libssh2_transport_write plain (24 bytes)
0000: 5a 00 00 00 07 73 65 73 73 69 6f 6e 00 00 00 00 Z....session....
0010: 00 01 00 00 00 00 80 00 ........
=> libssh2_transport_write send() (68 bytes)
0000: a1 46 3d cb 70 85 6e 31 08 96 9c 7d 86 12 d1 c9 .F=.p.n1...}....
0010: 02 8f b1 53 cd d4 ca 6c ab ed 4f 31 8b 99 c6 de ...S...l..O1....
0020: f1 8b 51 0e 84 8f b1 70 18 53 07 7f bb 6f fc 3b ..Q....p.S..o.;
0030: b1 1c 16 b9 43 de 2e bb 1c bc 2f be 12 78 cf 28 ....C...../..x.(
0040: 25 b9 53 48 %.SH
[libssh2] 1.289769 Transport: Looking for packet of type: 91
[libssh2] 1.289777 Transport: Looking for packet of type: 92
[libssh2] 1.289784 Failure Event: -37 - Would block
[libssh2] 1.289789 Failure Event: -37 - Would block starting up channel
[libssh2] 1.290389 Transport: Looking for packet of type: 91
[libssh2] 1.290396 Transport: Looking for packet of type: 92
=> libssh2_transport_read() raw (88 bytes)
0000: 66 e6 04 43 82 39 34 e5 7e eb 94 b2 ca 52 26 c1 f..C.94.~....R&.
0010: 13 db 57 7c 5f c6 9f 2a 26 33 e3 38 37 1f d9 09 ..W|_..*&3.87...
0020: e2 55 0f 09 1e 05 6d 96 4f 8d f6 1b cc 36 d0 ea .U....m.O....6..
0030: db 31 8f 08 ec fd 22 36 53 6a 97 c2 2a 59 d7 87 .1...."6Sj..*Y..
0040: 28 05 a2 5e 1c 43 ef 34 64 8f 9c e4 e7 60 e2 cd (..^.C.4d....`..
0050: 22 06 15 37 42 8f 64 f5 "..7B.d.
=> libssh2_transport_read() plain (5 bytes)
0000: 02 00 00 00 00 .....
[libssh2] 1.290753 Transport: Packet type 2 received, length=5
=> libssh2_transport_read() plain (17 bytes)
0000: 5b 00 00 00 00 00 00 00 00 00 01 86 a0 00 00 80 [...............
0010: 00 .
[libssh2] 1.291262 Transport: Packet type 91 received, length=17
[libssh2] 1.291271 Transport: Looking for packet of type: 91
[libssh2] 1.291275 Conn: Connection Established - ID: 0/0 win:
100000/65536 pack: 32768/32768
[libssh2] 1.291288 Conn: starting request(subsystem) on channel 0/0,
message=sftp
=> libssh2_transport_write plain (27 bytes)
0000: 62 00 00 00 00 00 00 00 09 73 75 62 73 79 73 74 b........subsyst
0010: 65 6d 01 00 00 00 04 73 66 74 70 em.....sftp
=> libssh2_transport_write send() (68 bytes)
0000: cd 47 2f 75 22 1a 75 5b 0f 9e 2d e6 4e 88 b0 03 .G/u".u[..-.N...
0010: a8 d9 a0 58 20 1d 4f 7c c6 a0 63 73 95 48 02 db ...X .O|..cs.H..
0020: 92 a1 7d 4e e5 c9 63 28 32 65 77 34 ad d5 f7 1a ..}N..c(2ew4....
0030: e9 2e b2 fc 8a 3c de ae 7c d4 34 91 55 dd 52 98 .....<..|.4.U.R.
0040: 87 9d b1 f2 ....
[libssh2] 1.292090 Transport: Looking for packet of type: 99
[libssh2] 1.292091 Transport: Looking for packet of type: 100
[libssh2] 1.292091 Failure Event: -37 - Would block to request SFTP subsystem
[libssh2] 1.296930 Transport: Looking for packet of type: 99
[libssh2] 1.296940 Transport: Looking for packet of type: 100
=> libssh2_transport_read() raw (72 bytes)
0000: 39 2d 57 97 e4 71 af 77 9c c9 d7 f5 b7 30 8e 20 9-W..q.w.....0.
0010: cc 68 72 19 8c 42 ee d8 97 e9 46 07 e1 3a 20 49 .hr..B....F..: I
0020: 2a b0 30 28 ab 1a 09 8f c4 e6 65 fd c3 16 60 78 *.0(......e...`x
0030: 2c 87 d7 b5 cb 1d 60 f3 1c 72 f4 0f 6c 5a e8 f7 ,.....`..r..lZ..
0040: 63 c5 78 b3 fa b4 5c 1e c.x...\.
=> libssh2_transport_read() plain (5 bytes)
0000: 02 00 00 00 00 .....
[libssh2] 1.297460 Transport: Packet type 2 received, length=5
=> libssh2_transport_read() plain (5 bytes)
0000: 63 00 00 00 00 c....
[libssh2] 1.297465 Transport: Packet type 99 received, length=5
[libssh2] 1.297468 Transport: Looking for packet of type: 99
[libssh2] 1.297471 Conn: Setting channel 0/0 handle_extended_data mode to 1
[libssh2] 1.297474 SFTP: Sending FXP_INIT packet advertising version 3 support
[libssh2] 1.297477 Conn: Writing 9 bytes on channel 0/0, stream #0
[libssh2] 1.297479 Conn: Sending 9 bytes on channel 0/0, stream_id=0
=> libssh2_transport_write plain (18 bytes)
0000: 5e 00 00 00 00 00 00 00 09 00 00 00 05 01 00 00 ^...............
0010: 00 03 ..
=> libssh2_transport_write send() (52 bytes)
0000: e9 f6 79 54 31 a0 a8 57 be 3a 07 df 6f d7 e0 38 ..yT1..W.:..o..8
0010: 4f de 14 cd 4e 27 d1 76 77 fd d4 34 4e 1f c4 48 O...N'.vw..4N..H
0020: 4e a0 06 35 03 01 c2 4c 54 e6 3e 42 52 9e b2 02 N..5...LT.>BR...
0030: 47 71 bb 8f Gq..
[libssh2] 1.298033 SFTP: Requiring packet 2 id 0
[libssh2] 1.298038 SFTP: Asking for 2 packet
[libssh2] 1.298042 SFTP: recv packet
[libssh2] 1.298046 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0
[libssh2] 1.337095 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0
=> libssh2_transport_read() raw (120 bytes)
0000: 1a 2c 34 58 6e 7d bd 21 fd c0 fe ed 2f 18 ed ab .,4Xn}.!..../...
0010: 78 9e 0e ea a1 9f 57 b6 7b 4a 2b 3a 9b 45 0d 21 x.....W.{J+:.E.!
0020: aa 4a b5 25 fd 30 a9 8f b1 fd 90 f5 d9 8c cb 7d .J.%.0.........}
0030: 55 42 57 eb 85 af 7f e5 84 8e 20 a1 a1 79 23 00 UBW...... ..y#.
0040: 17 e3 76 ff 27 3e c5 92 a5 43 78 7a 77 a4 ac 86 ..v.'>...Cxzw...
0050: a3 12 00 b3 60 5e 5c 9e 46 91 bd bb 74 a8 a9 90 ....`^\.F...t...
0060: a2 89 2e 59 58 c5 cd ae 22 81 8c db 2b fd c8 46 ...YX..."...+..F
0070: a3 3b 97 bf e5 67 98 b8 .;...g..
=> libssh2_transport_read() plain (5 bytes)
0000: 02 00 00 00 00 .....
[libssh2] 1.337096 Transport: Packet type 2 received, length=5
=> libssh2_transport_read() plain (46 bytes)
0000: 5e 00 00 00 00 00 00 00 25 00 00 00 21 02 00 00 ^.......%...!...
0010: 00 03 00 00 00 13 6e 65 77 6c 69 6e 65 40 76 61 ......newline_at_va
0020: 6e 64 79 6b 65 2e 63 6f 6d 00 00 00 01 0a ndyke.com.....
[libssh2] 1.337097 Transport: Packet type 94 received, length=46
[libssh2] 1.337097 Conn: 37 bytes packet_add() for 0/0/0
[libssh2] 1.337098 Conn: channel_read() got 4 of data from 0/0/0
[libssh2] 1.337098 Conn: Adjusting window 39321600 bytes for data on
channel 0/0
=> libssh2_transport_write plain (9 bytes)
0000: 5d 00 00 00 00 02 58 00 00 ].....X..
=> libssh2_transport_write send() (52 bytes)
0000: 4b c7 13 76 b5 64 0b e4 83 0d 69 df 57 82 50 b2 K..v.d....i.W.P.
0010: 42 e5 c9 76 df 7d f5 6b 64 2e 1e 09 16 89 58 26 B..v.}.kd.....X&
0020: 52 55 60 d7 69 78 b6 ba 50 50 a4 4a 46 9d 2d 13 RU`.ix..PP.JF.-.
0030: 9d a9 19 0e ....
[libssh2] 1.337927 Conn: channel_read() filled 4 adjusted 4
[libssh2] 1.337932 SFTP: Data begin - Packet Length: 33
[libssh2] 1.337938 Conn: channel_read() got 33 of data from 0/0/0 [ul]
[libssh2] 1.337943 SFTP: Received packet 2 (len 33)
[libssh2] 1.337948 SFTP: Asking for 2 packet
[libssh2] 1.337952 SFTP: Got 2
[libssh2] 1.337956 SFTP: Enabling SFTP version 3 compatability
libssh2_sftp_open()!
[libssh2] 1.337986 SFTP: Sending file open request
[libssh2] 1.337992 Conn: Writing 34 bytes on channel 0/0, stream #0
[libssh2] 1.337997 Conn: Sending 34 bytes on channel 0/0, stream_id=0
=> libssh2_transport_write plain (43 bytes)
0000: 5e 00 00 00 00 00 00 00 22 00 00 00 1e 03 00 00 ^.......".......
0010: 00 00 00 00 00 09 74 65 73 74 2e 66 69 6c 65 00 ......test.file.
0020: 00 00 1a 00 00 00 04 00 00 81 a4 ...........
=> libssh2_transport_write send() (84 bytes)
0000: ea 99 53 b0 0e ff 26 97 7d e4 0a b6 dd c0 fe ab ..S...&.}.......
0010: a5 51 67 20 1f c0 4c b9 f2 52 39 46 5f 82 0c 9d .Qg ..L..R9F_...
0020: 41 2c d9 67 e6 1f eb f2 09 d4 ba a2 65 0a f0 07 A,.g........e...
0030: bd 5b 13 23 0f 52 ca b5 7d 3d de d5 43 cc d9 ea .[.#.R..}=..C...
0040: 09 61 3c 39 81 cf ea e6 7e 45 ba b8 d1 47 d9 72 .a<9....~E...G.r
0050: 5a 17 1e b4 Z...
[libssh2] 1.339959 SFTP: Asking for 102 packet
[libssh2] 1.339966 SFTP: Asking for 101 packet
[libssh2] 1.339969 SFTP: recv packet
=> libssh2_transport_read() raw (120 bytes)
0000: 95 f9 e1 f7 73 d0 6d ce 38 e4 aa 24 b6 d9 be 4f ....s.m.8..$...O
0010: ba 1f d9 2f 1f e3 e3 f7 cd 7b 2a 28 51 24 e4 1a .../.....{*(Q$..
0020: 8a b9 ce ea 5d 1d ea d9 46 2d 61 d4 d6 ec 4e 65 ....]...F-a...Ne
0030: 08 ff fe e8 a5 ff 3f 19 6e ef fd 4b f2 4c 48 c4 ......?.n..K.LH.
0040: 9e 6a 04 6b 34 9a 39 4a ab 2d 8d d8 b8 d6 44 d5 .j.k4.9J.-....D.
0050: f2 db e1 70 0d e9 ed 68 83 a8 1f 6e 8d 1a 34 39 ...p...h...n..49
0060: 86 c7 8b 30 5b 2d 1c ba e5 06 40 a1 26 8f 5b a2 ...0[-....@.&.[.
0070: 32 e4 a2 36 ab ff 7e 6f 2..6..~o
=> libssh2_transport_read() plain (5 bytes)
0000: 02 00 00 00 00 .....
[libssh2] 1.341203 Transport: Packet type 2 received, length=5
[libssh2] 1.341215 Conn: channel_read() wants 4 bytes from channel 0/0
stream #0
=> libssh2_transport_read() plain (48 bytes)
0000: 01 00 00 00 02 00 00 00 21 42 61 64 20 77 69 6e ........!Bad win
0010: 64 6f 77 20 73 69 7a 65 20 69 6e 20 57 49 4e 44 dow size in WIND
0020: 4f 57 5f 41 44 4a 55 53 54 2e 00 00 00 02 65 6e OW_ADJUST.....en
[libssh2] 1.341463 Transport: Packet type 1 received, length=48
[libssh2] 1.341466 Transport: Disconnect(2): Bad window size in
WINDOW_ADJUST.(en)
[libssh2] 1.341468 Failure Event: -30 - Timeout waiting for FXP packet
[libssh2] 1.341471 Failure Event: -30 - Timeout waiting for status message
Unable to open file with SFTP
[libssh2] 1.341673 Transport: Disconnecting: reason=11, desc=Normal
Shutdown, Thank you for playing, lang=
=> libssh2_transport_write plain (51 bytes)
0000: 01 00 00 00 0b 00 00 00 26 4e 6f 72 6d 61 6c 20 ........&Normal
0010: 53 68 75 74 64 6f 77 6e 2c 20 54 68 61 6e 6b 20 Shutdown, Thank
0020: 79 6f 75 20 66 6f 72 20 70 6c 61 79 69 6e 67 00 you for playing.
0030: 00 00 00 ...
=> libssh2_transport_write send() (84 bytes)
0000: 70 85 16 4c c6 40 c9 d3 cb 61 d0 e8 08 ca ba 10 p..L.@...a......
0010: a1 9f 10 f2 12 48 bd 0d b2 78 b4 20 f5 6c f0 e7 .....H...x. .l..
0020: 83 a4 6d 3c bc 5d 48 bc 42 25 61 4a aa bd 7c 1a ..m<.]H.B%aJ..|.
0030: c5 a7 dd fe 8f 3b e3 af 66 d3 f2 d9 cf cb 2b 27 .....;..f.....+'
0040: 17 9b b4 89 ec 16 e1 df 89 76 4f 39 8c 5f 69 fe .........vO9._i.
0050: df e8 8d 96 ....
[libssh2] 1.342890 Transport: Freeing session resource
Trying: 172.24.15.7:22 with: SSH-2.0-libssh2_1.1
Connected to: potassiumb.intdata.com[172.24.15.7]:22 SSH-2.0-3.2.9 SSH
Secure Shell.
Fingerprint: 60 99 60 D1 7B 50 2F 94 55 33 22 3C 88 5C F7 CC
all done

----------------------------------------------------------------
http://www.hostcube.com/ - Managed and unmanaged Xen based VPSes

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-06-11

the libssh2 team