How do SSH tunnels handle TCP RSTs on either side?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Say I have an SSH tunnel from my local machine to a database on a remote server.



If I send a query into the tunnel, it comes out on the other side, but halfway through sending the query or receiving the result the Database triggers a TCP RST, how does SSH handle that?



Does it:



  1. Wait to ACK packets on either side until it has received an ACK from the endpoints?

  2. Buffer application level data and resend until successful?

  3. Other?

My worry is that if the tunnel ACKs before the other side ACKs, and the other side instead sends a RST then there is no way to propagate that RST back. Both sides will just hang.







share|improve this question




















  • ACKs are handled by the TCP layer, not the application.
    – Barmar
    Mar 7 at 21:02














up vote
1
down vote

favorite












Say I have an SSH tunnel from my local machine to a database on a remote server.



If I send a query into the tunnel, it comes out on the other side, but halfway through sending the query or receiving the result the Database triggers a TCP RST, how does SSH handle that?



Does it:



  1. Wait to ACK packets on either side until it has received an ACK from the endpoints?

  2. Buffer application level data and resend until successful?

  3. Other?

My worry is that if the tunnel ACKs before the other side ACKs, and the other side instead sends a RST then there is no way to propagate that RST back. Both sides will just hang.







share|improve this question




















  • ACKs are handled by the TCP layer, not the application.
    – Barmar
    Mar 7 at 21:02












up vote
1
down vote

favorite









up vote
1
down vote

favorite











Say I have an SSH tunnel from my local machine to a database on a remote server.



If I send a query into the tunnel, it comes out on the other side, but halfway through sending the query or receiving the result the Database triggers a TCP RST, how does SSH handle that?



Does it:



  1. Wait to ACK packets on either side until it has received an ACK from the endpoints?

  2. Buffer application level data and resend until successful?

  3. Other?

My worry is that if the tunnel ACKs before the other side ACKs, and the other side instead sends a RST then there is no way to propagate that RST back. Both sides will just hang.







share|improve this question












Say I have an SSH tunnel from my local machine to a database on a remote server.



If I send a query into the tunnel, it comes out on the other side, but halfway through sending the query or receiving the result the Database triggers a TCP RST, how does SSH handle that?



Does it:



  1. Wait to ACK packets on either side until it has received an ACK from the endpoints?

  2. Buffer application level data and resend until successful?

  3. Other?

My worry is that if the tunnel ACKs before the other side ACKs, and the other side instead sends a RST then there is no way to propagate that RST back. Both sides will just hang.









share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 15:00









Breedly

1083




1083











  • ACKs are handled by the TCP layer, not the application.
    – Barmar
    Mar 7 at 21:02
















  • ACKs are handled by the TCP layer, not the application.
    – Barmar
    Mar 7 at 21:02















ACKs are handled by the TCP layer, not the application.
– Barmar
Mar 7 at 21:02




ACKs are handled by the TCP layer, not the application.
– Barmar
Mar 7 at 21:02










1 Answer
1






active

oldest

votes

















up vote
0
down vote













How will "both sides will just hang"? Do you actually observe that?



Quoting from "TCP/IP Illustrated, Volume 1, 2nd edition" p. 628:




The reset segment contains a sequence number and acknowledgement number. Also notice that the reset segment elicits no response from the other end—it is not acknowledged at all. The receiver of the reset aborts the connection and advises the application that the connection was reset. This often results in the error indication "Connection reset by peer" or a similar message.




And on the previous page:




Aborting a connecting provides two features...any queued data is thrown away and a reset segment is sent immediately...the receiver of the reset can tell that the other end did an abort instead of a normal close.




(You may also want to review the socket option SO_LINGER that may be used by the listening socket of your application.)






share|improve this answer




















  • Not so much a TCP question, but a "how does the tunnel handle TCP". Does it ACK all packets coming in before replaying them on the other side? Does it pass the TCP sequence through transparently and replay both sides? Am I guaranteed to have the same sequence numbers on either side of the tunnel?
    – Breedly
    Mar 7 at 20:55










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428767%2fhow-do-ssh-tunnels-handle-tcp-rsts-on-either-side%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













How will "both sides will just hang"? Do you actually observe that?



Quoting from "TCP/IP Illustrated, Volume 1, 2nd edition" p. 628:




The reset segment contains a sequence number and acknowledgement number. Also notice that the reset segment elicits no response from the other end—it is not acknowledged at all. The receiver of the reset aborts the connection and advises the application that the connection was reset. This often results in the error indication "Connection reset by peer" or a similar message.




