Skip to contentSkip to conversation

ovpn: don't drop skb's dst when xmitting packet

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

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

PATCH 1/1 ovpn: don't drop skb's dst when xmitting packet

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

When routing a packet to a LAN behind a peer, ovpn need to inspect the route entry that brought there the packet in the first place.

If this packet is truly routable, the route will provide the GW to be used to lookup the VPN peer to send the packet to.

However, the route entry is currently dropped before entering the ovpn xmit function, because the IFF_XMIT_DST_RELEASE priv_flag is set by default.

Clear the IFF_XMIT_DST_RELEASE flag during interface setup to allow the route entry (skb's dst) to survive and thus be inspected by the routing logic.

---
 drivers/net/ovpn/main.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ovpn/main.c +5 -0
index 0acb0934c1be..e17992b937bc 100644
@@ -157,6 +157,11 @@ static void ovpn_setup(struct net_device *dev)
 	dev->type = ARPHRD_NONE;
 	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
 	dev->priv_flags |= IFF_NO_QUEUE;
+	/* when routing packet to a LAN behind a client, we rely on the
+	 * route entry that originally brought the packet into ovpn, so
+	 * don't release it
+	 */
+	dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
 
 	dev->lltx = true;
 	dev->features |= feat;
Signature · 1 line
2.49.0
Tested-by Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 3 lines · Antonio Quartulli

Clear the IFF_XMIT_DST_RELEASE flag during interface setup to allow the route entry (skb's dst) to survive and thus be inspected by the routing logic.

Tested, fixes the problem I reported in

https://github.com/OpenVPN/ovpn-net-next/issues/2

... and is also the arguably correct thing to do - packet forwarding resolves a next-hop for us, so we should ensure we see & use it :-)

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
#2 lore raw
Quoted 9 lines · Gert Doering

Hi,

Quoted 3 lines · Antonio Quartulli

Clear the IFF_XMIT_DST_RELEASE flag during interface setup to allow the route entry (skb's dst) to survive and thus be inspected by the routing logic.

Tested, fixes the problem I reported in

Quoted 8 lines

https://github.com/OpenVPN/ovpn-net-next/issues/2

... and is also the arguably correct thing to do - packet forwarding resolves a next-hop for us, so we should ensure we see & use it :-)

Merged to main branch, commit id 7618f9707173

Thanks!

Signature · 1 line
Antonio Quartulli