Skip to contentSkip to conversation

Reduce logspam about 'dco_update_keys: peer_id=-1' in p2p server mode

PATCH In review Gert Doering 2 participants 3 messages Jan 9, 2023 – Jan 10, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reduce logspam about 'dco_update_keys: peer_id=-1' in p2p server mode

p2p --tls-server with no active client/peer logs once per second

"dco_update_keys: peer_id=-1"

which does exactly nothing, except fill the disk. So skip the call to dco_update_keys() if peer_id == -1.

---
 src/openvpn/forward.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/openvpn/forward.c +6 -0
index ae0512fc..2ba8b0fa 100644
@@ -151,6 +151,12 @@ check_dco_key_status(struct context *c)
         return;
     }
 
+    /* no active peer (p2p tls-server mode) */
+    if (c->c2.tls_multi->dco_peer_id == -1 )
+    {
+        return;
+    }
+
     if (!dco_update_keys(&c->c1.tuntap->dco, c->c2.tls_multi))
     {
         /* Something bad happened. Kill the connection to
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 17 lines · Gert Doering

p2p --tls-server with no active client/peer logs once per second

   "dco_update_keys: peer_id=-1"

which does exactly nothing, except fill the disk. So skip the call to dco_update_keys() if peer_id == -1.

---
  src/openvpn/forward.c | 6 ++++++
  1 file changed, 6 insertions(+)
src/openvpn/forward.c +0 -0
index ae0512fc..2ba8b0fa 100644

src/openvpn/forward.c check_dco_key_status(struct context *c) · line 155

Quoted 5 lines
src/openvpn/forward.c +2 -0
@@ -151,6 +151,12 @@ check_dco_key_status(struct context *c)
          return;
      }
 
+    /* no active peer (p2p tls-server mode) */
+    if (c->c2.tls_multi->dco_peer_id == -1 )

Please remove the space after -1 (not sure why uncrustify hasn't caught it).

src/openvpn/forward.c check_dco_key_status(struct context *c) · line 162

Quoted 7 lines
src/openvpn/forward.c +4 -0
+    {
+        return;
+    }
+
      if (!dco_update_keys(&c->c1.tuntap->dco, c->c2.tls_multi))
      {
          /* Something bad happened. Kill the connection to

Rest looks good. Thanks!

However, as discussed on IRC: *why* are we running the check_tls code is the peer has gone away and we have switched the peer-id to -1?

This is the real question.

Signature · 1 line
Antonio Quartulli
#2 lore raw
In reply to Gert Doering

Antonio, thanks for the review. Fixed the whitespace. (Uncrustify did not see it since the patch was ad-hoc written on a system that does not have the hook - but my pre-merge hook would have caught it).

Patch has been applied to the master and release/2.6 branch.

commit 85e0df6b493396d9d1d9030c4018f67037d2f12b (master) commit 9bc2dfea0e1f643b2a02b61455e1845ae83f7518 (release/2.6)

Author: Gert Doering
Date:   Mon Jan 9 21:00:11 2023 +0100
     Reduce logspam about 'dco_update_keys: peer_id=-1' in p2p server mode

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Antonio Quartulli <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg25935.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering