ftp(1) from vendor/tnftp always tries the following for
every TCP connection:
- Get the current buffer length of SO_SNDBUF and SO_RCVBUF by getsockopt(2).
- Invoke setsockopt(2) to set them to the same values after checking if they are in a range between 8 KiB to 8 MiB.
This behavior breaks dynamic buffer sizing enabled by
default (see net.inet.tcp.{recv,send}buf_auto sysctls)
and leads to a very poor transfer rate. fetch(1) does
not have this problem. See also Bug 240827.
This change prevents SO_SNDBUF and SO_RCVBUF from configuring
when the auto buffer sizing is enabled unless they are
explicitly specified.