NetBSD-Bugs archive

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

Re: bin/56129 (ftp(1) should keep control session during large xfer)



The following reply was made to PR bin/56129; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: lukem%netbsd.org@localhost, tsutsui%NetBSD.org@localhost
Subject: Re: bin/56129 (ftp(1) should keep control session during large
 xfer)
Date: Tue, 7 Nov 2023 23:44:53 +0000 (UTC)

 On Sat, 13 Aug 2022, tsutsui%NetBSD.org@localhost wrote:
 
 > State-Changed-From-To: open->closed
 > State-Changed-By: tsutsui%NetBSD.org@localhost
 > State-Changed-When: Sat, 13 Aug 2022 22:30:10 +0000
 > State-Changed-Why:
 > I've tried ftp install for both NetBSD/luna68k 9.3 on 68030 LUNA
 > and NetBSD/x68k 9.3 on 68030 X68030 from ftp.NetBSD.org, then
 > there is no timeout through full upgrade installation.
 > The installation problem seems solved and maybe I missed something
 > in my past tests.
 >
 
 Made this patch quite a while ago, then forgot I had done it.
 Redone for latest ftp source. It sets TCP_KEEPIDLE & TCP_KEEPINTVL
 (tied to `quit_time' now, but, can easily be parametrized) which
 is supported on Linux, Free & NetBSD. This should work to keep
 the control channel alive.
 
 -RVP
 
 ---START---
 diff -urN ftp.orig/ftp.c ftp/ftp.c
 --- ftp.orig/ftp.c	2023-05-06 03:41:38.122163042 +0000
 +++ ftp/ftp.c	2023-11-07 23:41:33.236539000 +0000
 @@ -290,6 +290,23 @@
   		DWARN("setsockopt %s (ignored)", "SO_OOBINLINE");
   	}
 
 +#if defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL)
 +#include <netinet/tcp.h>
 +{
 +	unsigned int idle_time;
 +	idle_time = quit_time > 300 ? (quit_time * 3) / 4 : 300;
 +	if (setsockopt(s, IPPROTO_TCP, TCP_KEEPIDLE,
 +			&idle_time, sizeof(idle_time)) == -1) {
 +		DWARN("setsockopt %s (ignored)", "TCP_KEEPIDLE");
 +	}
 +
 +	if (setsockopt(s, IPPROTO_TCP, TCP_KEEPINTVL,
 +			&idle_time, sizeof(idle_time)) == -1) {
 +		DWARN("setsockopt %s (ignored)", "TCP_KEEPINTVL");
 +	}
 +}
 +#endif
 +
   	return (hostname);
    bad:
   	(void)close(s);
 ---END---
 


Home | Main Index | Thread Index | Old Index