Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The commit message describes the bug and the fix only for inbound policy lookup of IPv6 atomic fragments. -- xfrm: fix IPv6 first-fragment protocol decode This patch sets FLOW_DISSECTOR_F_PARSE_1ST_FRAG for IPv6 in __xfrm_decode_session(). With that flag, the flow dissector walks past the Fragment header of a first fragment to reach the real upper-layer protocol. It also stops decode_session6() from filling the port, ICMPv6 and GRE selector fields when the packet is a fragment.
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c > index 6edf60242a80f..6baff3f797f8c 100644 > --- a/net/xfrm/xfrm_policy.c > +++ b/net/xfrm/xfrm_policy.c
[ ... ]
> @@ -3511,10 +3517,13 @@ int __xfrm_decode_session(struct net *net, struct sk_buff *skb, struct flowi *fl > unsigned int family, int reverse) > { > struct xfrm_flow_keys flkeys; > + unsigned int flags = FLOW_DISSECTOR_F_STOP_AT_ENCAP; > > memset(&flkeys, 0, sizeof(flkeys)); > + if (family == AF_INET6) > + flags |= FLOW_DISSECTOR_F_PARSE_1ST_FRAG;
[Severity: Low] This isn't a bug, but should the commit message describe the full impact of this change? The message says: For an atomic fragment followed by extension headers, inbound policy lookup can therefore see the header after Fragment instead of the actual upper-layer protocol and miss protocol selectors. Every AF_INET6 caller of __xfrm_decode_session() now gets the new flag, not only the inbound path. In __skb_flow_dissect(), the NEXTHDR_FRAGMENT case continues for any first fragment and does not check the M bit: net/core/flow_dissector.c:__skb_flow_dissect() { ... if (!(fh->frag_off & htons(IP6_OFFSET))) { key_control->flags |= FLOW_DIS_FIRST_FRAG; if (flags & FLOW_DISSECTOR_F_PARSE_1ST_FRAG) { fdret = FLOW_DISSECT_RET_IPPROTO_AGAIN; ... } Consider a router without conntrack defrag that forwards a non-atomic first fragment (offset 0, M=1) with a Destination Options header after the Fragment header. That packet now reaches both policy lookups through this decoder: ip6_forward() xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb) __xfrm_decode_session() xfrm6_route_forward(skb) __xfrm_decode_session() Before this patch, ip_proto came out as the Fragment header's nexthdr (60 for DSTOPTS), so FWD or OUT policies with a protocol selector did not match. After this patch they see the real upper-layer protocol. Since this is Cc: stable, could the message also say that FWD and outbound IPsec policy selection for forwarded non-atomic first fragments changes too?
> __skb_flow_dissect(net, skb, &xfrm_session_dissector, &flkeys, > - NULL, 0, 0, 0, FLOW_DISSECTOR_F_STOP_AT_ENCAP); > + NULL, 0, 0, 0, flags); > > switch (family) { > case AF_INET:
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40secunet.com