Re: [PATCH net-next v4 04/10] ip_tunnel: add __iptunnel_pull_header_reason()
From: Ido Schimmel <idosch@nvidia.com>
Date: 2026-09-23 15:41:36
Also in:
lkml
Subsystem:
networking drivers, networking [general], networking [ipv4/ipv6], the rest · Maintainers:
Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds
On Wed, Sep 23, 2026 at 01:15:01AM +0300, Anton Danilov wrote:
quoted hunk ↗ jump to hunk
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 7102aa11fae2..c68031d01c39 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h@@ -614,8 +614,17 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, return INET_ECN_encapsulate(tos, inner); } -int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len, - __be16 inner_proto, bool raw_proto, bool xnet); +enum skb_drop_reason +__iptunnel_pull_header_reason(struct sk_buff *skb, int hdr_len, + __be16 inner_proto, bool raw_proto, bool xnet); + +static inline int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len, + __be16 inner_proto, bool raw_proto, + bool xnet) +{ + return __iptunnel_pull_header_reason(skb, hdr_len, inner_proto, + raw_proto, xnet) ? -ENOMEM : 0; +}
Either append patches to this series or as a follow-up, after this series the only caller of __iptunnel_pull_header() other than iptunnel_pull_header() is the VXLAN driver and it should be converted to report the actual drop reason instead of NOMEM:
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 347245cc1de4..5c429a70987e 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c@@ -1720,11 +1720,11 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) raw_proto = true; } - if (__iptunnel_pull_header(skb, VXLAN_HLEN, protocol, raw_proto, - !net_eq(vxlan->net, dev_net(vxlan->dev)))) { - reason = SKB_DROP_REASON_NOMEM; + reason = __iptunnel_pull_header_reason(skb, VXLAN_HLEN, protocol, + raw_proto, + !net_eq(vxlan->net, dev_net(vxlan->dev))); + if (reason) goto drop; - } if (vxlan->cfg.flags & VXLAN_F_REMCSUM_RX) { reason = vxlan_remcsum(skb, vxlan->cfg.flags);
Then remove __iptunnel_pull_header():
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 27a9e097996b..a94dadfa81f2 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h@@ -614,18 +614,11 @@ enum skb_drop_reason __iptunnel_pull_header_reason(struct sk_buff *skb, int hdr_len, __be16 inner_proto, bool raw_proto, bool xnet); -static inline int __iptunnel_pull_header(struct sk_buff *skb, int hdr_len, - __be16 inner_proto, bool raw_proto, - bool xnet) +static inline bool iptunnel_pull_header(struct sk_buff *skb, int hdr_len, + __be16 inner_proto, bool xnet) { - return __iptunnel_pull_header_reason(skb, hdr_len, inner_proto, - raw_proto, xnet) ? -ENOMEM : 0; -} - -static inline int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, - __be16 inner_proto, bool xnet) -{ - return __iptunnel_pull_header(skb, hdr_len, inner_proto, false, xnet); + return __iptunnel_pull_header_reason(skb, hdr_len, inner_proto, false, + xnet) != SKB_NOT_DROPPED_YET; } void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,