And on the previous page:




Aborting a connecting provides two features...any queued data is thrown away and a reset segment is sent immediately...the receiver of the reset can tell that the other end did an abort instead of a normal close.




(You may also want to review the socket option SO_LINGER that may be used by the listening socket of your application.)






share|improve this answer




















  • Not so much a TCP question, but a "how does the tunnel handle TCP". Does it ACK all packets coming in before replaying them on the other side? Does it pass the TCP sequence through transparently and replay both sides? Am I guaranteed to have the same sequence numbers on either side of the tunnel?
    – Breedly
    Mar 7 at 20:55














up vote
0
down vote













How will "both sides will just hang"? Do you actually observe that?



Quoting from "TCP/IP Illustrated, Volume 1, 2nd edition" p. 628:




The reset segment contains a sequence number and acknowledgement number. Also notice that the reset segment elicits no response from the other end—it is not acknowledged at all. The receiver of the reset aborts the connection and advises the application that the connection was reset. This often results in the error indication "Connection reset by peer" or a similar message.




And on the previous page:




Aborting a connecting provides two features...any queued data is thrown away and a reset segment is sent immediately...the receiver of the reset can tell that the other end did an abort instead of a normal close.




(You may also want to review the socket option SO_LINGER that may be used by the listening socket of your application.)






share|improve this answer




















  • Not so much a TCP question, but a "how does the tunnel handle TCP". Does it ACK all packets coming in before replaying them on the other side? Does it pass the TCP sequence through transparently and replay both sides? Am I guaranteed to have the same sequence numbers on either side of the tunnel?
    – Breedly
    Mar 7 at 20:55












up vote
0
down vote










up vote
0
down vote









How will "both sides will just hang"? Do you actually observe that?



Quoting from "TCP/IP Illustrated, Volume 1, 2nd edition" p. 628:




The reset segment contains a sequence number and acknowledgement number. Also notice that the reset segment elicits no response from the other end—it is not acknowledged at all. The receiver of the reset aborts the connection and advises the application that the connection was reset. This often results in the error indication "Connection reset by peer" or a similar message.




And on the previous page:




Aborting a connecting provides two features...any queued data is thrown away and a reset segment is sent immediately...the receiver of the reset can tell that the other end did an abort instead of a normal close.




(You may also want to review the socket option SO_LINGER that may be used by the listening socket of your application.)






share|improve this answer












How will "both sides will just hang"? Do you actually observe that?



Quoting from "TCP/IP Illustrated, Volume 1, 2nd edition" p. 628:




The reset segment contains a sequence number and acknowledgement number. Also notice that the reset segment elicits no response from the other end—it is not acknowledged at all. The receiver of the reset aborts the connection and advises the application that the connection was reset. This often results in the error indication "Connection reset by peer" or a similar message.




And on the previous page:




Aborting a connecting provides two features...any queued data is thrown away and a reset segment is sent immediately...the receiver of the reset can tell that the other end did an abort instead of a normal close.




(You may also want to review the socket option SO_LINGER that may be used by the listening socket of your application.)







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 18:35









thrig

22.2k12852




22.2k12852











  • Not so much a TCP question, but a "how does the tunnel handle TCP". Does it ACK all packets coming in before replaying them on the other side? Does it pass the TCP sequence through transparently and replay both sides? Am I guaranteed to have the same sequence numbers on either side of the tunnel?
    – Breedly
    Mar 7 at 20:55
















  • Not so much a TCP question, but a "how does the tunnel handle TCP". Does it ACK all packets coming in before replaying them on the other side? Does it pass the TCP sequence through transparently and replay both sides? Am I guaranteed to have the same sequence numbers on either side of the tunnel?
    – Breedly
    Mar 7 at 20:55















Not so much a TCP question, but a "how does the tunnel handle TCP". Does it ACK all packets coming in before replaying them on the other side? Does it pass the TCP sequence through transparently and replay both sides? Am I guaranteed to have the same sequence numbers on either side of the tunnel?
– Breedly
Mar 7 at 20:55




Not so much a TCP question, but a "how does the tunnel handle TCP". Does it ACK all packets coming in before replaying them on the other side? Does it pass the TCP sequence through transparently and replay both sides? Am I guaranteed to have the same sequence numbers on either side of the tunnel?
– Breedly
Mar 7 at 20:55












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f428767%2fhow-do-ssh-tunnels-handle-tcp-rsts-on-either-side%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)