Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: introduce OpenVPN Data Channel Offload (ovpn)

OpenVPN is a userspace software existing since around 2005 that allows
users to create secure tunnels.

So far OpenVPN has implemented all operations in userspace, which
implies several back and forth between kernel and user land in order to
process packets (encapsulate/decapsulate, encrypt/decrypt, rerouting..).

With `ovpn` we intend to move the fast path (data channel) entirely
in kernel space and thus improve user measured throughput over the
tunnel.

`ovpn` is implemented as a simple virtual network device driver, that
can be manipulated by means of the standard RTNL APIs. A device of kind
`ovpn` allows only IPv4/6 traffic and can be of type:
* P2P (peer-to-peer): any packet sent over the interface will be
encapsulated and transmitted to the other side (typical OpenVPN
client or peer-to-peer behaviour);
* P2MP (point-to-multipoint): packets sent over the interface are
transmitted to peers based on existing routes (typical OpenVPN
server behaviour).

After the interface has been created, OpenVPN in userspace can
configure it using a new Netlink API. Specifically it is possible
to manage peers and their keys.

The OpenVPN control channel is multiplexed over the same transport
socket by means of OP codes. Anything that is not DATA_V2 (OpenVPN
OP code for data traffic) is sent to userspace and handled there.
This way the `ovpn` codebase is kept as compact as possible while
focusing on handling data traffic only (fast path).

Any OpenVPN control feature (like cipher negotiation, TLS handshake,
rekeying, etc.) is still fully handled by the userspace process.

When userspace establishes a new connection with a peer, it first
performs the handshake and then passes the socket to the `ovpn` kernel
module, which takes ownership. From this moment on `ovpn` will handle
data traffic for the new peer.
When control packets are received on the link, they are forwarded to
userspace through the same transport socket they were received on, as
userspace is still listening to them.

Some events (like peer deletion) are sent to a Netlink multicast group.

Although it wasn't easy to convince the community, `ovpn` implements
only a limited number of the data-channel features supported by the
userspace program.

Each feature that made it to `ovpn` was attentively vetted to
avoid carrying too much legacy along with us (and to give a clear cut to
old and probalby-not-so-useful features).

Notably, only encryption using AEAD ciphers (specifically
ChaCha20Poly1305 and AES-GCM) was implemented. Supporting any other
cipher out there was not deemed useful.

Both UDP and TCP sockets are supported.

As explained above, in case of P2MP mode, OpenVPN will use the main system
routing table to decide which packet goes to which peer. This implies
that no routing table was re-implemented in the `ovpn` kernel module.

This kernel module can be enabled by selecting the CONFIG_OVPN entry
in the networking drivers section.

NOTE: this first patch introduces the very basic framework only.
Features are then added patch by patch, however, although each patch
will compile and possibly not break at runtime, only after having
applied the full set it is expected to see the ovpn module fully working.

Cc: steffen.klassert@secunet.com
Cc: antony.antony@secunet.com
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
Link: https://patch.msgid.link/20250415-b4-ovpn-v26-1-577f6097b964@openvpn.net
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Antonio Quartulli and committed by
Paolo Abeni
9f23d943 df8398fb

+79
+8
MAINTAINERS
··· 18125 18125 F: drivers/irqchip/irq-ompic.c 18126 18126 F: drivers/irqchip/irq-or1k-* 18127 18127 18128 + OPENVPN DATA CHANNEL OFFLOAD 18129 + M: Antonio Quartulli <antonio@openvpn.net> 18130 + L: openvpn-devel@lists.sourceforge.net (subscribers-only) 18131 + L: netdev@vger.kernel.org 18132 + S: Supported 18133 + T: git https://github.com/OpenVPN/linux-kernel-ovpn.git 18134 + F: drivers/net/ovpn/ 18135 + 18128 18136 OPENVSWITCH 18129 18137 M: Aaron Conole <aconole@redhat.com> 18130 18138 M: Eelco Chaudron <echaudro@redhat.com>
+8
drivers/net/Kconfig
··· 115 115 116 116 Say N here unless you know what you're doing. 117 117 118 + config OVPN 119 + tristate "OpenVPN data channel offload" 120 + depends on NET && INET 121 + depends on IPV6 || !IPV6 122 + help 123 + This module enhances the performance of the OpenVPN userspace software 124 + by offloading the data channel processing to kernelspace. 125 + 118 126 config EQUALIZER 119 127 tristate "EQL (serial line load balancing) support" 120 128 help
+1
drivers/net/Makefile
··· 11 11 obj-$(CONFIG_IPVTAP) += ipvlan/ 12 12 obj-$(CONFIG_DUMMY) += dummy.o 13 13 obj-$(CONFIG_WIREGUARD) += wireguard/ 14 + obj-$(CONFIG_OVPN) += ovpn/ 14 15 obj-$(CONFIG_EQUALIZER) += eql.o 15 16 obj-$(CONFIG_IFB) += ifb.o 16 17 obj-$(CONFIG_MACSEC) += macsec.o
+10
drivers/net/ovpn/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # 3 + # ovpn -- OpenVPN data channel offload in kernel space 4 + # 5 + # Copyright (C) 2020-2025 OpenVPN, Inc. 6 + # 7 + # Author: Antonio Quartulli <antonio@openvpn.net> 8 + 9 + obj-$(CONFIG_OVPN) := ovpn.o 10 + ovpn-y += main.o
+52
drivers/net/ovpn/main.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* OpenVPN data channel offload 3 + * 4 + * Copyright (C) 2020-2025 OpenVPN, Inc. 5 + * 6 + * Author: Antonio Quartulli <antonio@openvpn.net> 7 + * James Yonan <james@openvpn.net> 8 + */ 9 + 10 + #include <linux/module.h> 11 + #include <linux/netdevice.h> 12 + #include <net/rtnetlink.h> 13 + 14 + static int ovpn_newlink(struct net_device *dev, 15 + struct rtnl_newlink_params *params, 16 + struct netlink_ext_ack *extack) 17 + { 18 + return -EOPNOTSUPP; 19 + } 20 + 21 + static struct rtnl_link_ops ovpn_link_ops = { 22 + .kind = "ovpn", 23 + .netns_refund = false, 24 + .newlink = ovpn_newlink, 25 + .dellink = unregister_netdevice_queue, 26 + }; 27 + 28 + static int __init ovpn_init(void) 29 + { 30 + int err = rtnl_link_register(&ovpn_link_ops); 31 + 32 + if (err) { 33 + pr_err("ovpn: can't register rtnl link ops: %d\n", err); 34 + return err; 35 + } 36 + 37 + return 0; 38 + } 39 + 40 + static __exit void ovpn_cleanup(void) 41 + { 42 + rtnl_link_unregister(&ovpn_link_ops); 43 + 44 + rcu_barrier(); 45 + } 46 + 47 + module_init(ovpn_init); 48 + module_exit(ovpn_cleanup); 49 + 50 + MODULE_DESCRIPTION("OpenVPN data channel offload (ovpn)"); 51 + MODULE_AUTHOR("Antonio Quartulli <antonio@openvpn.net>"); 52 + MODULE_LICENSE("GPL");