Skip to content

NFQUEUE may split GSO TCP packets before userspace unless NFQA_CFG_F_GSO is set (was: Subsequent TCP segments of the same connection are also enqueued to nfqueue) #24

Description

@dilluti0n

When nftables matches a ClientHello packet and sends it to nfqueue, Linux conntrack may cause all subsequent segments of the same TCP connection to be enqueued as well. This was confirmed by observing a 114-byte segment (clearly not a ClientHello) entering send_split immediately after a 1448-byte segment from the same connection.

Impact

In practice, these subsequent segments going through handle_packet is harmless. They belong to the same connection as the ClientHello and will be split anyway. However, the current implementation treats every packet entering send_split as a full ClientHello, which is incorrect. Fragmented continuation segments are being processed as if they were independent ClientHellos, which diverges from the intended behavior.

Possible mitigations

  • TCP reassembly: Reassemble segments before processing. Correct, but expensive.
  • Inspect nfqueue metadata: Use conntrack state or packet metadata exposed by nfqueue to distinguish the first segment from continuations, and route them separately without ClientHello processing.

Either approach involves non-trivial refactoring cost.

Platform note

WinDivert behavior on Windows needs to be investigated. It may or may not exhibit the same characteristic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions