Re: [PATCH net-next v12 08/22] ovpn: implement basic RX path (UDP)

From: Paolo Abeni
Date: Tue Dec 03 2024 - 09:43:56 EST


On 12/2/24 16:07, Antonio Quartulli wrote:
> diff --git a/drivers/net/ovpn/io.c b/drivers/net/ovpn/io.c
> index 2a3dbc723813a14070159318097755cc7ea3f216..1bbbaae8639477b67626731c3bd14810a65dfdcd 100644
> --- a/drivers/net/ovpn/io.c
> +++ b/drivers/net/ovpn/io.c
> @@ -9,15 +9,78 @@
>
> #include <linux/netdevice.h>
> #include <linux/skbuff.h>
> +#include <net/gro_cells.h>
> #include <net/gso.h>
>
> -#include "io.h"
> #include "ovpnstruct.h"
> #include "peer.h"
> +#include "io.h"
> +#include "netlink.h"
> +#include "proto.h"
> #include "udp.h"
> #include "skb.h"
> #include "socket.h"
>
> +/* Called after decrypt to write the IP packet to the device.
> + * This method is expected to manage/free the skb.
> + */
> +static void ovpn_netdev_write(struct ovpn_peer *peer, struct sk_buff *skb)
> +{
> + unsigned int pkt_len;
> + int ret;
> +
> + /* we can't guarantee the packet wasn't corrupted before entering the
> + * VPN, therefore we give other layers a chance to check that
> + */
> + skb->ip_summed = CHECKSUM_NONE;
> +
> + /* skb hash for transport packet no longer valid after decapsulation */
> + skb_clear_hash(skb);
> +
> + /* post-decrypt scrub -- prepare to inject encapsulated packet onto the
> + * interface, based on __skb_tunnel_rx() in dst.h
> + */
> + skb->dev = peer->ovpn->dev;
> + skb_set_queue_mapping(skb, 0);
> + skb_scrub_packet(skb, true);
> +
> + skb_reset_network_header(skb);
> + skb_reset_transport_header(skb);
> + skb_probe_transport_header(skb);

This is a no-op after the previous call. You should drop it.

Thanks,

Paolo