[0/3] OpenVPN: Fix N2N connections shown as DISCONNECTED while up

Message ID 20261027222110.2642078-1-antonio@mandelbit.com
Headers
Series OpenVPN: Fix N2N connections shown as DISCONNECTED while up |

Message

Antonio Quartulli 27 Oct 2026, 10:21 p.m. UTC
Hi all!

This is my first contribution to IPFire, so bear with me if I am doing
things the wrong way :)

This is what this small series addresses:

In P2P mode OpenVPN leaves its management state at AUTH/WAIT when a new
session attempt never completes (e.g. a stray packet from the internet),
although the tunnel keeps working. The WUI then shows the N2N connection
as DISCONNECTED (bug #13897).

A fix for OpenVPN has already been published for review [1], but it is
not integrated yet. These patches fix IPFire while OpenVPN still
misbehaves.

A test harness is included to verify the fix and possibly perform
regression testing in the future.

Notes:
- index.cgi and ovpnmain.cgi now require the new
  /var/ipfire/ovpn-functions.pl, so it needs to be shipped with the next
  Core Update. I left the filelists to you.
- wio.cgi (WIO addon) still uses the old check and has the same problem;
  I can send a follow-up if wanted.

[1] https://gerrit.openvpn.net/c/openvpn/+/2040

Antonio Quartulli (3):
  ovpn-functions.pl: Add a helper to get the status of N2N connections
  ovpnmain.cgi/index.cgi: Use OpenVPN::n2n_status()
  tests: Add tests for OpenVPN::n2n_status()

 config/cfgroot/ovpn-functions.pl              | 96 +++++++++++++++++++
 config/rootfiles/common/configroot            |  1 +
 html/cgi-bin/index.cgi                        | 12 +--
 html/cgi-bin/ovpnmain.cgi                     | 58 +----------
 lfs/configroot                                |  1 +
 .../ovpn-functions.pl/data/auth_pending       |  6 ++
 .../cfgroot/ovpn-functions.pl/data/connected  |  7 ++
 .../data/connected_stray_session              |  8 ++
 .../cfgroot/ovpn-functions.pl/data/empty      |  1 +
 .../cfgroot/ovpn-functions.pl/data/exiting    |  7 ++
 .../ovpn-functions.pl/data/never_connected    |  6 ++
 .../ovpn-functions.pl/data/notifications      | 11 +++
 .../ovpn-functions.pl/data/reconnected        | 11 +++
 .../ovpn-functions.pl/data/reconnecting       |  9 ++
 .../cfgroot/ovpn-functions.pl/data/truncated  |  3 +
 .../cfgroot/ovpn-functions.pl/n2n_status.pl   | 73 ++++++++++++++
 .../config/cfgroot/ovpn-functions.pl/test.sh  | 70 ++++++++++++++
 17 files changed, 315 insertions(+), 65 deletions(-)
 create mode 100644 config/cfgroot/ovpn-functions.pl
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/auth_pending
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/connected
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/connected_stray_session
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/empty
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/exiting
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/never_connected
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/notifications
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/reconnected
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/reconnecting
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/data/truncated
 create mode 100644 tests/config/cfgroot/ovpn-functions.pl/n2n_status.pl
 create mode 100755 tests/config/cfgroot/ovpn-functions.pl/test.sh