Skip to contentSkip to conversation

trace: add support for TRACE_CT information

PATCH Superseded Florian Westphal 1 participant 1 message May 8, 2025 netfilter

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 trace: add support for TRACE_CT information

Decode direction/id/state/status information.
This will be used by 'nftables monitor trace' to print a packets conntrack state.

---
 include/libnftnl/trace.h            |  4 ++
 include/linux/netfilter/nf_tables.h |  2 +
 src/trace.c                         | 78 +++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+)
include/libnftnl/trace.h +4 -0
index 18ab0c3baef7..5d66b50b2d31 100644
@@ -28,6 +28,10 @@ enum nftnl_trace_attr {
 	NFTNL_TRACE_VERDICT,
 	NFTNL_TRACE_NFPROTO,
 	NFTNL_TRACE_POLICY,
+	NFTNL_TRACE_CT_DIRECTION,
+	NFTNL_TRACE_CT_ID,
+	NFTNL_TRACE_CT_STATE,
+	NFTNL_TRACE_CT_STATUS,
 	__NFTNL_TRACE_MAX,
 };
 #define NFTNL_TRACE_MAX (__NFTNL_TRACE_MAX - 1)
include/linux/netfilter/nf_tables.h +2 -0
index 49c944e78463..5a00ec9a4879 100644
@@ -1837,6 +1837,7 @@ enum nft_xfrm_keys {
  * @NFTA_TRACE_MARK: nfmark (NLA_U32)
  * @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32)
  * @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32)
+ * @NFTA_TRACE_CT: connection tracking information (NLA_NESTED: nft_ct_keys)
  */
 enum nft_trace_attributes {
 	NFTA_TRACE_UNSPEC,
@@ -1857,6 +1858,7 @@ enum nft_trace_attributes {
 	NFTA_TRACE_NFPROTO,
 	NFTA_TRACE_POLICY,
 	NFTA_TRACE_PAD,
+	NFTA_TRACE_CT,
 	__NFTA_TRACE_MAX
 };
 #define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1)
src/trace.c +78 -0

107 lines not on this page · raw message

Signature · 1 line
2.49.0