Allow TCP null packet keep alive
|Reported by:||Kevin Gut||Owned by:|
|Keywords:||tcp keepalive NAT||Cc:||public@…|
|Component version:||3.20.1||Operating system type:||Windows|
|Operating system version:||Windows 7 x64|
Note: This is a proposal for the FileZilla client, but it would also make sense for servers that are behind a "stupid" NAT device.
Most NAT routers forget open TCP connections after 20 seconds, which causes TCP connections to be silently dropped without the OS being notified.
This is most easily notified if an FTP connection is left idle for about 30 seconds. Any FTO operation (file download, entering directory, etc) then is performed on a dead connection, which then does nothing for 20 seconds, until the connection is forcibly terminated and Filezilla reconnects.
At the moment, this can be fixed with the "send FTP keep-alive commands" options. This however is not needed and is intended for another type of problem. Instead a TCP null packet could be sent (a packet without content). At least in Windows, this can be configured by setting the SO_KEEPALIVE flag and then defining the timeout (I propose 15 seconds). This option can be observed in action on PuTTY (see "Connections" category).
The great thing about this is, that the TCP stack handles the keepalive interval. There is no need for filezilla to manually send any packets. The OS only sends packets if the connection has been idle for the specified number of seconds.
adding additional options on the "Connection page"
- enable TCP keep alive: Checkbox; This sets the SO_KEEPALIVE option.
- keep-alive interval: Number input; This sets the interval (15 seconds by default)
Adapting the Network settings wizard
Adding a configuration page for the keepalive settings
The network wizard tries to figure out the external IP at some point. If the IP is different from the local listening endpoint (ie. Computer uses a private IP address) then the keepalive configuration page should have the appropriate option already pre selected to allow the user to "continue with the default".
Note: SO_KEEPALIVE is also available in linux as it is part of the TCP specification.
FileZilla Client ---------------- Version: 3.20.1 Build information: Compiled for: x86_64-w64-mingw32 Compiled on: x86_64-unknown-linux-gnu Build date: 2016-08-03 Compiled with: x86_64-w64-mingw32-gcc (GCC) 4.9.1 Compiler flags: -g -O2 -Wall -g -std=gnu++14 Linked against: wxWidgets: 3.0.3 GnuTLS: 3.4.14 SQLite: 3.11.1 Operating system: Name: Windows 7 (build 7601, Service Pack 1), 64-bit edition Version: 6.1 Platform: 64-bit system CPU features: sse sse2 sse3 ssse3 sse4.1 sse4.2 Settings dir: C:\Users\ \AppData\Roaming\FileZilla\