[PATCH net-next v4 09/10] ip6_gre: make prepare_ip6gre_xmit_other() void
From: Anton Danilov
Date: Tue Sep 22 2026 - 18:24:01 EST
prepare_ip6gre_xmit_other() copies the flow template of the tunnel and
picks up its encapsulation limit, DS field and mark. Unlike its IPv6
sibling, which fails when the packet's tunnel encapsulation limit option
is 0 and so forbids encapsulating it again, it has nothing to fail on:
its only return statement is "return 0", and it has been that way since
commit 41337f52b967 ("ip6_gre: set DSCP for non-IP") added the function.
Its caller still checks the result and bails out on a branch that never
runs.
Make it void and drop the check, the way prepare_ip6gre_xmit_ipv4() is
already called. The next patch gives every failing branch of the
transmit path a drop reason, and this one would otherwise get a reason
it can never report.
Assisted-by: Claude-Code:claude-fable-5-1
Signed-off-by: Anton Danilov <littlesmilingcloud@xxxxxxxxx>
---
net/ipv6/ip6_gre.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index ada48e23ca9d..6a0a508e0091 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -680,10 +680,10 @@ static int prepare_ip6gre_xmit_ipv6(struct sk_buff *skb,
return 0;
}
-static int prepare_ip6gre_xmit_other(struct sk_buff *skb,
- struct net_device *dev,
- struct flowi6 *fl6, __u8 *dsfield,
- int *encap_limit)
+static void prepare_ip6gre_xmit_other(struct sk_buff *skb,
+ struct net_device *dev,
+ struct flowi6 *fl6, __u8 *dsfield,
+ int *encap_limit)
{
struct ip6_tnl *t = netdev_priv(dev);
@@ -703,8 +703,6 @@ static int prepare_ip6gre_xmit_other(struct sk_buff *skb,
fl6->flowi6_mark = t->parms.fwmark;
fl6->flowi6_uid = sock_net_uid(dev_net(dev), NULL);
-
- return 0;
}
static struct ip_tunnel_info *skb_tunnel_info_txcheck(struct sk_buff *skb)
@@ -865,9 +863,9 @@ static int ip6gre_xmit_other(struct sk_buff *skb, struct net_device *dev)
__u32 mtu;
int err;
- if (!t->parms.collect_md &&
- prepare_ip6gre_xmit_other(skb, dev, &fl6, &dsfield, &encap_limit))
- return -1;
+ if (!t->parms.collect_md)
+ prepare_ip6gre_xmit_other(skb, dev, &fl6,
+ &dsfield, &encap_limit);
err = gre_handle_offloads(skb, test_bit(IP_TUNNEL_CSUM_BIT,
t->parms.o_flags));
--
2.47.3