From: Florian Westphal <fw@strlen.de>
To: Ricardo Robaina <rrobaina@redhat.com>
Cc: audit@vger.kernel.org, linux-kernel@vger.kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
paul@paul-moore.com, eparis@redhat.com, pablo@netfilter.org,
kadlec@netfilter.org, ej@inai.de
Subject: Re: [PATCH v3] audit: include source and destination ports to NETFILTER_PKT
Date: Sat, 27 Sep 2025 12:44:58 +0200 [thread overview]
Message-ID: <aNfAKjRGXNUoSxQV@strlen.de> (raw)
In-Reply-To: <20250926193035.2158860-1-rrobaina@redhat.com>
Ricardo Robaina <rrobaina@redhat.com> wrote:
> + case IPPROTO_TCP:
> + audit_log_format(ab, " saddr=%pI4 daddr=%pI4 proto=%hhu sport=%hu dport=%hu",
> + &ih->saddr, &ih->daddr, ih->protocol,
> + ntohs(tcp_hdr(skb)->source), ntohs(tcp_hdr(skb)->dest));
You need to use skb_header_pointer() like elsewhere in netfilter to
access the transport protocol header.
You can have a look at nf_log_dump_tcp_header() in nf_log_syslog.c for
a template.
Also please have a look at net/netfilter/nft_log.c, in particular
nft_log_eval_audit(): xt_AUDIT and nft audit should be kept in sync wrt.
their formatting.
Maybe Paul would be open to adding something like audit_log_packet() to
kernel/audit.c and then have xt_AUDIT.c and nft_log.c just call the
common helper.
next prev parent reply other threads:[~2025-09-27 10:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-26 19:30 [PATCH v3] audit: include source and destination ports to NETFILTER_PKT Ricardo Robaina
2025-09-27 10:44 ` Florian Westphal [this message]
2025-10-03 15:43 ` Ricardo Robaina
2025-10-13 18:48 ` Paul Moore
2025-10-13 18:51 ` Paul Moore
2025-10-13 19:11 ` Ricardo Robaina
2025-10-13 20:26 ` Paul Moore
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=aNfAKjRGXNUoSxQV@strlen.de \
--to=fw@strlen.de \
--cc=audit@vger.kernel.org \
--cc=coreteam@netfilter.org \
--cc=ej@inai.de \
--cc=eparis@redhat.com \
--cc=kadlec@netfilter.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=paul@paul-moore.com \
--cc=rrobaina@redhat.com \
/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