Re: [PATCH v1] audit: include source and destination ports to NETFILTER_PKT

From: Jan Engelhardt

Date: Mon Sep 22 2025 - 19:21:28 EST



On Monday 2025-09-22 22:09, Ricardo Robaina wrote:

>NETFILTER_PKT records show both source and destination
>addresses, in addition to the associated networking protocol.
>However, it lacks the ports information, which is often
>valuable for troubleshooting.
>
>+ switch (ih->protocol) {
>+ case IPPROTO_TCP:
>+ sport = tcp_hdr(skb)->source;
>+ dport = tcp_hdr(skb)->dest;
>+ break;
>+ case IPPROTO_UDP:
>+ sport = udp_hdr(skb)->source;
>+ dport = udp_hdr(skb)->dest;
>+ }

Should be easy enough to add the cases for UDPLITE,
SCTP and DCCP, right?