Subject: bin/25566: ftp(1) do not like large TCP windows.
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <ragge@ltu.se>
List: netbsd-bugs
Date: 05/14/2004 11:40:12
>Number:         25566
>Category:       bin
>Synopsis:       ftp(1) do not like large TCP windows.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 14 11:41:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Anders Magnusson
>Release:        2.0D
>Organization:
Lule University of Technology
>Environment:
NetBSD snoopy 2.0D NetBSD 2.0D (OPTIM) #47: Thu May  6 16:03:30 CEST 2004  ragge@dino:/home/ragge/src/sys/arch/i386/compile/OPTIM i386

>Description:
Invoking ftp(1) when the TCP windows (and socket buffers!) are large will fail. If the window size is for example 150000000 bytes, then ftp will get sad. See:

ftp> dir
229 Entering Extended Passive Mode (|||62846|)
150 Opening ASCII mode data connection for '/bin/ls'.
ftp: Unable to allocate 150000000 bytes of memory: Cannot allocate memory
%

I haven't looked at the code, but I assume that ftp tries to allocate the full socket buffer size and since the default max memory size is only 128MB it will fail.  

ftp should do its buffer allocation of a more reasonable size; I can't imagine where an application really needs 150MB receive buffers.
>How-To-Repeat:
Increase sbmax, somaxkva and recvspace over the datasize limit.  ftp somewhere and try to fetch something.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: