Skip to content

Implement a pooled listener mode #552

@robklg

Description

@robklg

Currently we open ports the traditional way, when a client sends a PASV, we bind & listen on the port and wait for the connection. This is fine but when the connection rates go up you can get some congestion issues, especially with a small range ports. It may also expensive to do these bind/listen/accept steps each time for an individual transfer. Additionally, ports that have been assigned to some random client can no longer be reused until the actual accepted connection comes in. So that also opens a possibility for an attack to open many ports in passive mode, and simply not connect to them.

A pooled listener mode would just listen on the passive port range continuously, and accept any inbound connections. The incoming connection is looked up in a table to see which session it's assigned to (if any). Assignment happens via PASV, when a PASV command is issued, the pooled listener would just look for a free port, but basically the full range of ports can be allocated for any individual client IP. Port stealing as a way of DoS would be impossible too.... since the attacker can reserve ports but these assignments are limited to his own IP address, leaving other client IPs unaffected.

So to put it short.. pooled listener mode should greatly reduce contention and allow for much higher i/o concurrency for heavily used ftp servers and/or servers that require limited port ranges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions