Bug 13897

Summary: OpenVPN net-to-net connection showing as DISCONNECTED in IPFire web interface (but is connected)
Product: IPFire Reporter: Neil Chittenden <neilchittenden>
Component: ---Assignee: Assigned to nobody - feel free to grab it and work on it <nobody>
Status: MODIFIED --- QA Contact:
Severity: Minor Usability    
Priority: - Unknown - CC: adolf.belka, antonio
Version: 2   
Hardware: unspecified   
OS: Unspecified   

Description Neil Chittenden 2025-09-29 08:30:59 UTC
After the update to IPFire 2.29 - Core Update 197, which re-organised the OpenVPN web interface a bit, I've noticed our net-to-net connection is showing as DISCONNECTED in the table. It is in fact connected since ping is working to the remote site so this appears to be some bug in the web interface. Other host-to-net connections are showing up CONNECTED, as expected.

Note that for the remote side (also IPFire 2.29 - Core Update 197), the net-to-net connection is indeed showing as CONNECTED. I'm unclear whether this issue has appeared with the latest update or might have been there previously.
Comment 1 Adolf Belka 2025-09-29 21:00:05 UTC
My n2n connection is showing a green Connected at both ends with CU197.

After connecting and waiting for a while did you refresh the WUI page on the browser. From the code if I remember correctly the polling on the status is done around every 30 seconds so after making a connection I wait for at least 30 seconds and then do a page refresh with the browser. I basically select the OpenVPN page on the IPFire menu again and that refreshes that page and usually that then shows up as Connected.

