[Openvpn-devel] dco: trigger ping timeout event only if the peer expired

Message ID 20220818144431.208337-1-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel] dco: trigger ping timeout event only if the peer expired | expand

Commit Message

Antonio Quartulli Aug. 18, 2022, 4:44 a.m. UTC
DEL_PEER events can be sent by ovpn-dco to userspace for various reasons.
We should trigger the ping timeout reaction only if the reason was
"peer has expired".

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 src/openvpn/forward.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Gert Doering Sept. 11, 2022, 6:12 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

"This seems to make sense" :-)  (aka, do what the commit message says)

Tested on the Ubuntu/DCO client/server test bench.

Your patch has been applied to the master branch.

commit a179d788c77d537b3a302320ebc476ca412c4e44
Author: Antonio Quartulli
Date:   Thu Aug 18 16:44:31 2022 +0200

     dco: trigger ping timeout event only if the peer expired

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220818144431.208337-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25000.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index d70b4f52..970be3bf 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -1119,7 +1119,8 @@  process_incoming_dco(struct context *c)
 
     dco_do_read(dco);
 
-    if (dco->dco_message_type == OVPN_CMD_DEL_PEER)
+    if ((dco->dco_message_type == OVPN_CMD_DEL_PEER)
+        && (dco->dco_del_peer_reason == OVPN_DEL_PEER_REASON_EXPIRED))
     {
         trigger_ping_timeout_signal(c);
         return;