Re: [PATCH net-next v4 07/10] ip_tunnel: add drop reasons to the transmit path
From: Ido Schimmel
Date: Wed Sep 23 2026 - 12:01:19 EST
On Wed, Sep 23, 2026 at 01:15:04AM +0300, Anton Danilov wrote:
> @@ -711,9 +721,15 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
>
> if (!skb_dst(skb)) {
> DEV_STATS_INC(dev, tx_fifo_errors);
> + reason = SKB_DROP_REASON_NO_TX_TARGET;
> goto tx_error;
> }
>
> + /* Only the branches below can derive a destination. If
> + * none of them matches, the payload protocol is not one
> + * this tunnel can carry.
> + */
> + reason = SKB_DROP_REASON_UNHANDLED_PROTO;
> tun_info = skb_tunnel_info(skb);
> if (tun_info && (tun_info->mode & IP_TUNNEL_INFO_TX) &&
> ip_tunnel_info_af(tun_info) == AF_INET &&
> @@ -734,8 +750,10 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
>
> neigh = dst_neigh_lookup(skb_dst(skb),
> &ipv6_hdr(skb)->daddr);
> - if (!neigh)
> + if (!neigh) {
> + reason = SKB_DROP_REASON_NEIGH_CREATEFAIL;
> goto tx_error;
> + }
>
> addr6 = (const struct in6_addr *)&neigh->primary_key;
> addr_type = ipv6_addr_type(addr6);
> @@ -752,8 +770,10 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
> dst = addr6->s6_addr32[3];
> }
> neigh_release(neigh);
> - if (do_tx_error_icmp)
> + if (do_tx_error_icmp) {
> + reason = SKB_DROP_REASON_NO_TX_TARGET;
> goto tx_error_icmp;
> + }
> }
> #endif
> else
Makes more sense:
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 66cb0b86fa79..20b666fcca9a 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -725,11 +725,6 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
goto tx_error;
}
- /* Only the branches below can derive a destination. If
- * none of them matches, the payload protocol is not one
- * this tunnel can carry.
- */
- reason = SKB_DROP_REASON_UNHANDLED_PROTO;
tun_info = skb_tunnel_info(skb);
if (tun_info && (tun_info->mode & IP_TUNNEL_INFO_TX) &&
ip_tunnel_info_af(tun_info) == AF_INET &&
@@ -776,8 +771,10 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
}
}
#endif
- else
+ else {
+ reason = SKB_DROP_REASON_UNHANDLED_PROTO;
goto tx_error;
+ }
if (!md)
connected = false;