Skip to content

netfilter: nf_tables: include conntrack state in trace messages

Florian Westphal netfilter-devel 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

Address feedback from Pablo: don't reuse nft_ct_keys, but add extra ct_trace attributes. No other changes.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2netfilter: conntrack: make nf_conntrack_id callable without a module dependencyinclude/linux/netfilter.h net/netfilter/nf_conntrack_core.c+7 -00 replies
2/2netfilter: nf_tables: add packets conntrack state to debug trace infoinclude/uapi/linux/netfilter/nf_tables.h net/netfilter/nf_tables_trace.c+61 -10 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH nf-next v2 0/2] netfilter: nf_tables: include conntrack state in trace messages

v2:
Address feedback from Pablo: don't reuse nft_ct_keys, but add extra ct_trace attributes. No other changes.

Add the minimal relevant info needed for userspace ("nftables monitor trace") to provide the conntrack view of the packet:

- state (new, related, established)
- direction (original, reply)
- status (e.g., if connection is subject to dnat)
- id (allows to query ctnetlink for remaining conntrack state info)

Example:
trace id a62 inet filter PRE_RAW packet: iif "enp0s3" ether [..]
[..]
trace id a62 inet filter PRE_MANGLE conntrack: ct direction original ct state new ct id 32 trace id a62 inet filter PRE_MANGLE packet: [..]
[..]
trace id a62 inet filter IN conntrack: ct direction original ct state new ct status dnat-done ct id 32
[..]

First patch is a needed prerequisite to avoid a module dependency. Second patch adds the needed info.

Updated patch for libnftnl will follow shortly, the nftables patch doesn't need adjustment: it uses libnftl for all trace accesses.

Florian Westphal (2):
netfilter: conntrack: make nf_conntrack_id callable without a module
dependency
netfilter: nf_tables: add packets conntrack state to debug trace info

 include/linux/netfilter.h                |  1 +
 include/uapi/linux/netfilter/nf_tables.h |  8 ++++
 net/netfilter/nf_conntrack_core.c        |  6 +++
 net/netfilter/nf_tables_trace.c          | 54 +++++++++++++++++++++++-
 4 files changed, 68 insertions(+), 1 deletion(-)
Signature · 1 line
2.49.0