Bug 2124 - TCP_NODELAY not set by sshd for non-interactive non-exec sessions
Summary: TCP_NODELAY not set by sshd for non-interactive non-exec sessions
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: -current
Hardware: All All
: P5 trivial
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_6_3
  Show dependency treegraph
 
Reported: 2013-07-03 10:23 AEST by Arthur Liu
Modified: 2015-08-11 23:02 AEST (History)
2 users (show)

See Also:


Attachments
call packet_set_interactive() when -N set (652 bytes, patch)
2013-07-12 10:40 AEST, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Liu 2013-07-03 10:23:16 AEST
Bugs #556 and #981 describe situations where TCP_NODELAY is not set. A fix is provided in bug #556. However, the patch commit for packet.c in revision 1.120 does not set TCP_NODELAY for all connections.

If the ssh client is invoked with:
ssh -N host -R port          # TCP_NODELAY is not set
ssh -n host -R port sleep 1d # TCP_NODELAY is set - this is a workaround

There is a difference in TCP_NODELAY being set or not depending on whether there is a remote command being executed. This is because packet_set_interactive() is only called in do_exec() on the server side.
This bug has the unfortunate effect of not setting TCP_NODELAY for port forwarding only connections.

The proper fix is probably to use attachment 1099 [details] by Darren Tucker that sets it for all connections on the server side.
https://bugzilla.mindrot.org/show_bug.cgi?id=556#c10
https://bugzilla.mindrot.org/attachment.cgi?id=1099&action=diff

Issue present is in OpenSSH 4.4 through to 6.2 and -current.
Comment 1 Damien Miller 2013-07-12 10:40:02 AEST
Created attachment 2311 [details]
call packet_set_interactive() when -N set

I think this is better - it sets the QoS too and uses the presence of a multiplexing socket to infer interactivity.
Comment 2 Arthur Liu 2013-07-12 12:07:56 AEST
Thanks for the fix. It fixes the client side socket, which has the issue as well (we worked around it by using -tt flag). With your fix it fixes traffic ssh->sshd.

However, TCP_NODELAY is still not set for the TCP socket on sshd's side (for traffic sshd->ssh), which the original attachment 1099 [details] fixes.
Comment 3 Damien Miller 2013-07-12 15:49:16 AEST
fix applied. This will be in openssh-6.3. Thanks!
Comment 4 Damien Miller 2015-08-11 23:02:52 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1