tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: TCP connection and "Host is down"



On Mon, Sep 11, 2023 at 03:45:55PM +0200, Manuel Bouyer wrote:
> Hello,
> since I upgraded a host to netbsd-10 (from -8), a long-running ssh connection
> from a host on the same network eventually gets dropped with
> sshd[16551]: process_output: ssh_packet_write_poll: Connection from user bouyer xx.xx.xx.xx port 56989: Host is down
> 
> the remote host may be unreachable because of network issues during some
> nightly task, but certainly not for several minutes.
> Shouldn't TCP ignore EHOSTDOWN error on established connections, and
> close it after the ACK timeout instead ?
> 
> This didn't happen with netbsd-8.

I wonder if we need this patch to tcp_output.c (not tested yet)

Index: netinet/tcp_output.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_output.c,v
retrieving revision 1.218
diff -u -p -u -r1.218 tcp_output.c
--- netinet/tcp_output.c	4 Nov 2022 09:01:53 -0000	1.218
+++ netinet/tcp_output.c	11 Sep 2023 14:20:54 -0000
@@ -1612,8 +1612,8 @@ out:
 			TCP_STATINC(TCP_STAT_SELFQUENCH);
 			tcp_quench(tp->t_inpcb);
 			error = 0;
-		} else if ((error == EHOSTUNREACH || error == ENETDOWN) &&
-		    TCPS_HAVERCVDSYN(tp->t_state)) {
+		} else if ((error == EHOSTUNREACH || error == ENETDOWN ||
+		    error == EHOSTDOWN) && TCPS_HAVERCVDSYN(tp->t_state)) {
 			tp->t_softerror = error;
 			error = 0;
 		}


Also, while auditing the code for ENETDOWN or EHOSTUNREACH handling I wonder
if we also need this for stcp (but I'm not using stcp ...)

Index: netinet/sctp_output.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/sctp_output.c,v
retrieving revision 1.33
diff -u -p -u -r1.33 sctp_output.c
--- netinet/sctp_output.c	4 Nov 2022 09:01:53 -0000	1.33
+++ netinet/sctp_output.c	11 Sep 2023 14:20:54 -0000
@@ -5643,7 +5643,8 @@ sctp_med_chunk_output(struct sctp_inpcb 
 							}
 							hbflag = 0;
 						}
-						if (error == EHOSTUNREACH) {
+						if (error == EHOSTUNREACH ||
+						    error == EHOSTDOWN) {
 							/*
 							 * Destination went
 							 * unreachable during
@@ -5921,7 +5922,8 @@ sctp_med_chunk_output(struct sctp_inpcb 
 					}
 					hbflag = 0;
 				}
-				if (error == EHOSTUNREACH) {
+				if (error == EHOSTUNREACH ||
+				    error == EHOSTDOWN) {
 					/*
 					 * Destination went unreachable during
 					 * this send
-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index