From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Blažej Krajňák" <blazej.krajnak@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: ulogd packet based logging with CT info
Date: Wed, 18 Aug 2021 09:22:56 +0200 [thread overview]
Message-ID: <20210818072256.GA4640@salvia> (raw)
In-Reply-To: <CAMEa=f=nzCzM-9a5B0VEkjN5zXgCTqobGe-sgN2K0G_5QgjdAQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 631 bytes --]
On Tue, Aug 17, 2021 at 04:42:12PM +0200, Blažej Krajňák wrote:
> Hello Pablo,
>
> I'm just rewriting input plugin ulog_inppkt_NFLOG.c to include
> conntrack params. I successfully included CT flags from enum
> ip_conntrack_status (assured, reply seen, ...) and CT state and
> direction from NFULA_CT_INFO.
Great.
> However, in NFULA_CT few counters from enum nf_conntrack_attr are
> still 0 value. For ex. ATTR_TIMESTAMP_START / STOP and
> ATTR_ORIG/REPL_COUNTER_PACKETS/BYTES.
> Is it normal, or am I missing some bug at parsing?
You need this kernel patch to add this information to nfnetlink_queue,
compile-tested only.
[-- Attachment #2: x.patch --]
[-- Type: text/x-diff, Size: 1065 bytes --]
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index eb35c6151fb0..0677531ce8db 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2669,6 +2669,8 @@ ctnetlink_glue_build_size(const struct nf_conn *ct)
+ nla_total_size(0) /* CTA_HELP */
+ nla_total_size(NF_CT_HELPER_NAME_LEN) /* CTA_HELP_NAME */
+ ctnetlink_secctx_size(ct)
+ + ctnetlink_acct_size(ct)
+ + ctnetlink_timestamp_size(ct)
#if IS_ENABLED(CONFIG_NF_NAT)
+ 2 * nla_total_size(0) /* CTA_NAT_SEQ_ADJ_ORIG|REPL */
+ 6 * nla_total_size(sizeof(u_int32_t)) /* CTA_NAT_SEQ_OFFSET */
@@ -2726,6 +2728,10 @@ static int __ctnetlink_glue_build(struct sk_buff *skb, struct nf_conn *ct)
if (ctnetlink_dump_protoinfo(skb, ct, false) < 0)
goto nla_put_failure;
+ if (ctnetlink_dump_acct(skb, ct, IPCTNL_MSG_CT_GET) < 0 ||
+ ctnetlink_dump_timestamp(skb, ct) < 0)
+ goto nla_put_failure;
+
if (ctnetlink_dump_helpinfo(skb, ct) < 0)
goto nla_put_failure;
next prev parent reply other threads:[~2021-08-18 7:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-15 14:23 ulogd packet based logging with CT info Blažej Krajňák
2021-08-15 14:31 ` Pablo Neira Ayuso
2021-08-15 16:23 ` Blažej Krajňák
2021-08-17 14:42 ` Blažej Krajňák
2021-08-17 15:05 ` Fatih USTA
2021-08-17 15:06 ` Blažej Krajňák
2021-08-18 7:22 ` Pablo Neira Ayuso [this message]
2021-08-18 10:06 ` Blažej Krajňák
2021-08-18 11:52 ` Pablo Neira Ayuso
2021-08-18 20:06 ` Blažej Krajňák
2021-08-19 10:16 ` Pablo Neira Ayuso
2021-08-19 14:05 ` Blažej Krajňák
2021-08-19 17:03 ` Pablo Neira Ayuso
[not found] ` <CAMEa=f=wHTwJX6CjgOROcStTgDo-TdU6jb2xtpmNi=coHuPboA@mail.gmail.com>
2021-08-21 13:03 ` Blažej Krajňák
2021-08-21 16:21 ` Blažej Krajňák
2021-09-02 22:28 ` Ken-ichirou MATSUZAWA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210818072256.GA4640@salvia \
--to=pablo@netfilter.org \
--cc=blazej.krajnak@gmail.com \
--cc=netfilter@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox