Skip to content

netfilter: conntrack: avoid eache extension allocation

Florian Westphal netfilter-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4netfilter: nfnetlink: allow to detect if ctnetlink listeners existinclude/net/netns/conntrack.h net/netfilter/nfnetlink.c+38 -30 replies
2/4netfilter: conntrack: un-inline nf_ct_ecache_ext_addinclude/net/netfilter/nf_conntrack_ecache.h net/netfilter/nf_conntrack_core.c net/netfilter/nf_conntrack_ecache.c+38 -280 replies
3/4netfilter: conntrack: add nf_conntrack_events autodetect modeDocumentation/networking/nf_conntrack-sysctl.rst net/netfilter/nf_conntrack_core.c net/netfilter/nf_conntrack_ecache.c +1 more+28 -90 replies
4/4netfilter: prefer extension check to pointer checkinclude/net/netfilter/nf_conntrack_core.h include/net/netfilter/nf_conntrack_ecache.h+16 -170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH nf-next 0/4] netfilter: conntrack: avoid eache extension allocation

This patch series changes ecache infra to no longer allocate the extension by default.

After this series, the default behaviour is to allocate the extension if either a conntrack template has been set to configure event masks via nft/iptables ruleset, the syctl 'nf_conntrack_events' is set to 1, or if a userspace program has subscribed to one of the ctnetlink event groups.

This has advantages in case the events are not used:
1. Conntrack allocation/free avoids extra kmalloc/kfree call.
2. nf_confirm hook doesn't perform an indirect call into ctnetlink only to discover that there is nothing to do.

Florian Westphal (4):
netfilter: nfnetlink: allow to detect if ctnetlink listeners exist
netfilter: conntrack: un-inline nf_ct_ecache_ext_add
netfilter: conntrack: add nf_conntrack_events autodetect mode
netfilter: prefer extension check to pointer check

 .../networking/nf_conntrack-sysctl.rst        |  5 +-
 include/net/netfilter/nf_conntrack_core.h     |  2 +-
 include/net/netfilter/nf_conntrack_ecache.h   | 49 ++++++-------------
 include/net/netns/conntrack.h                 |  1 +
 net/netfilter/nf_conntrack_core.c             | 15 ++++--
 net/netfilter/nf_conntrack_ecache.c           | 39 ++++++++++++++-
 net/netfilter/nf_conntrack_standalone.c       |  2 +-
 net/netfilter/nfnetlink.c                     | 40 +++++++++++++--
 8 files changed, 108 insertions(+), 45 deletions(-)
Signature · 1 line
2.35.1