From: sashiko-bot@kernel.org
To: "Julius Bairaktaris" <julius@bairaktaris.de>
Cc: linux-rdma@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net-next v4 1/2] net: keep the TCP fixed-ID flags on the header they describe
Date: Sun, 29 Nov 2026 14:07:43 +0000 [thread overview]
Message-ID: <sashiko-outbox-239682@kernel.org> (raw)
In-Reply-To: <c9ec995833aac63f552441e4a60bf420a0a52275.1795869698.git.julius@bairaktaris.de>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] xfrm: stale inner_protocol in xfrm_output() skips saving
inner header offsets
--
commit 6f304adf33d568f2ad16eea15056eaded001170a
Author: Julius Bairaktaris <julius@bairaktaris.de>
net: keep the TCP fixed-ID flags on the header they describe
This commit makes SKB_GSO_TCP_FIXEDID describe the innermost IPv4 header
again, replaces SKB_GSO_TCP_FIXEDID_INNER with SKB_GSO_TCP_FIXEDID_OUTER for
the outermost header of an encapsulated packet, and updates tunnel and XFRM
encapsulation/decapsulation paths accordingly.
> diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
> index f1f612cd7b438..e5bcb845e9acb 100644
> --- a/net/xfrm/xfrm_output.c
> +++ b/net/xfrm/xfrm_output.c
> @@ -791,6 +791,7 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
> secpath_reset(skb);
>
> if (xfrm_dev_offload_ok(skb, x)) {
> + bool encap = skb->encapsulation;
> struct sec_path *sp;
>
> sp = secpath_set(skb);
> @@ -805,10 +806,25 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
> xfrm_state_hold(x);
>
> xfrm_get_inner_ipproto(skb, x);
> + /*
> + * Transport and BEET mode keep the IPv4 header and its ID, so
> + * the header that SKB_GSO_TCP_FIXEDID describes is the outer
> + * one as well.
> + */
> + if (!encap &&
> + (x->props.mode == XFRM_MODE_TRANSPORT ||
> + x->props.mode == XFRM_MODE_BEET) &&
> + (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID))
> + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_FIXEDID_OUTER;
> skb->encapsulation = 1;
>
> if (skb_is_gso(skb)) {
> - if (skb->inner_protocol && x->props.mode == XFRM_MODE_TUNNEL)
> + /*
> + * inner_protocol is only valid on an encapsulated skb:
> + * a tunnel that decapsulated the packet leaves it set.
> + */
> + if (encap && skb->inner_protocol &&
> + x->props.mode == XFRM_MODE_TUNNEL)
> return xfrm_output_gso(net, sk, skb);
>
> skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
[Severity: Medium]
When !encap and a stale skb->inner_protocol remains from an earlier tunnel
decapsulation, does skipping xfrm_output_gso() without clearing
skb->inner_protocol cause xfrm4_tunnel_encap_add() and
xfrm6_tunnel_encap_add() to skip saving the inner header offsets?
net/xfrm/xfrm_output.c:xfrm4_tunnel_encap_add() {
...
if (!skb->inner_protocol) {
skb_set_inner_network_header(skb, skb_network_offset(skb));
skb_set_inner_transport_header(skb, skb_transport_offset(skb));
}
...
}
For a decapsulated SKB_GSO_FRAGLIST GRO packet (where inet_gro_complete() set
skb->inner_protocol, while tcp4_gro_complete() returned early on is_flist
without calling tcp_gro_complete() to set inner_transport_header),
inner_transport_header is left unset when xfrm4_tunnel_encap_add() pushes the
outer IP header. qdisc_pkt_len_segs_init() then sees a negative or invalid
skb_inner_transport_offset(skb) on the offloaded SKB_GSO_ESP packet and drops
it with SKB_DROP_REASON_SKB_BAD_GSO.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795869698.git.julius@bairaktaris.de?part=1
next prev parent reply other threads:[~2026-11-29 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 14:07 [PATCH net-next v4 0/2] net: keep the TCP fixed-ID flags on the header they describe Julius Bairaktaris
2026-11-28 14:07 ` [PATCH net-next v4 1/2] " Julius Bairaktaris
2026-11-29 14:07 ` sashiko-bot [this message]
2026-11-28 14:07 ` [PATCH net-next v4 2/2] selftests: net: check TCP IP IDs across tunnels after GRO and GSO Julius Bairaktaris
2026-11-29 14:07 ` [PATCH net-next v4 0/2] net: keep the TCP fixed-ID flags on the header they describe sashiko-bot
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=sashiko-outbox-239682@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=julius@bairaktaris.de \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.