Re: [PATCH net-next v11 12/23] ovpn: implement TCP transport
From: Antonio Quartulli <antonio@openvpn.net>
Date: 2024-10-31 14:30:35
Also in:
linux-kselftest, lkml
From: Antonio Quartulli <antonio@openvpn.net>
Date: 2024-10-31 14:30:35
Also in:
linux-kselftest, lkml
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.