Re: [PATCH net-next v11 12/23] ovpn: implement TCP transport

From: Antonio Quartulli
Date: Thu Oct 31 2024 - 10:30:46 EST


On 29/10/2024 11:47, Antonio Quartulli wrote:
[...]
+
+ /* DATA_V2 packets are handled in kernel, the rest goes to user space */
+ if (likely(ovpn_opcode_from_skb(skb, 0) == OVPN_DATA_V2)) {
+ /* hold reference to peer as required by ovpn_recv().
+ *
+ * NOTE: in this context we should already be holding a
+ * reference to this peer, therefore ovpn_peer_hold() is
+ * not expected to fail
+ */
+ if (WARN_ON(!ovpn_peer_hold(peer)))
+ goto err;
+
+ ovpn_recv(peer, skb);
+ } else {

As pointed out by Sabrina, we are indeed sending DATA_V1 packets to userspace.
Not a big deal because userspace will likely ignore or drop them.

However, I will change this and mirror what we do for UDP.

Thanks.

Regards,


+ /* The packet size header must be there when sending the packet
+ * to userspace, therefore we put it back
+ */
+ skb_push(skb, 2);
+ ovpn_tcp_to_userspace(peer, strp->sk, skb);
+ }
+
+ return;



--
Antonio Quartulli
OpenVPN Inc.