NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/59865: ftp should not set socket send/receive buffers unless told to
The following reply was made to PR bin/59865; it has been noted by GNATS.
From: Luke Mewburn <luke%mewburn.net@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, cmeerw%cmeerw.org@localhost
Subject: Re: bin/59865: ftp should not set socket send/receive buffers unless
told to
Date: Thu, 15 Jan 2026 15:51:16 +1100
On 25-12-27 13:10, gnats-admin%netbsd.org@localhost wrote:
| From: mlelstv%serpens.de@localhost (Michael van Elst)
|
| I'm currently limiting the I/O buffer to 128kB as a compromise between
| file I/O and network buffer usage:
I've implemented a variation of this and also fixed ftp sendrequest()
as well.
|
For the original problem, it seems we may need three separate controls:
1. Existing ftp autoscale:
By default if the rcvbuf/sndbuf/xferbuf commands haven't been used,
autoscale on startup based on getsockopt(SO_RCVBUF) / getsockopt(SO_SNDBUF)
as appropriate. I.e, rcvbuf_size and sndbuf_size are 0.
This functionality has existed since 1998-07-20, improved 1999-09-22.
2. Existing commands rcvbuf/sndbuf/xferbuf:
If these commands are used interactively (or via macros in .netrc) with
a positive value, change rcvbuf_size and sndbuf_size as appropriate,
use those values and don't autoscale.
3. New control(s) to disable ftp's autoscale and use the system defaults.
This would be new functionality.
The new control(s) could be one or more of:
3a. A new CLI option. This would affect URI fetchs and classic FTP.
3b. A new ftp command. This would be used within .netrc, but wouldn't
work for URI fetch.
3c. Add more meaning to the argument of the existing -x XFERSIZE option
and rcvbuf|sndbuf|xferbuf SIZE commands.
Currently '0' is invalid even though that's the startup default.
Maybe add symbolic words for XFERSIZE/SIZE as:
- "autoscale": getsockopt() current values, and setsockopt() a value
clamped between [8 KiB, 8 MiB),
Default behaviour because it's been the existing
behaviour for 27 years.
- "system": Use system defaults. Do not call setsockopt().
bufsize defaults to XFERBUFMAX (128 KiB).
- NUMBER: Existing behaviour, no change.
3d. Potentially add $FTPXFERSIZE environment variable to override
the default "autoscale" behaviour?
(Internally I'd probably implement this with magic negative values for
rcvbuf_size and sndbuf_size in the code, with appropriate checks and
asserts.)
Thoughts ?
Luke.
Home |
Main Index |
Thread Index |
Old Index