Skip to contentSkip to conversation

ovpn: propagate socket mark to skb in UDP

PATCH In review Ralf Lici 2 participants 2 messages Jun 4, 2025 – Jun 12, 2025

Subsystems (2)
lore
Share & tools
lore

Ralf Lici

author
#0 lore raw

PATCH 1/1 ovpn: propagate socket mark to skb in UDP

openvpn implements the --mark option, which utilizes the SO_MARK Linux socket option. However, in the UDP code path, the socket's sk_mark value is not currently propagated to skb objects that pass through our socket.

This commit ensures proper inheritance of the field by assigning sk_mark to skb->mark before handing the skb to the network stack for transmission.

---
 drivers/net/ovpn/udp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ovpn/udp.c +1 -0
index b4fbebad8f45..4f9c9a9a889a 100644
@@ -344,6 +344,7 @@ void ovpn_udp_send_skb(struct ovpn_peer *peer, struct sock *sk,
 	int ret;
 
 	skb->dev = peer->ovpn->dev;
+	skb->mark = READ_ONCE(sk->sk_mark);
 	/* no checksum performed at this layer */
 	skb->ip_summed = CHECKSUM_NONE;
 
Signature · 1 line
2.49.0
#1 lore raw
Quoted 10 lines · Ralf Lici

openvpn implements the --mark option, which utilizes the SO_MARK Linux socket option. However, in the UDP code path, the socket's sk_mark value is not currently propagated to skb objects that pass through our socket.

This commit ensures proper inheritance of the field by assigning sk_mark to skb->mark before handing the skb to the network stack for transmission.

Well done!
This patch has been merged to the development branch.

Thanks

Signature · 1 line
Antonio Quartulli