Skip to contentSkip to conversation

Log peer-id if loglevel is D_DCO_DEBUG and dco is enabled

PATCH In review Arne Schwabe 2 participants 2 messages Jan 10, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Log peer-id if loglevel is D_DCO_DEBUG and dco is enabled

This enables logging the peer id in p2mp mode if dco is enabled and the log level is high enough

Patch v2: use check_debug_level to check current log level

---
 src/openvpn/multi.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/openvpn/multi.c +6 -0
index 26904859f..b639d3c67 100644
@@ -476,6 +476,12 @@ multi_instance_string(const struct multi_instance *mi, bool null, struct gc_aren
             buf_printf(&out, "%s/", cn);
         }
         buf_printf(&out, "%s", mroute_addr_print(&mi->real, gc));
+        if (mi->context.c2.tls_multi
+            && check_debug_level(D_DCO_DEBUG)
+            && dco_enabled(&mi->context.options))
+        {
+            buf_printf(&out, " peer-id=%d", mi->context.c2.tls_multi->peer_id);
+        }
         return BSTR(&out);
     }
     else if (null)
Signature · 1 line
2.37.1 (Apple Git-137.1)
Acked-by on v2 1/1
#1 lore raw

Works and helps with DCO debugging.

Some of the messages look a bit stupid now... so we might want to go and polish :-)

.. gremlin14943/194.97.140.21:12404 peer-id=9 dco_update_keys: peer_id=9
.. gremlin14833/194.97.140.21:11036 peer-id=11 dco_update_keys: peer_id=11
.. gremlin14340/194.97.140.21:29500 peer-id=12 dco_update_keys: peer_id=12

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

commit 533c170fb60882547152e3b3222c8f7788d6b80f (master) commit d04c2110a006c204b5753113cdbed2866b9641ed (release/2.6)

Author: Arne Schwabe
Date:   Tue Jan 10 16:19:01 2023 +0100
     Log peer-id if loglevel is D_DCO_DEBUG and dco is enabled

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

--
kind regards,

Gert Doering