Skip to contentSkip to conversation

Avoid management log loop with verb >= 6

PATCH In review Lev Stipakov 3 participants 3 messages Feb 17, 2023 – Feb 27, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid management log loop with verb >= 6

From: Lev Stipakov <[email protected]...>

This log message is printed within check_tls(),
which is called by pre_select(), which is called
on every iteration of event loop.

When management is attached (and doesn't use own event loop), this message sets management state to "wait write", which arms event loop. When on the next iteration iowait returns with "management write event is set", we call pre_select() and print that message again, causing the loop.

Fix by simply removing this log message.

---
 src/openvpn/dco.c | 2 --
 1 file changed, 2 deletions(-)
src/openvpn/dco.c +0 -2
index 3087a0df..b53332a8 100644
@@ -133,8 +133,6 @@ dco_get_secondary_key(struct tls_multi *multi, const struct key_state *primary)
 bool
 dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
 {
-    msg(D_DCO_DEBUG, "%s: peer_id=%d", __func__, multi->dco_peer_id);
-
     /* this function checks if keys have to be swapped or erased, therefore it
      * can't do much if we don't have any key installed
      */
Signature · 1 line
2.38.1.windows.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 12 lines · Lev Stipakov

From: Lev Stipakov <[email protected]...>

This log message is printed within check_tls(),
which is called by pre_select(), which is called
on every iteration of event loop.

When management is attached (and doesn't use own event loop), this message sets management state to "wait write", which arms event loop. When on the next iteration iowait returns with "management write event is set", we call pre_select() and print that message again, causing the loop.

Quoted 3 lines

Fix by simply removing this log message.

As discussed on IRC, removing this message is a good thing as it serves no real purpose.

On top of that this message is causing this log infinite recursion, therefore it should just go.

OTOH we may still have *some* recursion due to other messages printed by this function. However, this messages will print only once, therefore they won't cause the recursion to continue indefinitely.

Quoted 17 lines
---
  src/openvpn/dco.c | 2 --
  1 file changed, 2 deletions(-)
src/openvpn/dco.c +0 -2
index 3087a0df..b53332a8 100644
@@ -133,8 +133,6 @@ dco_get_secondary_key(struct tls_multi *multi, const struct key_state *primary)
  bool
  dco_update_keys(dco_context_t *dco, struct tls_multi *multi)
  {
-    msg(D_DCO_DEBUG, "%s: peer_id=%d", __func__, multi->dco_peer_id);
-
      /* this function checks if keys have to be swapped or erased, therefore it
       * can't do much if we don't have any key installed
       */
Signature · 1 line
Antonio Quartulli
#2 lore raw
In reply to Lev Stipakov

Trivial enough :-)

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

commit b8eddda8524bf6f164361667bfce6bbb3fac846b (master) commit c26609bdcd75da5702befbdfa5d0136a7787e52e (release/2.6)

Author: Lev Stipakov
Date:   Fri Feb 17 14:21:55 2023 +0200
     Avoid management log loop with verb >= 6

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

--
kind regards,

Gert Doering