[XS] Change in openvpn[master]: P2P: transmit ping timeout to peer and adjust own frequency

"plaisthos \(Code Review\) via Openvpn-devel" <[email protected]> Sun, 26 Jul 2026 00:06:52 +0000
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/1825?usp=email )


Change subject: P2P: transmit ping timeout to peer and adjust own frequency
......................................................................

P2P: transmit ping timeout to peer and adjust own frequency

If the ping timeout received from the peer is more than our own sending
interval, warn about this and set our own timeout to a third of the
peers timeout to avoid the connection breaking because of ping timeout.

Change-Id: I2d4801e282501274396f6421400abe5136e927eb
Signed-off-by: Arne Schwabe <[email protected]>
---
M src/openvpn/init.c
M src/openvpn/ssl.c
M src/openvpn/ssl_common.h
3 files changed, 9 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1825/1

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index e8644f4..3667c15 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -3281,6 +3281,7 @@
     to.replay_window = options->replay_window;
     to.replay_time = options->replay_time;
     to.config_ciphername = c->options.ciphername;
+    to.ping_rec_timeout = c->options.ping_rec_timeout;
     to.config_ncp_ciphers = c->options.ncp_ciphers;
     to.transition_window = options->transition_window;
     to.handshake_window = options->handshake_window;
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 245f937..dfff7d7 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -2000,6 +2000,13 @@
         {
             /* If we are not using pull we announce P2P NCP support */
             iv_proto |= IV_PROTO_NCP_P2P;
+
+            /* We are sending our ping receive timeout to allow detecting
+             * mismatched ping */
+            if (session->opt->ping_rec_timeout)
+            {
+                buf_printf(&out, "P=%d\n", session->opt->ping_rec_timeout);
+            }
         }
 
         if (session->opt->data_epoch_supported)
diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h
index f6392f9..5a21bcce 100644
--- a/src/openvpn/ssl_common.h
+++ b/src/openvpn/ssl_common.h
@@ -371,6 +371,7 @@
 
     const char *config_ciphername;
     const char *config_ncp_ciphers;
+    int ping_rec_timeout;
 
     /** whether our underlying data channel supports new data channel
      * features (epoch keys with AEAD tag at the end). This is always true

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1825?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d4801e282501274396f6421400abe5136e927eb
Gerrit-Change-Number: 1825
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel