Skip to contentSkip to conversation

Fix IPv6 route add/delete message log level

PATCH In review Steffan Karger 2 participants 4 messages Jan 5, 2024 – Jan 6, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix IPv6 route add/delete message log level

We have D_ROUTE for route addition/deletion messages, which prints at loglevel 3. Use that for IPv6, like we do for IPv4 to reduce terminal spam for non-legacy-networking setups. Prvious code would print the messages at --verb 1.

---
 src/openvpn/route.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/openvpn/route.c +3 -3
index 2f472a1f..e784782b 100644
@@ -1940,10 +1940,10 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,
 #endif
 
 #ifndef _WIN32
-    msg( M_INFO, "add_route_ipv6(%s/%d -> %s metric %d) dev %s",
+    msg(D_ROUTE, "add_route_ipv6(%s/%d -> %s metric %d) dev %s",
          network, r6->netbits, gateway, r6->metric, device );
 #else
-    msg( M_INFO, "add_route_ipv6(%s/%d -> %s metric %d) IF %lu",
+    msg(D_ROUTE, "add_route_ipv6(%s/%d -> %s metric %d) IF %lu",
          network, r6->netbits, gateway, r6->metric,
          r6->adapter_index ? r6->adapter_index : tt->adapter_index);
 #endif
@@ -2394,7 +2394,7 @@ delete_route_ipv6(const struct route_ipv6 *r6, const struct tuntap *tt,
     }
 #endif
 
-    msg( M_INFO, "delete_route_ipv6(%s/%d)", network, r6->netbits );
+    msg(D_ROUTE, "delete_route_ipv6(%s/%d)", network, r6->netbits );
 
 #if defined(TARGET_LINUX)
     int metric = -1;
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 4 lines · Steffan Karger

We have D_ROUTE for route addition/deletion messages, which prints at loglevel 3. Use that for IPv6, like we do for IPv4 to reduce terminal spam for non-legacy-networking setups. Prvious code would print the messages at --verb 1.

Good catch, and a happy new year :-)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#2 lore raw
In reply to Steffan Karger

Patch looks good, makes sense, thanks for that.

Interesting enough, the old code had weird formatting ("msg( M_INFO") which led to weird indenting of the *next* lines - this patch changed the msg() call to have no leading blank, and uncrustify complained that now the successive lines had whitespace errors... fixed on the fly.

Not tested beyond "looks reasonable, compiles, and add_route() indeed uses D_ROUTE for informational msg() calls".

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

commit b959b02b4f607628896b4092f7ddfa675e87d929 (master) commit 9abf74c92c1c13de089523babc1dfeda7bb7255f (release/2.6)

Author: Steffan Karger
Date:   Fri Jan 5 14:57:42 2024 +0100
     Fix IPv6 route add/delete message log level

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

--
kind regards,

Gert Doering

#3 lore raw

Hi,

Quoted 7 lines · Gert Doering

Patch looks good, makes sense, thanks for that.

Interesting enough, the old code had weird formatting ("msg( M_INFO") which led to weird indenting of the *next* lines - this patch changed the msg() call to have no leading blank, and uncrustify complained that now the successive lines had whitespace errors... fixed on the fly.

Quoted 7 lines

Not tested beyond "looks reasonable, compiles, and add_route() indeed uses D_ROUTE for informational msg() calls".

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

commit b959b02b4f607628896b4092f7ddfa675e87d929 (master) commit 9abf74c92c1c13de089523babc1dfeda7bb7255f (release/2.6)

Unfortunately I fat-fingered cherrypicking and commit-id'ing - "master" has

commit 7268e14dba61254b04a0b2db37c12c8ab58423ea (master)

and the ID referenced above is "the patch without the whitespace fixes" - which only exists in my local repo, not pushed anywhere.

Doubly unfortunate, I also cherry-picked b959b0, so release/2.6 ended up with a commit that was uncrustify-broken. I'm not going to fix this with a force-push, so we have a new commit in 2.6 now...

commit 9fb62e2b32fd4e63ae323ccfbc79dfaba6ce4d91 (HEAD -> release/2.6)

Author: Gert Doering <[email protected]...>
Date:   Sat Jan 6 09:38:41 2024 +0100

fix uncrustify complaints about previous patch

... which contains the diff b959b0..7268e1:

src/openvpn/route.c +3 -3
@@ -1939,11 +1939,11 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt,
 
 #ifndef _WIN32
     msg(D_ROUTE, "add_route_ipv6(%s/%d -> %s metric %d) dev %s",
-         network, r6->netbits, gateway, r6->metric, device );
+        network, r6->netbits, gateway, r6->metric, device );
 #else
     msg(D_ROUTE, "add_route_ipv6(%s/%d -> %s metric %d) IF %lu",
-         network, r6->netbits, gateway, r6->metric,
-         r6->adapter_index ? r6->adapter_index : tt->adapter_index);
+        network, r6->netbits, gateway, r6->metric,
+        r6->adapter_index ? r6->adapter_index : tt->adapter_index);
 #endif
 
 

apologies for that.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...