All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] netfilter: conntrack: early_drop eviction limitation under sparse table configurations (max << buckets)
@ 2026-11-06 10:53 S.S.Vikash
  2026-11-06 10:54 ` S.S.Vikash
  2026-11-06 11:40 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 6+ messages in thread
From: S.S.Vikash @ 2026-11-06 10:53 UTC (permalink / raw)
  To: netfilter-devel; +Cc: fw, pablo

Hi,

While investigating connection tracking exhaustion behavior under a spoofed
SYN flood, I observed that the effectiveness of early eviction in
net/netfilter/nf_conntrack_core.c:early_drop() degrades significantly when
nf_conntrack_max is configured to be substantially smaller than
nf_conntrack_buckets.

Setup & Reproduction:
- Host kernel: Linux 6.14 (Proxmox host)
- Workload: Conntrack table saturated with non-ASSURED, unreplied TCP
  connections generated by spoofed SYN traffic.
- Test: Verifying whether an inbound, legitimate SSH connection can be
  established while the table is at capacity.

Results observed:

nf_conntrack_max       |   nf_conntrack_buckets     |     New SSH Connection
------------------------------+-----------------------------------+----------------------------------
              4096              |              262144
|         Failed (drops)
              4096              |              4096
  |         Established
              65536            |              262144
|         Established
              262144          |              262144                  |
        Established

Root Cause Analysis:
In early_drop(), the kernel examines at most NF_CT_EVICTION_RANGE (8)
consecutive hash buckets starting from the calculated hash index.

With nf_conntrack_max=4096 and nf_conntrack_buckets=262144, the hash table
is sparsely populated. Since early_drop() examines only eight consecutive
buckets, it can fail to locate an eligible entry even when many non-ASSURED
connections remain in the table. This appears consistent with the connection
failures observed during testing.

When the bucket count is reduced or when the table density is increased,
early eviction succeeds reliably and permits legitimate inbound connections.

Proposed Improvements:
I am interested in addressing this behavior upstream and would appreciate
feedback on which direction would be most useful:

1. Diagnostic:
   Warn (e.g., via pr_warn_once()) when nf_conntrack_max is configured to be
   significantly lower than nf_conntrack_buckets via sysctl, notifying the
   operator that early_drop() heuristics may become ineffective under load.

2. Documentation:
   Update Documentation/networking/nf_conntrack-sysctl.rst to document the
   tuning implications of sparse hash tables on early eviction.

3. Algorithmic:
   Investigate a bounded improvement to candidate selection in sparse tables
   without introducing unacceptable CPU overhead on the drop path.

I'm happy to prepare a patch or provide additional test measurements based
on the discussion.

Thanks,
Vikash SS

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-06 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06 10:53 [RFC] netfilter: conntrack: early_drop eviction limitation under sparse table configurations (max << buckets) S.S.Vikash
2026-11-06 10:54 ` S.S.Vikash
2026-11-06 11:40 ` Pablo Neira Ayuso
2026-11-06 11:52   ` S.S.Vikash
2026-11-06 13:56     ` Pablo Neira Ayuso
2026-11-06 14:02       ` S.S.Vikash

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.