From: "cron2 (Code Review)" Date: Fri, 25 Jul 2025 19:52:14 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, ralf@...2726..., frank@...2641... Message-ID: <16f396f45f306b7a243a9bf6bb097bf8122f9900-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="JqryPCaF3KQ="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: add flag to print addresses in a consistent format during float List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ralf_lici , plaisthos , flichtenheld Cc: openvpn-devel --JqryPCaF3KQ= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1092?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: add flag to print addresses in a consistent format during f= loat ...................................................................... add flag to print addresses in a consistent format during float Introduce the MAPF_SHOW_FAMILY flag to prepend the address family to the address when printing an mroute_addr object, similar to print_sockaddr_ex(). This ensures that when logging a float operation, both the old and new addresses are printed in the same format: $proto:[$family]$address:$port. Note: when using this flag with an IPv4-mapped IPv6 address, the output will appear as: [AF_INET6]a.b.c.d Change-Id: I43cd3d564d8c6ad4e41de5a38130d90cb6778395 Signed-off-by: Ralf Lici Acked-by: Gert Doering Message-Id: <20250725194147.17517-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 345.html Signed-off-by: Gert Doering --- M src/openvpn/mroute.c M src/openvpn/mroute.h M src/openvpn/multi.c 3 files changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/1092/3 diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c index a617b33..e3b1e9b 100644 --- a/src/openvpn/mroute.c +++ b/src/openvpn/mroute.c @@ -415,6 +415,10 @@ { buf_printf(&out, "%s:", proto2ascii(maddr.proto, AF_IN= ET, false)); } + if (flags & MAPF_SHOW_FAMILY) + { + buf_printf(&out, "[AF_INET]"); + } buf_printf(&out, "%s", print_in_addr_t(ntohl(maddr.v4.addr= ), (flags & MAPF_IA_EM= PTY_IF_UNDEF) ? IA_EMPTY_IF_UNDEF : 0, gc)); if (maddr.type & MR_WITH_NETBITS) @@ -442,6 +446,10 @@ { buf_printf(&out, "%s:", proto2ascii(maddr.proto, AF_IN= ET6, false)); } + if (flags & MAPF_SHOW_FAMILY) + { + buf_printf(&out, "[AF_INET6]"); + } if (IN6_IS_ADDR_V4MAPPED( &maddr.v6.addr ) ) { buf_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv= 6.addr, diff --git a/src/openvpn/mroute.h b/src/openvpn/mroute.h index c359fd2..4f9fc03 100644 --- a/src/openvpn/mroute.h +++ b/src/openvpn/mroute.h @@ -150,6 +150,7 @@ #define MAPF_SUBNET (1<<0) #define MAPF_IA_EMPTY_IF_UNDEF (1<<1) #define MAPF_SHOW_ARP (1<<2) +#define MAPF_SHOW_FAMILY (1<<3) const char *mroute_addr_print_ex(const struct mroute_addr *ma, const unsigned int flags, struct gc_arena *gc); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index ec260a2..a62c57a 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3275,8 +3275,8 @@ msg(D_MULTI_MEDIUM, "peer %" PRIu32 " (%s) floated from %s to %s", mi->context.c2.tls_multi->peer_id, tls_common_name(mi->context.c2.tls_multi, false), - mroute_addr_print(&mi->real, &gc), - print_link_socket_actual(&m->top.c2.from, &gc)); + mroute_addr_print_ex(&mi->real, MAPF_SHOW_FAMILY, &gc), + mroute_addr_print_ex(&real, MAPF_SHOW_FAMILY, &gc)); /* remove old address from hash table before changing address */ ASSERT(hash_remove(m->hash, &mi->real)); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1092?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I43cd3d564d8c6ad4e41de5a38130d90cb6778395 Gerrit-Change-Number: 1092 Gerrit-PatchSet: 3 Gerrit-Owner: ralf_lici Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --JqryPCaF3KQ= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #3 to the change originally cr= eated by ralf_lici.

View Change

The following approvals got outdate= d and were removed: Code-Review+2 by cron2

add flag to print addresses in a consistent format d=
uring float

Introduce the MAPF_SHOW_FAMILY flag to prepend the addre= ss family to the
address when printing an mroute_addr object, similar to=
print_sockaddr_ex(). This ensures that when logging a float operation,<= br>both the old and new addresses are printed in the same format:
$proto= :[$family]$address:$port.

Note: when using this flag with an IPv4-ma= pped IPv6 address, the output
will appear as: [AF_INET6]a.b.c.d

C= hange-Id: I43cd3d564d8c6ad4e41de5a38130d90cb6778395
Signed-off-by: Ralf = Lici <ralf@...2726...>
Acked-by: Gert Doering <gert@...1296...&= gt;
Message-Id: <20250725194147.17517-1-gert@...1296...>
URL: h= ttps://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32345.ht= ml
Signed-off-by: Gert Doering <gert@...1296...>
---
M src/o= penvpn/mroute.c
M src/openvpn/mroute.h
M src/openvpn/multi.c
3 fil= es changed, 11 insertions(+), 2 deletions(-)

git pull ssh://gerri=
t.openvpn.net:29418/openvpn refs/changes/92/1092/3
diff --git a/src=
/openvpn/mroute.c b/src/openvpn/mroute.c
index a617b33..e3b= 1e9b 100644
--- a/src/openvpn/mroute.c
+++ = b/src/openvpn/mroute.c
@@ -415,6 +415,10 @@
{
buf_printf(&ou= t, "%s:", proto2ascii(maddr.proto, AF_INET, false));
}
+ {
+ buf_printf(&out, = "[AF_INET]");
+ }
buf_printf(&out,= "%s", print_in_addr_t(ntohl(maddr.v4.addr),
= (flags & MAPF_IA_EM= PTY_IF_UNDEF) ? IA_EMPTY_IF_UNDEF : 0, gc));
= if (maddr.type & MR_WITH_NETBITS)
@@ -442,6 +446,10 = @@
{
= buf_printf(&out, "%s:", proto2ascii(maddr.proto, AF_INET6, fa= lse));
}
+ if (flags & MAPF_SHOW_FAMILY)
+ {

+ buf_p= rintf(&out, "[AF_INET6]");
+ }
if = (IN6_IS_ADDR_V4MAPPED( &maddr.v6.addr ) )
= {
buf_printf(&out, "%s&qu= ot;, print_in_addr_t(maddr.v4mappedv6.addr,
diff --git a/sr= c/openvpn/mroute.h b/src/openvpn/mroute.h
index c359fd2..4f= 9fc03 100644
--- a/src/openvpn/mroute.h
+++= b/src/openvpn/mroute.h
@@ -150,6 +150,7 @@
#define MAPF_SUBNET (1<<0)
#define MAPF= _IA_EMPTY_IF_UNDEF (1<<1)
#define MAPF_SHOW_ARP = (1<<2)
+#d= efine MAPF_SHOW_FAMILY (1<<3)
const char *mrou= te_addr_print_ex(const struct mroute_addr *ma,
= const unsigned int flags,
= struct gc_arena *gc);
diff --git a/s= rc/openvpn/multi.c b/src/openvpn/multi.c
index ec260a2..a62= c57a 100644
--- a/src/openvpn/multi.c
+++ b= /src/openvpn/multi.c
@@ -3275,8 +3275,8 @@
= msg(D_MULTI_MEDIUM, "peer %" PRIu32 " (%s) floated from= %s to %s",
mi->context.c2.tls_multi->p= eer_id,
tls_common_name(mi->context.c2.tls_mult= i, false),
- mro= ute_addr_print(&mi->real, &gc),
- print_link_socket_actual(&m->top.c2.fro= m, &gc));
+ = mroute_addr_print_ex(&mi->real, MAPF_SHOW_FAMILY, &gc),=
+ mroute_addr_print_= ex(&real, MAPF_SHOW_FAMILY, &gc));

/* remove old address from hash table before changing address */
ASSERT(hash_remove(m->hash, &mi->real));=

To view, visit change 1092. To unsubscribe, or fo= r help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I43cd3d564d8c6ad4e41de5a3813= 0d90cb6778395
Gerrit-Change-Number: 1092
Gerrit-PatchSet: 3
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--JqryPCaF3KQ=--