When I shut down the OpenVPN connection on my6 Android Phone I find that the phone leaves the connection in place for quite a while and so it stays with Connected for maybe 1 or 1.5 minutes before the status goes back to Disconnected.
Comment 2 Neil Chittenden 2025-09-30 07:57:26 UTC
The connection has certainly been up for a while (several days now I'd imagine, accessing the other network works fine) and it is still showing DISCONNECTED in the web UI. I've confirmed going to the OpenVPN page and then refreshing after 30-60s does not change how it appears. The obvious thing to try next would be restarting the service in the web UI (turning off/on) to see if that changes it in case it's just a temporary glitch. I'll try to do so at a time when least disruptive.
Comment 3 Adolf Belka 2025-09-30 16:48:25 UTC
(In reply to Neil Chittenden from comment #2)
> The connection has certainly been up for a while (several days now I'd
> imagine, accessing the other network works fine) and it is still showing
> DISCONNECTED in the web UI. I've confirmed going to the OpenVPN page and
> then refreshing after 30-60s does not change how it appears. The obvious
> thing to try next would be restarting the service in the web UI (turning
> off/on) to see if that changes it in case it's just a temporary glitch. I'll
> try to do so at a time when least disruptive.

Okay in that sort of timescale it should definitely have updated. So it is not related to browser refreshing.

Before you restart the service, can you paste the contents of /var/run/openvpn-rw.log from when ping shows the connection is working but it still syas disconnected after a couploe of minutes.

This file is what is used by the code to determine the status. The contents are also used for the Client Connection Status. What is shown on that Client Connection Status page when you press the button.

Please modify any sensitive items like a public IP. Any private addresses are no problem.
Comment 4 Neil Chittenden 2025-10-01 08:03:58 UTC
Log from before restarting the service below. The n2n connection is not listed even though it is up, only user connections are present (public IPs replaced by PUBLIC_IP_USERN).

/var/run/openvpn-rw.log:

OpenVPN CLIENT LIST
Updated,2025-10-01 08:50:28
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
User 1,PUBLIC_IP_USER1:52922,3172824,17014284,2025-10-01 08:09:16
User 2,PUBLIC_IP_USER2:55105,980453,2338975,2025-10-01 08:42:02
User 3,PUBLIC_IP_USER3:52109,139412977,771831832,2025-09-29 10:36:43
User 4,PUBLIC_IP_USER4:55745,478506350,11262436,2025-10-01 08:33:15
User 5,PUBLIC_IP_USER5:51971,36686766,840083039,2025-10-01 08:06:17
User 6,PUBLIC_IP_USER6:58908,904059,2004830,2025-10-01 08:42:28
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
10.X.X.176,User 4,PUBLIC_IP_USER4:55745,2025-10-01 08:50:27
10.X.X.148,User 6,PUBLIC_IP_USER6:58908,2025-10-01 08:50:27
10.X.X.104,User 3,PUBLIC_IP_USER3:52109,2025-10-01 08:50:27
10.X.X.120,User 1,PUBLIC_IP_USER1:52922,2025-10-01 08:50:27
10.X.X.100,User 2,PUBLIC_IP_USER2:55105,2025-10-01 08:50:14
10.X.X.108,User 5,PUBLIC_IP_USER5:51971,2025-10-01 08:50:19
GLOBAL STATS
Max bcast/mcast queue length,0
END
Comment 5 Adolf Belka 2025-10-01 08:59:27 UTC
That is great. So it shows that the logging for the Road Warriors status information is working fine.

If you check it periodically you will find that the Updated line will have had its time change.

The contents of this are shown on the WUI page after pressing the button named OpenVPN Connection Statistics.

Do all of your clients have this problem or only one or some.

If one or some can you tell me which of the PUBLIC_IP_USERx entries are the ones not showing connected when you can access them.

I will try and find some time to go back and look at the code for the CONNECTED/DISCONNECTED status to just confirm where it gets the info from.
Comment 6 Neil Chittenden 2025-10-01 10:02:54 UTC
All of these user clients are host-to-net connections and those in the log show correctly as CONNECTED in the web UI, but our net-to-net connection does not show in this log file and (therefore?) appears as DISCONNECTED in the web UI, even though it is there and I can ping over the connection. So none of the PUBLIC_IP_USERx entries are associated with the net-to-net connection which is not showing the right status. Hope that's clear, let me know if you need more info.
Comment 7 Adolf Belka 2025-10-01 10:14:20 UTC
(In reply to Neil Chittenden from comment #6)
> All of these user clients are host-to-net connections and those in the log
> show correctly as CONNECTED in the web UI, but our net-to-net connection
> does not show in this log file and (therefore?) appears as DISCONNECTED in
> the web UI, even though it is there and I can ping over the connection. So
> none of the PUBLIC_IP_USERx entries are associated with the net-to-net
> connection which is not showing the right status. Hope that's clear, let me
> know if you need more info.

Sorry @Neil. I should have read the title of the bug closer. It clearly says net-to-net.

Duuh - my apologies.
The log file I highlighted is only for the road warrior connections.

The net2net connections status info is shown in separate files for each net2net connection in the directory /var/run/openvpn/
If you show the contents of the net2net file in that directory.
If you have several net2net connections each of them will have a file in that directory.

I can also say that for my net2net connection it is showing as a green CONNECTED so it should work. We just need to figure out what is not going correctly in your situation.
Comment 8 Adolf Belka 2025-10-01 10:21:53 UTC
Just to clarify, all the changes in CU197 for OpenVPN were all related to the Road Warrior connections. We aimed to not impact the Net-to-Net at all.

As my Net-to-Net connection worked in the testing phase I didnt look any further at n2n.

I will also try and find some time to go and look at the code for the status monitoring and see if there are any differences between rw and n2n in case we missed something.
Comment 9 Neil Chittenden 2025-10-01 10:47:06 UTC
The n2n file is listed in /var/run/openvpn/ and includes recent stats indicating it is up (but showing as DISCONNECTED in the web UI). Details below (connection name replaced with XXXXXX).

[root@ipfire2 ~]# cat /var/run/openvpn/XXXXXX-n2n
OpenVPN STATISTICS
Updated,2025-10-01 11:41:37
TUN/TAP read bytes,3707008343
TUN/TAP write bytes,1799595211
TCP/UDP read bytes,1932185717
TCP/UDP write bytes,3874728030
Auth read bytes,1799595367
END
Comment 10 Antonio Quartulli 2026-10-26 22:04:45 UTC
I found this bug quite interesting and after digging some more, it turns out that OpenVPN in p2p more can report a bogus connection state if no tls-auth/crypt is used and a random probe lands on the connection port.

This probe would trigger the beginning of a renegotiation without ever terminating it and thus leaving the state stuck as AUTH (which prevents IPFire from detecting the session as connected).

I just created an upstream patch for this issue: https://gerrit.openvpn.net/c/openvpn/+/2040

I was thinking about proposing a fix on the IPFire side too, to avoid waiting for the OpenVPN patch to land.

Will try to put something together soon.
Comment 11 Antonio Quartulli 2026-10-27 22:22:06 UTC
patches are on the list:
https://lists.ipfire.org/development/20261027222110.2642078-1-antonio@mandelbit.com/T/#t
Comment 12 Michael Tremer 2026-11-23 12:47:33 UTC
https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=dd1f268a16b0245490d5d7f753c72ba40d5f6b51

Author: Antonio Quartulli <antonio@mandelbit.com>

ovpnmain.cgi/index.cgi: Use OpenVPN::n2n_status()

Both pages now use the same check, so a working N2N tunnel is no longer
shown as DISCONNECTED after an incomplete session attempt.

Fixes: #13897
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>