Skip to content

Commit 5d9ee84

Browse files
ordexNipaLocal
authored and
NipaLocal
committed
ovpn: don't drop skb's dst when xmitting packet
When routing a packet to a LAN behind a peer, ovpn needs to inspect the route entry that brought the packet there in the first place. If this packet is truly routable, the route entry provides the GW to be used when looking up 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 enabled 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 ovpn routing logic. Fixes: a3aaef8 ("ovpn: implement peer lookup logic") Reported-by: Gert Doering <[email protected]> Closes: OpenVPN#2 Tested-by: Gert Doering <[email protected]> Acked-by: Gert Doering <[email protected]> # as a primary user Link: https://www.mail-archive.com/[email protected]/msg31583.html Signed-off-by: Antonio Quartulli <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 093f878 commit 5d9ee84

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/net/ovpn/io.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev)
398398
netdev_name(ovpn->dev));
399399
goto drop;
400400
}
401+
/* dst was needed for peer selection - it can now be dropped */
402+
skb_dst_drop(skb);
401403

402404
ovpn_peer_stats_increment_tx(&peer->vpn_stats, skb->len);
403405
ovpn_send(ovpn, skb_list.next, peer);

drivers/net/ovpn/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ static void ovpn_setup(struct net_device *dev)
157157
dev->type = ARPHRD_NONE;
158158
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
159159
dev->priv_flags |= IFF_NO_QUEUE;
160+
/* when routing packets to a LAN behind a client, we rely on the
161+
* route entry that originally brought the packet into ovpn, so
162+
* don't release it
163+
*/
164+
netif_keep_dst(dev);
160165

161166
dev->lltx = true;
162167
dev->features |= feat;

0 commit comments

Comments
 (0)