From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796301544; b=i0H9Oe9JAFvVi5gPv8WIjwK8FWsF/BxYhhuyxG04YG9OhYsdXyArGVY7sufBtA0VV9sH CcH1KR7pVjqc3hhNioXqYs6aZAYFEB1hIDt2PPW9+FXFqW4rzIeCebrbfWom4H/rSQ7Kt +fxda3EnVmiiot+lOclydxhVr9ydL8mcZEgLfpyCxZDDHLxrp/Lf80lzU8eu3zguoNSNp W/xosjve+/P+6okUp4hdpbuXKCjIxUBoViIia+K3U5DPbyO5LxtNOafnSdADmkPoXmSj0 mtvpX/0vQzXW8YmOr6zzT5uVdRGOIuH9j4604mI4NlDd8K+Z6kTH0C6I/p2QTrIR1Dw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796301544; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=2yNQMCtxGNPKwPPlW6QD3n3RrNao4cRQzpom4G7rSt8=; b=WfomJ+arEFgoWEyOf0bL4kTy9nmUiTZeRT24yCWACObf6KQ79yXI+J2ESyrzmVcGPiEm Oeh53pqm2JOFcJKeiYMtoC7/gVn0OZLCjC8aUS+Pbj5DoSPrU+LwE2Aer7dHSR+dfoj3O vHhq5MQkaPKifroUT4O2dsM3M9RScUAiOF6MKY+IHomNPniWQ0SGcbmtmpraaCtxHHT7I Pblqw0SujuCyBlgiZGVPadsiTy0bNogBc7HnL4KYiq2Z7lfYBiuXJPdJD64oHKlvb/xto MpW7agI2j7zb8FQQ8VzhwmfN80AlozEn4MuL+QNsENUPS/kLD4K7y90VSGTAVsvOU6Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PasfUVDO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 795CA606A330; Thu, 3 Dec 2026 12:39:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PasfUVDO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 276071F000C1; Thu, 3 Dec 2026 12:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796301544; bh=2yNQMCtxGNPKwPPlW6QD3n3RrNao4cRQzpom4G7rSt8=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PasfUVDOOoOGgfSpd4ybhr/CucZGPm5gG+fY+UYRPPqN4CDpDUAZ0B2FZlPU0ZBgp x0xLx/Ind3jixLO3evEi6cpCde/L2W+TL0gTlDEo7gn5cfKfF/hU7qcNqE0bgJe8Qb ah1KUrIwCBVsNv3c1La9tgUrtRNyUA619yWOJBUKllBQZwEdwxNNjqpxqdcSdlfgZm cTbuyDX4KMAMLRe8pnJYaygLtUtfwBiN6eTnyGSY5rjsY0NxK2fIeIPxqWtd95qolG qfAxsd3n27bwhVaX6FNvGueMs1NyFpckaQLTCiETS6E7/zrNxVEoUHKQHw/A9ZLSGB bx5xybH8LXuWg== Subject: Re: [PATCH net-next v8 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan From: netdev-bot+sashiko@kernel.org To: littlesmilingcloud@gmail.com Cc: netdev@vger.kernel.org, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net, horms@kernel.org, dsahern@kernel.org, willemb@google.com, idosch@nvidia.com, fw@strlen.de, u9012063@gmail.com, mvohra@vmware.com, matthias.may@westermo.com, mazin@getstate.dev, shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 03 Dec 2026 12:39:02 +0000 Message-ID: <179630154270.3146.6100860750270294903@kernel.org> In-Reply-To: <20261202123613.1708463-5-littlesmilingcloud@gmail.com> References: <20261202123613.1708463-5-littlesmilingcloud@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 2 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The advertised MTU on the -EMSGSIZE path is too large for ip6erspan, and this patch now sends it to VLAN-tagged IPv4 senders as… - [Low] The commit message does not mention several behaviour changes the patch makes. - [Low] The patch fixes user-visible bugs in ip6erspan_tunnel_xmit() but has no Fixes: tag. -- ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan This patch makes ip6erspan_tunnel_xmit() and ip6_tnl_xmit() use the payload protocol classified on tunnel entry instead of skb->protocol. With this, VLAN-tagged IPv4/IPv6 frames get traffic class inheritance, length checks and the matching ICMP error. On -EMSGSIZE, non-IP payloads no longer go down the ICMPv6 error path. > ip6erspan_tunnel_xmit() uses skb->protocol to select the inner header > for traffic class and flow label inheritance, length checks and ICMP > errors. ip6_tnl_xmit() uses it to select the minimum MTU. When the > protocol is a VLAN EtherType, a tagged IPv4 packet can lose its traffic > class and take the ICMPv6 error path on -EMSGSIZE. [ ... ] > Signed-off-by: Anton Danilov [Severity: Low] Should this patch have a Fixes: tag? Users can see both behaviours fixed here: - On native ip6erspan, tagged IPv4/IPv6 lost traffic class and flow label inheritance because the switch fell into the default branch. - On -EMSGSIZE, every non-IPv4 payload (ARP, or IPv4 behind a tag) went to icmpv6_ndo_send() through the unconditional else. Both go back to the original ip6erspan native and collect_md support. This patch also depends on payload_protocol, which comes from the previous patch in the series, "ip6_gre: classify the inner packet once on transmit". That patch does carry Fixes: tags. Without a tag here, could stable tooling pick up the prerequisite but miss this follow-up? That would leave ip6erspan only partly fixed in stable trees. > diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c > index c413e47c6ceb0..0ecee2271bbd1 100644 > --- a/net/ipv6/ip6_gre.c > +++ b/net/ipv6/ip6_gre.c [ ... ] > @@ -1087,7 +1087,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, > goto tx_err; > } > } else { > - switch (skb->protocol) { > + switch (payload_protocol) { [Severity: Low] This isn't a bug, but should the commit message describe the other behaviour changes for tagged frames on native ip6erspan? With switch (payload_protocol), VLAN-tagged IPv4/IPv6 frames now go through prepare_ip6gre_xmit_ipv4() and prepare_ip6gre_xmit_ipv6(). They used to take the default branch, which left encap_limit at -1: default: memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); break; For tagged traffic this means: - encap_limit now comes from t->parms.encap_limit unless IP6_TNL_F_IGN_ENCAP_LIMIT is set. Unset is the default, because ip6gre_netlink_parms() zeroes the flags. ip6_tnl_xmit() then lowers mtu by 8 and pushes an 8-byte Tunnel Encapsulation Limit destination option, so the packets on the wire change. - With IP6_TNL_F_USE_ORIG_FWMARK, the outer route lookup now uses skb->mark. - Tagged IPv6 frames whose source equals t->parms.raddr are now dropped. - Tagged IPv6 frames that carry an encap limit option of 0 are now dropped, and an ICMPv6 Parameter Problem is sent. The subject mentions only ip6erspan, but the floor change in ip6_tnl_xmit() also affects ip6gretap. ip6gre_xmit_ipv6() passes ETH_P_IPV6 as payload_protocol for tagged IPv6: err = __gre6_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu, skb->protocol, htons(ETH_P_IPV6)); So tagged IPv6 on ip6gretap now gets the IPV6_MIN_MTU floor instead of IPV4_MIN_MTU. Untagged traffic already behaves this way, so these changes are probably intended. The previous patch in the series, "ip6_gre: classify the inner packet once on transmit", has a "What changes for traffic that was not broken before" section. Could this patch have a similar one? > case htons(ETH_P_IP): > memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); > prepare_ip6gre_xmit_ipv4(skb, dev, &fl6, > @@ -1132,10 +1132,10 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, > if (err != 0) { > /* XXX: send ICMP error even if DF is not set. */ > if (err == -EMSGSIZE) { > - if (skb->protocol == htons(ETH_P_IP)) > + if (payload_protocol == htons(ETH_P_IP)) > icmp_ndo_send(skb, ICMP_DEST_UNREACH, > ICMP_FRAG_NEEDED, htonl(mtu)); > - else > + else if (payload_protocol == htons(ETH_P_IPV6)) > icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); [Severity: Medium] Is the mtu reported here small enough for ip6erspan? VLAN-tagged IPv4 senders now receive it too. In ip6_tnl_xmit(), the only tunnel header subtracted from the advertised value is the GRE header, via t->tun_hlen: mtu = dst6_mtu(dst) - eth_hlen - psh_hlen - t->tun_hlen; ... if (skb->len - t->tun_hlen - eth_hlen > mtu && !skb_is_gso(skb)) { *pmtu = mtu; err = -EMSGSIZE; ip6erspan_calc_hlen() sets tun_hlen to 8 and counts the ERSPAN header only in t->hlen: tunnel->tun_hlen = 8; tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen + erspan_hdr_len(tunnel->parms.erspan_ver); By the time ip6_tnl_xmit() runs, ip6erspan_tunnel_xmit() has already pushed the ERSPAN and GRE headers. ip6gre_xmit_classify() has also put the network header behind the tags, at depth = ETH_HLEN + 4 * n_tags. So the length check passes only when the inner IP length is at most mtu - erspan_hdr_len - 4 * n_tags. Yet icmp_ndo_send() and icmpv6_ndo_send() advertise mtu itself, and skb_dst_update_pmtu_no_confirm() caches that same value on the inner route. A sender that honours this Frag Needed or Packet Too Big would shrink its packets to mtu, get rejected again with the same mtu, and never converge. Wouldn't packets in the window (mtu - erspan_hdr_len - 4 * n_tags, mtu] be black-holed? The test result in the commit message looks like an example of this: "Each error quoted the original Echo Request and advertised MTU 1338." With that path MTU, the largest inner packet that passes the check seems to be 1330 bytes for v1 without a tag, and 1326 bytes for v1 with one 802.1Q tag. The ERSPAN header part already affected untagged traffic before this patch. The tag bytes part is new exposure for tagged IPv4 on ip6erspan. > } > [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202123613.1708463-1-littlesmilingcloud%40gmail.com