NetBSD Problem Report #17544

Received: (qmail 11774 invoked by uid 605); 10 Jul 2002 14:08:49 -0000
Message-Id: <200207101408.g6AE8U519474@netbsd.hotgen.com>
Date: Wed, 10 Jul 2002 15:08:30 +0100 (BST)
From: Lord Lundman <lundman@netbsd.hotgen.com>
Sender: gnats-bugs-owner@netbsd.org
Reply-To: lundman@lundman.net
To: gnats-bugs@gnats.netbsd.org
Subject: FTP timeout
X-Send-Pr-Version: 3.95

>Number:         17544
>Category:       bin
>Synopsis:       FTP in proxy mode has timeout on server connection
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 10 14:09:00 +0000 2002
>Closed-Date:    
>Last-Modified:  Wed Jul 31 18:08:01 +0000 2002
>Originator:     Lord Lundman
>Release:        Version: NetBSD-ftp 20000615
>Organization:

>Environment:

System: NetBSD netbsd 1.5 NetBSD 1.5 (netbsd) #7: Sat Oct 27 16:24:08 BST 2001 root@netbsd:/usr/src/sys/arch/i386/compile/netbsd i386


>Description:
 Using the 'proxy' command to setup a third party transfer (FXP) between two
FTP server work fine, however, the FTP client appears to believe that the 
server(s) are not responding (although they are transfering happily) and
eventually times-out and issues "ABOR" command.


>How-To-Repeat:
 Set up a third party transfer that takes longer than the default server
timeout period.

>Fix:
 Make client aware that a transfer is in progress during third-party and
stop the timeout counter from occuring. Or atleast supply a command or
command line argument to disable timeouts.

>Release-Note:
>Audit-Trail:

From: Carl Seaton <seatonc@ncube.com>
To: gnats-bugs@netbsd.org
Cc: lundman@netbsd.hotgen.com
Subject: bin/17544
Date: Wed, 31 Jul 2002 11:06:44 -0700

 This bug is caused because of the way that ftp does proxy.  It sends 
 a PASV command to one side and a PORT and RETR command to the other.  Then
 it does a getreply to get the final response, which only occurs after the
 transfer is complete.  In fact it is the second reply back from the server
 after the RETR command is sent (one to ackknowlege, and one to notify).

 The problem is that the standard netbsd version of getreply has a 60
 second timeout.  While this is OK for other commands, it is totally
 inappropriate for proxy transfer.

 One fix is to ignore timeouts for proxy transfer.  I put that fix into my
 own source code and it seems to work.  My code version is:

 /*      $NetBSD: ftp.c,v 1.113 2000/11/27 16:08:03 itojun Exp $ */

 and my context diff is:

 *** ftp.c@@/main/2	Sat Feb 23 11:15:16 2002
 --- ftp.c	Wed Jul 31 10:52:41 2002
 ***************
 *** 339,349 ****
   	int oerrno = errno;

   	alarmtimer(0);
   	if (fromatty)
   		write(fileno(ttyout), "\n", 1);
   	timeoutflag++;
 - 	if (ptflag)
 - 		siglongjmp(ptabort, 1);
   	errno = oerrno;
   }

 --- 339,355 ----
   	int oerrno = errno;

   	alarmtimer(0);
 + 
 + 	/* Should not timeout during proxy transfer.
 + 	 * The command can take over 60 seconds if the file is large.
 + 	 * If the server errors or closes connection we will clean up.
 + 	 */
 + 	if (ptflag)
 + 		return;	
 + 
   	if (fromatty)
   		write(fileno(ttyout), "\n", 1);
   	timeoutflag++;
   	errno = oerrno;
   }

 I submit that this is a correct way to do it assuming you want to keep 
 the timeout at all (which other versions of ftp.c do not have).  You could
 also conditionalize the timeout in getreply based on ptflag, but this
 seems cleaner this way.

 ......................................................................
 : Carl Seaton, seatonc@ncube.com  | "Courage is not the absence of   :
 : Sr. Software Engr, 503-531-6423 |  fear, but rather the judgement  :
 : nCUBE Corp, Beaverton, OR       |  that something else is more     :
 : http://www.ncube.com            |  important." - Ambrose Redmoon   :
 :.................................:..................................:
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.