Introducing OpenVPN Data Channel Offload
Subsystems (4)
Antonio Quartulli
maintainercover Introducing OpenVPN Data Channel Offload
Hi all!
After several months of work, I am finally
sending a new version of the OpenVPN Data Channel Offload kernel module (aka ovpn) for official review.
The OpenVPN community has since long been interested in moving the fast path to kernel space. ovpn finally helps achieving this goal.
ovpn is essentialy a device driver that allows creating a virtual network interface to handle the OpenVPN data channel. Any traffic entering the interface is encrypted, encapsulated and sent to the appropriate destination.
ovpn requires OpenVPN in userspace
to run along its side in order to be properly configured and maintained during its life cycle.
The ovpn interface can be created/destroyed and then configured via Netlink API.
Specifically OpenVPN in userspace will:
* create the ovpn interface
* establish the connection with one or more peers
* perform TLS handshake and negotiate any protocol parameter
* configure the ovpn interface with peer data (ip/port, keys, etc.)
* handle any subsequent control channel communication
I'd like to point out the control channel is fully handles in userspace. The idea is to keep the ovpn kernel module as simple as possible and let userspace handle all the non-data (non-fast-path) features.
NOTE: some of you may already know ovpn-dco the out-of-tree predecessor of ovpn. However, be aware that the two are not API compatible and therefore OpenVPN 2.6 will not work with this new ovpn module. More adjustments are required.
If you want to test the ovpn kernel module, for the time being you can use the testing tool ovpn-cli available here:
https://github.com/OpenVPN/ovpn-dco/tree/master/tests
The ovpn code can also be built as out-of-tree module and its code is available here https://github.com/OpenVPN/ovpn-dco (currently in the dev branch).
For more technical details please refer to the actual patch commit message.
Please note that the patch touches also a few files outside of the ovpn-dco folder.
Specifically it adds a new macro named NLA_POLICY_MAX_LEN to net/netlink.h and also adds a new constant named UDP_ENCAP_OVPNINUDP to linux/udp.h.
I tend to agree that a unique large patch is harder to review, but splitting the code into several paches proved to be quite cumbersome, therefore I prefered to not do it. I believe the code can still be reviewed file by file, despite in the same patch.
** KNOWN ISSUE:
Upon module unloading something is not torn down correctly and sometimes new packets hit dangling netdev pointers. This problem did not exist when the RTNL API was implemented (before interface handling was moved to Netlink). I was hoping to get some feedback from the netdev community on anything that may look wrong.
Any comment, concern or statement will be appreciated! Thanks a lot!!
Best Regards,
Antonio Quartulli
OpenVPN Inc.
---
Antonio Quartulli (1):
net: introduce OpenVPN Data Channel Offload (ovpn)
MAINTAINERS | 8 + drivers/net/Kconfig | 13 + drivers/net/Makefile | 1 + drivers/net/ovpn/Makefile | 21 + drivers/net/ovpn/addr.h | 41 ++ drivers/net/ovpn/bind.c | 62 ++ drivers/net/ovpn/bind.h | 69 ++ drivers/net/ovpn/crypto.c | 154 +++++ drivers/net/ovpn/crypto.h | 144 +++++ drivers/net/ovpn/crypto_aead.c | 367 +++++++++++ drivers/net/ovpn/crypto_aead.h | 27 + drivers/net/ovpn/io.c | 579 +++++++++++++++++ drivers/net/ovpn/io.h | 43 ++ drivers/net/ovpn/main.c | 307 +++++++++ drivers/net/ovpn/main.h | 39 ++ drivers/net/ovpn/netlink.c | 1072 ++++++++++++++++++++++++++++++++ drivers/net/ovpn/netlink.h | 23 + drivers/net/ovpn/ovpnstruct.h | 65 ++ drivers/net/ovpn/peer.c | 928 +++++++++++++++++++++++++++ drivers/net/ovpn/peer.h | 175 ++++++ drivers/net/ovpn/pktid.c | 127 ++++ drivers/net/ovpn/pktid.h | 116 ++++ drivers/net/ovpn/proto.h | 101 +++ drivers/net/ovpn/rcu.h | 20 + drivers/net/ovpn/skb.h | 51 ++ drivers/net/ovpn/sock.c | 144 +++++ drivers/net/ovpn/sock.h | 59 ++ drivers/net/ovpn/stats.c | 20 + drivers/net/ovpn/stats.h | 67 ++ drivers/net/ovpn/tcp.c | 473 ++++++++++++++ drivers/net/ovpn/tcp.h | 41 ++ drivers/net/ovpn/udp.c | 357 +++++++++++ drivers/net/ovpn/udp.h | 25 + include/uapi/linux/ovpn.h | 174 ++++++ include/uapi/linux/udp.h | 1 + 35 files changed, 5914 insertions(+) create mode 100644 drivers/net/ovpn/Makefile create mode 100644 drivers/net/ovpn/addr.h create mode 100644 drivers/net/ovpn/bind.c create mode 100644 drivers/net/ovpn/bind.h create mode 100644 drivers/net/ovpn/crypto.c create mode 100644 drivers/net/ovpn/crypto.h create mode 100644 drivers/net/ovpn/crypto_aead.c create mode 100644 drivers/net/ovpn/crypto_aead.h create mode 100644 drivers/net/ovpn/io.c create mode 100644 drivers/net/ovpn/io.h create mode 100644 drivers/net/ovpn/main.c create mode 100644 drivers/net/ovpn/main.h create mode 100644 drivers/net/ovpn/netlink.c create mode 100644 drivers/net/ovpn/netlink.h create mode 100644 drivers/net/ovpn/ovpnstruct.h create mode 100644 drivers/net/ovpn/peer.c create mode 100644 drivers/net/ovpn/peer.h create mode 100644 drivers/net/ovpn/pktid.c create mode 100644 drivers/net/ovpn/pktid.h create mode 100644 drivers/net/ovpn/proto.h create mode 100644 drivers/net/ovpn/rcu.h create mode 100644 drivers/net/ovpn/skb.h create mode 100644 drivers/net/ovpn/sock.c create mode 100644 drivers/net/ovpn/sock.h create mode 100644 drivers/net/ovpn/stats.c create mode 100644 drivers/net/ovpn/stats.h create mode 100644 drivers/net/ovpn/tcp.c create mode 100644 drivers/net/ovpn/tcp.h create mode 100644 drivers/net/ovpn/udp.c create mode 100644 drivers/net/ovpn/udp.h create mode 100644 include/uapi/linux/ovpn.h
Signature · 1 line
2.41.0
Antonio Quartulli
maintainerPATCH 1/1 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 ae 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.
--- MAINTAINERS | 8 + drivers/net/Kconfig | 13 + drivers/net/Makefile | 1 + drivers/net/ovpn/Makefile | 21 + drivers/net/ovpn/addr.h | 41 ++ drivers/net/ovpn/bind.c | 62 ++ drivers/net/ovpn/bind.h | 69 ++ drivers/net/ovpn/crypto.c | 154 +++++ drivers/net/ovpn/crypto.h | 144 +++++ drivers/net/ovpn/crypto_aead.c | 367 +++++++++++ drivers/net/ovpn/crypto_aead.h | 27 + drivers/net/ovpn/io.c | 579 +++++++++++++++++ drivers/net/ovpn/io.h | 43 ++ drivers/net/ovpn/main.c | 307 +++++++++ drivers/net/ovpn/main.h | 39 ++ drivers/net/ovpn/netlink.c | 1072 ++++++++++++++++++++++++++++++++ drivers/net/ovpn/netlink.h | 23 + drivers/net/ovpn/ovpnstruct.h | 65 ++ drivers/net/ovpn/peer.c | 928 +++++++++++++++++++++++++++ drivers/net/ovpn/peer.h | 175 ++++++ drivers/net/ovpn/pktid.c | 127 ++++ drivers/net/ovpn/pktid.h | 116 ++++ drivers/net/ovpn/proto.h | 101 +++ drivers/net/ovpn/rcu.h | 20 + drivers/net/ovpn/skb.h | 51 ++ drivers/net/ovpn/sock.c | 144 +++++ drivers/net/ovpn/sock.h | 59 ++ drivers/net/ovpn/stats.c | 20 + drivers/net/ovpn/stats.h | 67 ++ drivers/net/ovpn/tcp.c | 473 ++++++++++++++ drivers/net/ovpn/tcp.h | 41 ++ drivers/net/ovpn/udp.c | 357 +++++++++++ drivers/net/ovpn/udp.h | 25 + include/uapi/linux/ovpn.h | 174 ++++++ include/uapi/linux/udp.h | 1 + 35 files changed, 5914 insertions(+) create mode 100644 drivers/net/ovpn/Makefile create mode 100644 drivers/net/ovpn/addr.h create mode 100644 drivers/net/ovpn/bind.c create mode 100644 drivers/net/ovpn/bind.h create mode 100644 drivers/net/ovpn/crypto.c create mode 100644 drivers/net/ovpn/crypto.h create mode 100644 drivers/net/ovpn/crypto_aead.c create mode 100644 drivers/net/ovpn/crypto_aead.h create mode 100644 drivers/net/ovpn/io.c create mode 100644 drivers/net/ovpn/io.h create mode 100644 drivers/net/ovpn/main.c create mode 100644 drivers/net/ovpn/main.h create mode 100644 drivers/net/ovpn/netlink.c create mode 100644 drivers/net/ovpn/netlink.h create mode 100644 drivers/net/ovpn/ovpnstruct.h create mode 100644 drivers/net/ovpn/peer.c create mode 100644 drivers/net/ovpn/peer.h create mode 100644 drivers/net/ovpn/pktid.c create mode 100644 drivers/net/ovpn/pktid.h create mode 100644 drivers/net/ovpn/proto.h create mode 100644 drivers/net/ovpn/rcu.h create mode 100644 drivers/net/ovpn/skb.h create mode 100644 drivers/net/ovpn/sock.c create mode 100644 drivers/net/ovpn/sock.h create mode 100644 drivers/net/ovpn/stats.c create mode 100644 drivers/net/ovpn/stats.h create mode 100644 drivers/net/ovpn/tcp.c create mode 100644 drivers/net/ovpn/tcp.h create mode 100644 drivers/net/ovpn/udp.c create mode 100644 drivers/net/ovpn/udp.h create mode 100644 include/uapi/linux/ovpn.h
MAINTAINERS +8 -0
@@ -16295,6 +16295,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git F: Documentation/filesystems/overlayfs.rst F: fs/overlayfs/ +OPENVPN DATA CHANNEL OFFLOAD +M: Antonio Quartulli <[email protected]> +L: [email protected] (moderated for non-subscribers) +L: [email protected] +S: Maintained +F: drivers/net/ovpn/ +F: include/uapi/linux/ovpn.h + P54 WIRELESS DRIVER M: Christian Lamparter <[email protected]> L: [email protected]
drivers/net/Kconfig +13 -0
@@ -115,6 +115,19 @@ config WIREGUARD_DEBUG Say N here unless you know what you're doing. +config OVPN + tristate "OpenVPN data channel offload" + depends on NET && INET + select NET_UDP_TUNNEL + select DST_CACHE + select CRYPTO + select CRYPTO_AES + select CRYPTO_GCM + select CRYPTO_CHACHA20POLY1305 + help + This module enhances the performance of the OpenVPN userspace software + by offloading the data channel processing to kernelspace. + config EQUALIZER tristate "EQL (serial line load balancing) support" help
drivers/net/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_IPVLAN) += ipvlan/ obj-$(CONFIG_IPVTAP) += ipvlan/ obj-$(CONFIG_DUMMY) += dummy.o obj-$(CONFIG_WIREGUARD) += wireguard/ +obj-$(CONFIG_OVPN) += ovpn/ obj-$(CONFIG_EQUALIZER) += eql.o obj-$(CONFIG_IFB) += ifb.o obj-$(CONFIG_MACSEC) += macsec.o
drivers/net/ovpn/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# ovpn -- OpenVPN data channel offload in kernel space +# +# Copyright (C) 2020-2024 OpenVPN, Inc. +# +# Author: Antonio Quartulli <[email protected]> + +obj-$(CONFIG_OVPN) += ovpn.o +ovpn-y += main.o +ovpn-y += bind.o +ovpn-y += crypto.o +ovpn-y += io.o +ovpn-y += peer.o +ovpn-y += sock.o +ovpn-y += stats.o +ovpn-y += netlink.o +ovpn-y += crypto_aead.o +ovpn-y += pktid.o +ovpn-y += tcp.o +ovpn-y += udp.o
drivers/net/ovpn/addr.h new file +41 -0
41 lines not on this page · raw message
drivers/net/ovpn/bind.c new file +62 -0
62 lines not on this page · raw message
drivers/net/ovpn/bind.h new file +69 -0
69 lines not on this page · raw message
drivers/net/ovpn/crypto.c new file +154 -0
154 lines not on this page · raw message
drivers/net/ovpn/crypto.h new file +144 -0
144 lines not on this page · raw message
drivers/net/ovpn/crypto_aead.c new file +367 -0
367 lines not on this page · raw message
drivers/net/ovpn/crypto_aead.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* OpenVPN data channel offload +* +* Copyright (C) 2020-2024 OpenVPN, Inc. +* +* Author: James Yonan <[email protected]> +* Antonio Quartulli <[email protected]> +*/ + +#ifndef _NET_OVPN_OVPNAEAD_H_ +#define _NET_OVPN_OVPNAEAD_H_ + +#include "crypto.h" + +#include <asm/types.h> +#include <linux/skbuff.h> + +struct crypto_aead *ovpn_aead_init (const char *title,const char *alg_name, +const unsigned char *key,unsigned int keylen); + +int ovpn_aead_encrypt (struct ovpn_crypto_key_slot *ks,struct sk_buff *skb,u32 peer_id); +int ovpn_aead_decrypt (struct ovpn_crypto_key_slot *ks,struct sk_buff *skb); + +struct ovpn_crypto_key_slot *ovpn_aead_crypto_key_slot_new (const struct ovpn_key_config *kc); +void ovpn_aead_crypto_key_slot_destroy (struct ovpn_crypto_key_slot *ks); + +#endif /* _NET_OVPN_OVPNAEAD_H_ */
drivers/net/ovpn/io.c new file +579 -0
579 lines not on this page · raw message
drivers/net/ovpn/io.h new file +43 -0
43 lines not on this page · raw message
drivers/net/ovpn/main.c new file +307 -0
307 lines not on this page · raw message
drivers/net/ovpn/main.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* OpenVPN data channel offload +* +* Copyright (C) 2019-2024 OpenVPN, Inc. +* +* Author: James Yonan <[email protected]> +* Antonio Quartulli <[email protected]> +*/ + +#ifndef _NET_OVPN_MAIN_H_ +#define _NET_OVPN_MAIN_H_ + +#include <linux/ip.h> +#include <linux/ipv6.h> +#include <linux/printk.h> +#include <linux/udp.h> + +#ifndef OVPN_VERSION +#define OVPN_VERSION "2.0.0" +#endif + +struct net_device ; +struct ovpn_struct ; +enum ovpn_mode ; + +bool ovpn_dev_is_valid (const struct net_device *dev); +int ovpn_iface_create (const char *name,enum ovpn_mode mode,struct net *net); +void ovpn_iface_destruct (struct ovpn_struct *ovpn,bool unregister_device); + +#define SKB_HEADER_LEN \ + (max(sizeof(struct iphdr), sizeof(struct ipv6hdr)) + \ + sizeof(struct udphdr) + NET_SKB_PAD) + +#define OVPN_HEAD_ROOM ALIGN(16 + SKB_HEADER_LEN, 4) +#define OVPN_MAX_PADDING 16 +#define OVPN_QUEUE_LEN 1024 +#define OVPN_MAX_TUN_QUEUE_LEN 0x10000 + +#endif /* _NET_OVPN_MAIN_H_ */
drivers/net/ovpn/netlink.c new file +1072 -0
1,072 lines not on this page · raw message
drivers/net/ovpn/netlink.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* OpenVPN data channel offload +* +* Copyright (C) 2020-2024 OpenVPN, Inc. +* +* Author: Antonio Quartulli <[email protected]> +*/ + +#ifndef _NET_OVPN_NETLINK_H_ +#define _NET_OVPN_NETLINK_H_ + +struct ovpn_struct ; +struct ovpn_peer ; + +int ovpn_nl_init (struct ovpn_struct *ovpn); +int ovpn_nl_register (void ); +void ovpn_nl_unregister (void ); +int ovpn_nl_send_packet (struct ovpn_struct *ovpn,const struct ovpn_peer *peer, +const u8 *buf,size_t len); +int ovpn_nl_notify_del_peer (struct ovpn_peer *peer); +int ovpn_nl_notify_swap_keys (struct ovpn_peer *peer); + +#endif /* _NET_OVPN_NETLINK_H_ */
drivers/net/ovpn/ovpnstruct.h new file +65 -0
12 lines not on this page · raw message
drivers/net/ovpn/peer.c new file +928 -0
928 lines not on this page · raw message
drivers/net/ovpn/peer.h new file +175 -0
175 lines not on this page · raw message
drivers/net/ovpn/pktid.c new file +127 -0
127 lines not on this page · raw message
drivers/net/ovpn/pktid.h new file +116 -0
116 lines not on this page · raw message
drivers/net/ovpn/proto.h new file +101 -0
101 lines not on this page · raw message
drivers/net/ovpn/skb.h new file +51 -0
51 lines not on this page · raw message
drivers/net/ovpn/sock.c new file +144 -0
144 lines not on this page · raw message
drivers/net/ovpn/sock.h new file +59 -0
59 lines not on this page · raw message
drivers/net/ovpn/stats.h new file +67 -0
67 lines not on this page · raw message
drivers/net/ovpn/tcp.c new file +473 -0
473 lines not on this page · raw message
drivers/net/ovpn/tcp.h new file +41 -0
41 lines not on this page · raw message
drivers/net/ovpn/udp.c new file +357 -0
357 lines not on this page · raw message
include/uapi/linux/ovpn.h new file +174 -0
174 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.41.0
Part of the diff is not shown here. View the raw message.
kernel test robot
build botRe: [PATCH net-next 1/1] net: introduce OpenVPN Data Channel Offload (ovpn)
kernel test robot noticed the following build warnings:
Hi Antonio,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Antonio-Quartulli/net-introduce-OpenVPN-Data-Channel-Offload-ovpn/20240107-061631 base: net-next/main patch link: https://lore.kernel.org/r/20240106215740.14770-2-antonio%40openvpn.net patch subject: [PATCH net-next 1/1] net: introduce OpenVPN Data Channel Offload (ovpn) reproduce: (https://download.01.org/0day-ci/archive/20240107/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
versioncheck warnings: (new ones prefixed by >>)
INFO PATH=/opt/cross/clang/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/timeout -k 100 3h /usr/bin/make KCFLAGS= -Wtautological-compare -Wno-error=return-type -Wreturn-type -Wcast-function-type -funsigned-char -Wundef -Wformat-overflow -Wformat-truncation -Wstringop-overflow -Wrestrict -Wenum-conversion W=1 --keep-going HOSTCC=gcc-12 CC=gcc-12 -j32 KBUILD_MODPOST_WARN=1 ARCH=x86_64 versioncheck find ./* \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o \
-name '*.[hcS]' -type f -print | sort \
| xargs perl -w ./scripts/checkversion.pl
./drivers/accessibility/speakup/genmap.c: 13 linux/version.h not needed.
./drivers/accessibility/speakup/makemapdata.c: 13 linux/version.h not needed.
>> ./drivers/net/ovpn/main.c: 28 linux/version.h not needed.
./drivers/staging/media/atomisp/include/linux/atomisp.h: 23 linux/version.h not needed. ./samples/bpf/spintest.bpf.c: 8 linux/version.h not needed. ./samples/trace_events/trace_custom_sched.c: 11 linux/version.h not needed. ./sound/soc/codecs/cs42l42.c: 14 linux/version.h not needed. ./tools/lib/bpf/bpf_helpers.h: 406: need linux/version.h ./tools/testing/selftests/bpf/progs/dev_cgroup.c: 9 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/netcnt_prog.c: 3 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_map_lock.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_send_signal_kern.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_spin_lock.c: 4 linux/version.h not needed. ./tools/testing/selftests/bpf/progs/test_tcp_estats.c: 37 linux/version.h not needed. ./tools/testing/selftests/wireguard/qemu/init.c: 27 linux/version.h not needed.
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH net-next 1/1] net: introduce OpenVPN Data Channel Offload (ovpn)
In reply to Antonio Quartullikernel test robot noticed the following build errors:
Hi Antonio,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Antonio-Quartulli/net-introduce-OpenVPN-Data-Channel-Offload-ovpn/20240107-061631 base: net-next/main patch link: https://lore.kernel.org/r/20240106215740.14770-2-antonio%40openvpn.net patch subject: [PATCH net-next 1/1] net: introduce OpenVPN Data Channel Offload (ovpn) config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240107/[email protected]/config) compiler: sh4-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240107/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
>> drivers/net/ovpn/netlink.c:42:38: error: implicit declaration of function 'NLA_POLICY_MAX_LEN'; did you mean 'NLA_POLICY_MIN_LEN'? [-Werror=implicit-function-declaration]
42 | [OVPN_A_KEYDIR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
| ^~~~~~~~~~~~~~~~~~
| NLA_POLICY_MIN_LEN
>> drivers/net/ovpn/netlink.c:42:38: error: initializer element is not constant
drivers/net/ovpn/netlink.c:42:38: note: (near initialization for 'ovpn_nl_policy_keydir[1].type')
>> drivers/net/ovpn/netlink.c:41:75: warning: missing braces around initializer [-Wmissing-braces]
41 | static const struct nla_policy ovpn_nl_policy_keydir[NUM_OVPN_A_KEYDIR] = {
| ^
drivers/net/ovpn/netlink.c:63:34: error: initializer element is not constant
63 | [OVPN_A_PEER_LOCAL_IP] = NLA_POLICY_MAX_LEN(sizeof(struct in6_addr)),
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn/netlink.c:63:34: note: (near initialization for 'ovpn_nl_policy_peer[8].type')
drivers/net/ovpn/netlink.c:64:36: error: initializer element is not constant
64 | [OVPN_A_PEER_LOCAL_PORT] = NLA_POLICY_MAX_LEN(sizeof(u16)),
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn/netlink.c:64:36: note: (near initialization for 'ovpn_nl_policy_peer[9].type')
drivers/net/ovpn/netlink.c:57:71: warning: missing braces around initializer [-Wmissing-braces]
57 | static const struct nla_policy ovpn_nl_policy_peer[NUM_OVPN_A_PEER] = {
| ^
drivers/net/ovpn/netlink.c:57:71: warning: missing braces around initializer [-Wmissing-braces]
drivers/net/ovpn/netlink.c:57:71: warning: missing braces around initializer [-Wmissing-braces]
drivers/net/ovpn/netlink.c:57:71: warning: missing braces around initializer [-Wmissing-braces]
drivers/net/ovpn/netlink.c:57:71: warning: missing braces around initializer [-Wmissing-braces]
drivers/net/ovpn/netlink.c:75:27: error: initializer element is not constant
75 | [OVPN_A_IFNAME] = NLA_POLICY_MAX_LEN(IFNAMSIZ),
| ^~~~~~~~~~~~~~~~~~
drivers/net/ovpn/netlink.c:75:27: note: (near initialization for 'ovpn_nl_policy[2].type')
drivers/net/ovpn/netlink.c:73:61: warning: missing braces around initializer [-Wmissing-braces]
73 | static const struct nla_policy ovpn_nl_policy[NUM_OVPN_A] = {
| ^ drivers/net/ovpn/netlink.c:73:61: warning: missing braces around initializer [-Wmissing-braces] drivers/net/ovpn/netlink.c:73:61: warning: missing braces around initializer [-Wmissing-braces]
cc1: some warnings being treated as errors
vim +42 drivers/net/ovpn/netlink.c
39
40 /** KEYDIR policy. Can be used for configuring an encryption and a decryption key */
> 41 static const struct nla_policy ovpn_nl_policy_keydir[NUM_OVPN_A_KEYDIR] = {
> 42 [OVPN_A_KEYDIR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
43 [OVPN_A_KEYDIR_NONCE_TAIL] = NLA_POLICY_EXACT_LEN(NONCE_TAIL_SIZE),
44 };
45 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH net-next 1/1] net: introduce OpenVPN Data Channel Offload (ovpn)
In reply to Antonio Quartullikernel test robot noticed the following build errors:
Hi Antonio,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Antonio-Quartulli/net-introduce-OpenVPN-Data-Channel-Offload-ovpn/20240107-061631 base: net-next/main patch link: https://lore.kernel.org/r/20240106215740.14770-2-antonio%40openvpn.net patch subject: [PATCH net-next 1/1] net: introduce OpenVPN Data Channel Offload (ovpn) config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20240107/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240107/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
>> drivers/net/ovpn/netlink.c:42:31: error: call to undeclared function 'NLA_POLICY_MAX_LEN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
42 | [OVPN_A_KEYDIR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
| ^
>> drivers/net/ovpn/netlink.c:42:31: warning: suggest braces around initialization of subobject [-Wmissing-braces]
42 | [OVPN_A_KEYDIR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| { }
>> drivers/net/ovpn/netlink.c:42:31: error: initializer element is not a compile-time constant
42 | [OVPN_A_KEYDIR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ovpn/netlink.c:63:27: warning: suggest braces around initialization of subobject [-Wmissing-braces]
63 | [OVPN_A_PEER_LOCAL_IP] = NLA_POLICY_MAX_LEN(sizeof(struct in6_addr)),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| { }
drivers/net/ovpn/netlink.c:64:29: warning: suggest braces around initialization of subobject [-Wmissing-braces]
64 | [OVPN_A_PEER_LOCAL_PORT] = NLA_POLICY_MAX_LEN(sizeof(u16)),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| { }
drivers/net/ovpn/netlink.c:63:27: error: initializer element is not a compile-time constant
63 | [OVPN_A_PEER_LOCAL_IP] = NLA_POLICY_MAX_LEN(sizeof(struct in6_addr)),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ovpn/netlink.c:75:20: warning: suggest braces around initialization of subobject [-Wmissing-braces]
75 | [OVPN_A_IFNAME] = NLA_POLICY_MAX_LEN(IFNAMSIZ),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| { } drivers/net/ovpn/netlink.c:75:20: error: initializer element is not a compile-time constant
75 | [OVPN_A_IFNAME] = NLA_POLICY_MAX_LEN(IFNAMSIZ),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings and 4 errors generated.
--
>> drivers/net/ovpn/peer.c:366: warning: Function parameter or member 'src' not described in 'ovpn_nexthop_lookup4' >> drivers/net/ovpn/peer.c:366: warning: expecting prototype for ovpn_rpf4(). Prototype was for ovpn_nexthop_lookup4() instead >> drivers/net/ovpn/peer.c:412: warning: Function parameter or member 'addr' not described in 'ovpn_nexthop_lookup6' >> drivers/net/ovpn/peer.c:412: warning: expecting prototype for ovpn_rpf6(). Prototype was for ovpn_nexthop_lookup6() instead
vim +/NLA_POLICY_MAX_LEN +42 drivers/net/ovpn/netlink.c
39
40 /** KEYDIR policy. Can be used for configuring an encryption and a decryption key */
41 static const struct nla_policy ovpn_nl_policy_keydir[NUM_OVPN_A_KEYDIR] = {
> 42 [OVPN_A_KEYDIR_CIPHER_KEY] = NLA_POLICY_MAX_LEN(U8_MAX),
43 [OVPN_A_KEYDIR_NONCE_TAIL] = NLA_POLICY_EXACT_LEN(NONCE_TAIL_SIZE),
44 };
45 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Antonio,
Quoted 4 lines · Antonio Quartulli
I tend to agree that a unique large patch is harder to review, but splitting the code into several paches proved to be quite cumbersome, therefore I prefered to not do it. I believe the code can still be reviewed file by file, despite in the same patch.
I am happy to know that project is ongoing. But I had stopped the review after reading these lines. You need AI to review at once "35 files changed, 5914 insertions(+)". Last time I checked, I was human. Sorry.
Or you can see it like this: if submitter does not care, then why anyone else should?
Quoted 6 lines
** KNOWN ISSUE:
Upon module unloading something is not torn down correctly and sometimes new packets hit dangling netdev pointers. This problem did not exist when the RTNL API was implemented (before interface handling was moved to Netlink). I was hoping to get some feedback from the netdev community on anything that may look wrong.
A small hint, if the series is not going to be merged, then it is better to mark it as RFC.
--
Sergey
Antonio Quartulli
maintainerHi Sergey,
Thanks for jumping in
Quoted 11 lines · Sergey Ryazanov
Hi Antonio,
Quoted 4 lines · Antonio Quartulli
I tend to agree that a unique large patch is harder to review, but splitting the code into several paches proved to be quite cumbersome, therefore I prefered to not do it. I believe the code can still be reviewed file by file, despite in the same patch.
I am happy to know that project is ongoing. But I had stopped the review after reading these lines. You need AI to review at once "35 files changed, 5914 insertions(+)". Last time I checked, I was human. Sorry.
Or you can see it like this: if submitter does not care, then why anyone else should?
I am sorry - I did not mean to be careless/sloppy.
I totally understand, but I truly burnt so much time on finding a reasonable way to split this patch that I had to give up at some point.
I get your input, but do you think that turning it into 35 patches of 1 file each (just as a random example), will make it easier to digest?
Anyway, I will give it another try (the test robot complained about something, so it seems I need to resend the patch anyway) and I'll see where I land.
Cheers!
Quoted 12 lines
Quoted 7 lines
** KNOWN ISSUE:
Upon module unloading something is not torn down correctly and sometimes new packets hit dangling netdev pointers. This problem did not exist when the RTNL API was implemented (before interface handling was moved to Netlink). I was hoping to get some feedback from the netdev community on anything that may look wrong.A small hint, if the series is not going to be merged, then it is better to mark it as RFC.
Signature · 1 line
Sergey
Signature · 2 lines
Antonio Quartulli OpenVPN Inc.
Hi Antonio,
Quoted 13 lines · Antonio Quartulli
Hi Sergey,
Thanks for jumping in
Quoted 8 lines · Sergey Ryazanov
Hi Antonio,
Quoted 4 lines · Antonio Quartulli
I tend to agree that a unique large patch is harder to review, but splitting the code into several paches proved to be quite cumbersome, therefore I prefered to not do it. I believe the code can still be reviewed file by file, despite in the same patch.
Quoted 5 lines
Quoted 3 lines
I am happy to know that project is ongoing. But I had stopped the review after reading these lines. You need AI to review at once "35 files changed, 5914 insertions(+)". Last time I checked, I was human. Sorry.
Or you can see it like this: if submitter does not care, then why anyone else should?
I am sorry - I did not mean to be careless/sloppy.
Sure. I would not say this, I just gave you a hint how it can be look like. Looks like you did a great job implementing it, lets do a final good review before merging it.
Quoted 1 line
I totally understand, but I truly burnt so much time on finding a reasonable way to split this patch that I had to give up at some point.
Yep, but if submitter did not properly split it, then a reviewer have to do this. Right?
Quoted 1 line
I get your input, but do you think that turning it into 35 patches of 1 file each (just as a random example), will make it easier to digest?
It is a pleasure to review a good arranged series that in step-by-step manner explains how a functional should be implemented and will work.
Splitting some huge driver into item files is neither a good approach. As you already mentioned, it gives almost nothing in terms of the review simplification. E.g. some file can contain a set of library functions, so checking them without calling examples is nonsense, etc.
Thus, I would suggest to choose a regular approach and turn the code into implementation steps. Just imagine a set of steps you would take to implement the functionality if you were do it from scratch. You can also think of it as a presentation.
Just an example of how I would break such work into separate patches:
1. changes to common kernel components: one patch per changed subsystem (e.g. netlink, socket helpers, whatever);
2. skeleton of the future module: initialization, deinitialization, registration in the necessary subsystems (genetlink), most of the required callbacks are just stubs;
3. basic tunnel management implementation: tunnel creation and destroying, network interface creation, etc, again minimalistic, no actual packet processing, just drop packets at this stage;
4. tx path implementation: bare minimal data processing;
5. rx path implementation: again bare minimal;
6. various service functions: keepalive, rekeying, peer source address updating, etc. better in one-patch-per-feature manner.
This was just a clue. You, as the author, for sure know better how to present this in the most understandable way.
Just a couple of general tips. Common changes to other parts of the kernel (e.g. mentioned NLA_POLICY_MAX_LEN) should come as a dedicated patch with justification for how it makes life easier. Exception here is identifiers that the code is going to use (e.g. UDP_ENCAP_OVPNINUDP), it is better to add them together with the implementation. Each item patch must not break the kernel build. If you use any macro or call any routine, they should be added in the same patch or before. Build bot will be strongly against patches that break something. As you have already seen, it is even intolerant of new compilation warnings :)
Quoted 3 lines
Anyway, I will give it another try (the test robot complained about something, so it seems I need to resend the patch anyway) and I'll see where I land.
Cheers!
Cheers!
--
Sergey