Skip to content

openvpn: update to 2.7, support the new ovpn data channel offload module#27421

Open
LGA1150 wants to merge 2 commits intoopenwrt:masterfrom
LGA1150:ovpn-2.7
Open

openvpn: update to 2.7, support the new ovpn data channel offload module#27421
LGA1150 wants to merge 2 commits intoopenwrt:masterfrom
LGA1150:ovpn-2.7

Conversation

@LGA1150
Copy link
Contributor

@LGA1150 LGA1150 commented Sep 10, 2025

📦 Package Details

Maintainer: @zhaojh329 @AuthorReflex @sch-m

Description:
Update OpenVPN to 2.7, and use the new DCO module source.


🧪 Run Testing Details

  • OpenWrt Version: r31013-19e9772935
  • OpenWrt Target/Subtarget: mediatek/mt7622
  • OpenWrt Device: Xiaomi Redmi Router AX6S

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

If your PR contains a patch:

  • It can be applied using git am
  • It has been refreshed to avoid offsets, fuzzes, etc., using
    make package/<your-package>/refresh V=s
  • It is structured in a way that it is potentially upstreamable
    (e.g., subject line, commit description, etc.)
    We must try to upstream patches to reduce maintenance burden.

@LGA1150
Copy link
Contributor Author

LGA1150 commented Sep 10, 2025

Marked as draft because it's still beta.

@ordex @ralflici

@LGA1150
Copy link
Contributor Author

LGA1150 commented Sep 26, 2025

CI always fails at (3/6) Installing liblz4-1 on mips_24kc. No idea what may cause it.

@wehagy
Copy link
Member

wehagy commented Sep 27, 2025

Normally, CI errors Bus error (core dumped) can be ignored.

@systemcrash
Copy link
Contributor

Just curious: can those who use openvpn tell me why when WireGuard exists (clients for every platform, formally verified crypto)? Momentum? Any reason not to upgrade openvpn to v3? v3 seems a bit more complex and cumbersome.

@LGA1150
Copy link
Contributor Author

LGA1150 commented Oct 20, 2025

why when WireGuard exists (clients for every platform, formally verified crypto)? Momentum?

I personally cannot answer this. You may instead ask @zx2c4.

Any reason not to upgrade openvpn to v3? v3 seems a bit more complex and cumbersome.

v3 is also client-only.

@ordex
Copy link

ordex commented Oct 20, 2025

Just curious: can those who use openvpn tell me why when WireGuard exists (clients for every platform, formally verified crypto)?

Well they are two different things.
There are people using OpenVPN that want to continue using it. So why not giving it some acceleration ;)

Momentum? Any reason not to upgrade openvpn to v3? v3 seems a bit more complex and cumbersome.

V3 is not an upgrade. It's a parallel project started more than 10 years ago that rewrote the OpenVPN core from scratch in C++.

There is a Linux client based on it, but it's mainly intended for desktops only as it leverages on modern IPC and things you hardly find on embedded devices.

This said, OpenVPN2 is still the most developed codebases from a community standpoint.

@Neustradamus

This comment was marked as spam.

@sanderpqr
Copy link

I have noticed that with OpenVPN 2.6 and kmod-ovpn-dco-v2, some targets need their hardware crypto accelerators disabled (e.g., unload/remove kmod-crypto-hw-safexcel on filogic) for DCO to work. I haven't tested yet with this PR, but is this something others recognize either with or without this PR?

@LGA1150
Copy link
Contributor Author

LGA1150 commented Nov 5, 2025

@sanderpqr Related issue: OpenVPN/ovpn-net-next#14

@ordex
Copy link

ordex commented Nov 5, 2025

@sanderpqr as pointed out by @LGA1150 , the problem is still there. That's because DCO simply uses the kernel crypto API (both the old ovpn-dco-v2 and the new ovpn). So from the low level crypto engine perspective there is not much difference.

@sanderpqr
Copy link

Thanks @LGA1150 and @ordex . The behavior I'm seeing (all on filogic) is:

  • OpenVPN 2.6, kmod-ovpn-dco-v2 NOT loaded, kmod-crypto-hw-safexcel IS loaded: traffic passes.
  • OpenVPN 2.6, kmod-ovpn-dco-v2 IS loaded, kmod-crypto-hw-safexcel IS loaded: traffic does not pass.
  • OpenVPN 2.6, kmod-ovpn-dco-v2 IS loaded, kmod-crypto-hw-safexcel NOT loaded: traffic passes.

So without the DCO kmod, OpenVPN is happy to use the SafeXcel accelerator (or ignore it). It's only when the DCO kmod is loaded that OpenVPN seems to have issues with the accelerator?

@ordex
Copy link

ordex commented Nov 5, 2025

So without the DCO kmod, OpenVPN is happy to use the SafeXcel accelerator (or ignore it). It's only when the DCO kmod is loaded that OpenVPN seems to have issues with the accelerator?

