Re: [PATCH net-next v7 4/5] ip6_gre: go by the inner protocol behind VLAN tags in ip6erspan
From: netdev-bot+sashiko
Date: Wed Dec 02 2026 - 22:59:47 EST
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