Skip to contentSkip to conversation

ovpn: fix ndo_start_xmit return value on error

PATCH In review Antonio Quartulli 2 participants 4 messages May 7, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ovpn: fix ndo_start_xmit return value on error

From: Antonio Quartulli <[email protected]...>

ndo_start_xmit is basically expected to always return NETDEV_TX_OK. However, in case of error, it was currently returning NET_XMIT_DROP, which is not a valid netdev_tx_t return value, leading to misinterpretation.

Change ndo_start_xmit to always return NETDEV_TX_OK to signal back to the caller that the packet was handled (even if dropped).

Effects of this bug can be seen when sending IPv6 packets having no peer to forward them to:

  $ ip netns exec ovpn-server oping -c20 fd00:abcd:220:201::1
  PING fd00:abcd:220:201::1 (fd00:abcd:220:201::1) 56 bytes of data.00:abcd:220:201 :1
  ping_send failed: No buffer space available
  ping_sendto: No buffer space available
  ping_send failed: No buffer space available
  ping_sendto: No buffer space available
  ...
Fixes c2d950c4672a ("ovpn: add basic interface creation/destruction/management routines")
---
 drivers/net/ovpn/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ovpn/io.c +1 -1
index dd8a8055d967..03728ce733a9 100644
@@ -408,7 +408,7 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev)
 	dev_dstats_tx_dropped(ovpn->dev);
 	skb_tx_error(skb);
 	kfree_skb_list(skb);
-	return NET_XMIT_DROP;
+	return NETDEV_TX_OK;
 }
 
 /**
Signature · 1 line
2.49.0
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 32 lines · Antonio Quartulli

From: Antonio Quartulli <[email protected]...>

ndo_start_xmit is basically expected to always return NETDEV_TX_OK. However, in case of error, it was currently returning NET_XMIT_DROP, which is not a valid netdev_tx_t return value, leading to misinterpretation.

Change ndo_start_xmit to always return NETDEV_TX_OK to signal back to the caller that the packet was handled (even if dropped).

Effects of this bug can be seen when sending IPv6 packets having no peer to forward them to:

  $ ip netns exec ovpn-server oping -c20 fd00:abcd:220:201::1
  PING fd00:abcd:220:201::1 (fd00:abcd:220:201::1) 56 bytes of data.00:abcd:220:201 :1
  ping_send failed: No buffer space available
  ping_sendto: No buffer space available
  ping_send failed: No buffer space available
  ping_sendto: No buffer space available
  ...
Fixes c2d950c4672a ("ovpn: add basic interface creation/destruction/management routines")
---
 drivers/net/ovpn/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ovpn/io.c +0 -0
index dd8a8055d967..03728ce733a9 100644

drivers/net/ovpn/io.c netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) · line 412

Quoted 6 lines
drivers/net/ovpn/io.c +1 -1
@@ -408,7 +408,7 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev)
 	dev_dstats_tx_dropped(ovpn->dev);
 	skb_tx_error(skb);
 	kfree_skb_list(skb);
-	return NET_XMIT_DROP;
+	return NETDEV_TX_OK;
 }

Tested, works :-) - so the previous behaviour was "oping was hanging due to 'out of buffer space' error not being counted as 'packet sent'" and now it's behaving as any regular network interface when there is no ARP/IPv6 ND for that neighbour. Explanation makes sense, too :-)

So

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
Tested-by Acked-by
#2 lore raw

Hi,

Quoted 8 lines · Gert Doering

Tested, works :-) - so the previous behaviour was "oping was hanging due to 'out of buffer space' error not being counted as 'packet sent'" and now it's behaving as any regular network interface when there is no ARP/IPv6 ND for that neighbour. Explanation makes sense, too :-)

So

Antonio says if I test this, I should state so...

here we go :-)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
author Applied
#3 lore raw
Quoted 10 lines · Gert Doering

Hi,

Quoted 7 lines · Gert Doering

Tested, works :-) - so the previous behaviour was "oping was hanging due to 'out of buffer space' error not being counted as 'packet sent'" and now it's behaving as any regular network interface when there is no ARP/IPv6 ND for that neighbour. Explanation makes sense, too :-)

So

Quoted 8 lines
Quoted 1 line

Antonio says if I test this, I should state so...

here we go :-)

Merged to main branch, commit id 2176a2102216

Thanks!

Signature · 1 line
Antonio Quartulli