without DCO, OpenVPN uses the system SSL library for all crypto operations. Therefore I simply presume that the library does not rely on safexcel.

On the contrary, when using DCO, the crypto operations are handled by the kernel, which safexcel interacts with.
Is safexcel used by any other application? It may well be that the module is simply broken on that platform.

@sanderpqr
Copy link

when using DCO, the crypto operations are handled by the kernel, which safexcel interacts with

Ah yes, this makes sense.

Is safexcel used by any other application? It may well be that the module is simply broken on that platform.

I'm not aware of how to determine or test this. All I can say is that kmod-crypto-hw-safexcel is included for all mt7623, filogic and some mvebu targets. The filogic target is very popular, but the only issues I can find regarding the accelerator on GitHub and the forum relate to DCO...

On mt7621 and airoha there is the related EIP93 accelerator, I will do some tests this weekend with DCO on an mt7621-device to determine if similar issues exist with that combination.

@LGA1150
Copy link
Contributor Author

LGA1150 commented Nov 6, 2025

I'm not aware of how to determine or test this.

@sanderpqr You can test IPSec using the AES-GCM cipher.

@its0ka
Copy link

its0ka commented Nov 11, 2025

@LGA1150 i tried setting it for the first time with strongswan, had to install mising dependencies like 4 times and im probably still missing something because i don't think my tunnel uses kernel encryption (iperf3 reports 10mbit/s and htop reports 100% on "charon"), installing/removing safexcel package doesn't change anything

config files: https://pastebin.com/raw/pF2gM177

@LGA1150
Copy link
Contributor Author

LGA1150 commented Nov 11, 2025

@its0ka
Do you have strongswan-mod-kernel-libipsec installed? This package makes crypto work entirely in userland.

@its0ka
Copy link

its0ka commented Nov 11, 2025

@LGA1150 yeah, thanks, removing the "strongswan-mod-kernel-libipsec" package enabled kernel encryption. The ipsec tunnel still works with and without the safexcel package, but performance with safexcel is worse than without it, i started iperf3 -R and:
with safexcel package: 85% of cpu usage
without safexcel pkg: 65% of cpu usage
both report ~930mbit/s

i tested openvpn (verb 10) at the same time and it stopped working with safexcel, but logread was exactly the same

@LGA1150
Copy link
Contributor Author

LGA1150 commented Nov 11, 2025

@its0ka Thanks for your tests. Also as I stated in the related issue, the driver passed all self-tests, so it's unlikely that the driver is broken.

@sanderpqr
Copy link

I can echo @its0ka's results with IPSec. SafeXcel works, but doesn't really help performance (this is in line with comments on the forum).

More worryingly, the combination of kmod-ovpn-dco-v2 and kmod-crypto-hw-safexcel stops all OpenVPN traffic, even when not using a DCO-tunnel. So this patch will break OpenVPN for at least all platforms with kmod-crypto-hw-safexcel as default package.

I've also tested the related EIP93 accelerator on mt7621/airoha, no issues with DCO there.

@LGA1150
Copy link
Contributor Author

LGA1150 commented Nov 12, 2025

@sanderpqr

I've also tested the related EIP93 accelerator on mt7621/airoha, no issues with DCO there.

How well do DCO and IPSec perform with EIP93?
Do note that EIP93 supports AES-CTR mode, but not AES-GCM, so Linux can only partially accelerate AES-GCM using hardware AES-CTR mode and software GHASH.

@sanderpqr
Copy link

@LGA1150 I've only tested DCO on mt7612, not IPSec. OpenVPN without DCO does around 25Mbps on that platform, with DCO around 40Mbps.

@sanderpqr
Copy link

2.7 has been released, see:

https://community.openvpn.net/Downloads
https://github.com/OpenVPN/openvpn/releases/tag/v2.7.0

@LGA1150 LGA1150 marked this pull request as ready for review February 12, 2026 02:34
@AuthorReflex
Copy link
Contributor

AuthorReflex commented Feb 14, 2026

Run tested at:
Xiaomi Redmi ax6s (6.12 with new dco module)
Xiaomi Mi router 3 (6.18)
Everything works ok.
LGTM

The ovpn kernel module is is part of the Linux kernel starting from
version 6.16.
Switch to the new officially maintained backports source:
https://github.com/OpenVPN/ovpn-backports

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
The new DCO module depends on OpenVPN 2.7.
For details refer to https://github.com/OpenVPN/openvpn/blob/v2.7.0/Changes.rst

Removed upstreamed wolfSSL patches:
- 101-Fix-EVP_PKEY_CTX_-compilation-with-wolfSSL.patch
- 102-Disable-external-ec-key-support-when-building-with-wolfSSL.patch

Reworked 100-mbedtls-disable-runtime-version-check.patch to use
MBEDTLS_VERSION_STRING instead of a mutable buffer.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants