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=1796270382; b=ophXvy9GHCaAqFSYybq0IlEAJQodMyL93piJzvnjGxQYzoN/ik3GhnVWODSsfmoVLM/s UkYNLWPo2I4eCl/LB5e0kpvMaiLx0e1vDdGF5UnKIgq7khhv/gja7MZ4B9IoghT8sls0+ KlLLItYj+irMMDsVBbGU5GJcnUqk1ntvu2UjF+tSCJsQCJNTv1sREKCY4oV97pbeCbG9o yF95Cji5KF4jGKrbWAx+n3AbfCw369rtVjExQg+ZuUlvRObNfGMiHKUAM+MdpV5wwu+RU lzfk3hILrjySNwRbGF3dwlzHFLFlLZ3gLVynN80usPKGJgPD8RYNQS8G98f61dflscA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796270382; 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=nJmjxv7P1zmLZLPqQKhJBD5QOZ5D+FIBSXoJcgbCH3s=; b=zEV4kY4nA1fEJF/4/iBBCZVk2w9a1+E4ZrGcaif8xxnmVevbM08h89HhKGxUgJTVRrjZ O2G6GSVGb66zg0UZzYEw1YO6s39aimGy08SW4KgnchVWSOFaC8YXETcO8dn1DWfujlAPA uE1NeDX4K04d2UM+U2wXz7zvqcWA0CqUXVeaYBAqkIdw8lDL14eLNL4bOxKyxuGz4aIgd K8pAsT9n5PgiOF1Z8qFGy/FdWZLL3EiCNJUkhZsURRsr1YIvbZBSX387IM+mKReq9X3kr G0HLQMAmqUMePVjdHu1IXdAVVEG4dmvnTutUaPIRkuxpvC57Q42+YQPvaGBzWkMAECQ== 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=B4LbI2Rk; 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 A49AB606A33C; Thu, 3 Dec 2026 03:59:42 +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=B4LbI2Rk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F8AC1F000C1; Thu, 3 Dec 2026 03:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796270382; bh=nJmjxv7P1zmLZLPqQKhJBD5QOZ5D+FIBSXoJcgbCH3s=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=B4LbI2RkBcI1t+dQzJb4rwdvePylEqKe7Ijbs3oqja9URyw29SZ/TptDY2Vx2546X 8PXUETWHZlYPoS46FLglGJzlBetsypdkKVYZ0KdnibuJ7597+ZRvEOGHO2xJ05ameh kR9wAztzX2021iY6+1Iu5YtNFZTjfcP75XmupMe36+iqXXzjWf3a0kY5xUBjVbj6iQ 9O/WsZXzkrudBVJ5a5uDRrpCy4cWZsKrv9z86IpJZEnKgm9hMFvhzfqjlP8nqPdsup sbCtfn60F7P1897Q/CUOpUssGRRBd2pqIdlTIz8csFY/telxs0UAHfjOldh1UCkSlN o0OXWO4cpspiQ== Subject: Re: [PATCH net-next v7 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 03:59:40 +0000 Message-ID: <179627038087.3146.15958875713666581523@kernel.org> In-Reply-To: <20261201005941.1536429-5-littlesmilingcloud@gmail.com> References: <20261201005941.1536429-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 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 3 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] ip6erspan_tunnel_xmit() (net/ipv6/ip6_gre.c:1135-1139) now picks the Packet Too Big type with `if (payload_protocol ==… - [Low] Switching the native-mode dispatch in ip6erspan_tunnel_xmit() (net/ipv6/ip6_gre.c:1090) from skb->protocol to payload_protocol sends… - [Low] The subject says the change is 'in ip6erspan', but the ip6_tunnel.c hunk changes the shared ip6_tnl_xmit() MTU floor… - [Low] The patch fixes misbehaviour that users can see in ip6erspan_tunnel_xmit(), and the commit message says it was confirmed… -- ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan With this patch, ip6erspan_tunnel_xmit() uses the payload_protocol from ip6gre_xmit_classify() instead of skb->protocol for VLAN-tagged frames. That value now picks the traffic class, flow label, ERSPAN truncation bit and ICMP error type. The patch makes the same change to the minimum MTU floor in ip6_tnl_xmit(). > diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c > index d7d7fd4782001..698cf1cdd4ab6 100644 > --- a/net/ipv6/ip6_gre.c > +++ b/net/ipv6/ip6_gre.c > @@ -1021,11 +1021,11 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, > } > > nhoff = skb_network_offset(skb); > - if (skb->protocol == htons(ETH_P_IP) && > + if (payload_protocol == htons(ETH_P_IP) && > (ntohs(ip_hdr(skb)->tot_len) > skb->len - nhoff)) > truncate = true; [Severity: Low] Should this patch carry a Fixes: tag? The commit message says the behaviour was confirmed in a VM. Tagged frames went out with outer traffic class 0. The ERSPAN T bit was not set from the inner IP length. An oversized IPv4 packet behind a tag got an ICMPv6 Packet Too Big built from its IPv4 header. The first and previous patches in this series each have two Fixes: tags, but this one has none. Without a tag, stable selection has nothing that links this change to the classify patch it depends on. > > - if (skb->protocol == htons(ETH_P_IPV6)) { > + if (payload_protocol == htons(ETH_P_IPV6)) { > int thoff; > [ ... ] > @@ -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) { > case htons(ETH_P_IP): > memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); > prepare_ip6gre_xmit_ipv4(skb, dev, &fl6, [Severity: Low] This switch now sends tagged IPv4/IPv6 frames through prepare_ip6gre_xmit_ipv4() and prepare_ip6gre_xmit_ipv6(). Before, they went to the default arm, which only copied t->fl.u.ip6. The commit message lists the traffic class, flow label, T bit and ICMP type. Doesn't this also change a few other things for tagged frames? The encap limit is now applied unless IP6_TNL_F_IGN_ENCAP_LIMIT is set: prepare_ip6gre_xmit_ipv4() { if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) *encap_limit = t->parms.encap_limit; ... } As a result, ip6_tnl_xmit() pushes the 8-byte tunnel encapsulation limit destination option and lowers its mtu by 8. With the iproute2 default encap limit of 4, tagged frames now carry an extra destination options header on the wire. fl6.flowi6_mark now becomes t->parms.fwmark or skb->mark. It used to be 0. A statically configured tclass, ip6_tclass(t->parms.flowinfo), now reaches the outer header. Before, dsfield was 0. Tagged IPv6 frames also get two new drop paths: - the inner saddr equals t->parms.raddr - the inner TEL option has encap_limit 0, in which case prepare_ip6gre_xmit_ipv6() also sends ICMPV6_PARAMPROB Untagged ip6erspan traffic and tagged ip6gretap traffic already get all of this, so the code itself looks fine. The previous patch listed its side effects under "What changes for traffic that was not broken before". Could this commit message mention these changes in the same way? [ ... ] > @@ -1132,7 +1132,7 @@ 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 [Severity: Medium] Because of the catch-all else, every payload that is not IPv4 still gets icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu). Is that intended? Take a VLAN-tagged frame whose inner type is neither IPv4 nor IPv6, such as MPLS, ARP or PPPoE behind a tag. ip6gre_xmit_classify() leaves payload_protocol at the VLAN type and does not move the network header. The comment on ip6gre_xmit_classify() says such frames are sent: * as it is, with the * network header left alone, and no field is taken from it. icmp6_send() does not check the protocol. It reads the bytes at the network header as an ipv6hdr, within the linear area, and sends the Packet Too Big to hdr->saddr. Here hdr->saddr is just payload bytes. For ICMPV6_PKT_TOOBIG, icmp6_send() also skips the multicast and non-PACKET_HOST filter. The mtu passed here can also be below IPV6_MIN_MTU. ip6_tnl_xmit() clamps to IPV4_MIN_MTU when payload_protocol is not ETH_P_IPV6. For example, the mtu can be around 1210-1218 when the outer path MTU is 1280. The -EMSGSIZE check in ip6_tnl_xmit() does not depend on the protocol. A large non-GSO tagged frame can therefore reach this path when the outer path MTU is below the device MTU plus overhead. For comparison, ip6gre_xmit_other() sends no ICMP for the same result, and ipxip6_tnl_xmit() does nothing in its default case: case IPPROTO_IPV6: icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); break; default: break; Untagged non-IP payloads already behaved this way before the series. Since this hunk makes the ICMP family follow the real payload, should the else become else if (payload_protocol == htons(ETH_P_IPV6))? > diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c > index 868c49b97a8f9..8ccc90333c99e 100644 > --- a/net/ipv6/ip6_tunnel.c > +++ b/net/ipv6/ip6_tunnel.c > @@ -1227,7 +1227,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield, > max_headroom += 8; > mtu -= 8; > } > - mtu = max(mtu, skb->protocol == htons(ETH_P_IPV6) ? > + mtu = max(mtu, payload_protocol == htons(ETH_P_IPV6) ? > IPV6_MIN_MTU : IPV4_MIN_MTU); [Severity: Low] The subject says "in ip6erspan", but every caller shares ip6_tnl_xmit(). Doesn't this hunk also change ip6gretap? ip6gre_xmit_ipv6() already passes htons(ETH_P_IPV6) as payload_protocol for VLAN-tagged IPv6 frames: err = __gre6_xmit(skb, dev, dsfield, &fl6, encap_limit, &mtu, skb->protocol, htons(ETH_P_IPV6)); Before this patch, the floor for those frames came from the VLAN skb->protocol, so it was IPV4_MIN_MTU. After it, the floor is IPV6_MIN_MTU. On ip6gretap, that changes when -EMSGSIZE and the ICMPv6 Packet Too Big fire. It also changes the value passed to skb_dst_update_pmtu_no_confirm(). For example, with an outer path MTU of 1280, a tagged IPv6 frame used to get -EMSGSIZE at around 1218 bytes. Now it passes the check and the outer IPv6 layer fragments it. The new floor looks correct and matches untagged IPv6 on ip6gretap. Could the commit message say that ip6gretap is affected too, given that it also says the minimum MTU was not measured? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201005941.1536429-1-littlesmilingcloud%40gmail.com