From: "ralf_lici (Code Review)" Date: Fri, 18 Jul 2025 21:02:19 +0000 In-Reply-To: References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., gert@...1296... Message-ID: <18ae3da5ec4662dbda94e0d322675fd9dac0fba7-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Q55Jxwy+jXg="; 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: plaisthos , flichtenheld Cc: openvpn-devel --Q55Jxwy+jXg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, flichtenheld, plaisthos. Hello flichtenheld, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1092?usp=3Demail to look at the new patch set (#2). 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 --- 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/2 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 4696686..69ec2da 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3274,8 +3274,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: 2 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: cron2 Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-MessageType: newpatchset --Q55Jxwy+jXg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: cron2, flichtenheld, plaisthos. <= /p>

ralf_lici uploaded patch set #2 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/1092?usp=3Demail">View Chan= ge

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

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

Change-Id: I43cd3= d564d8c6ad4e41de5a38130d90cb6778395
Signed-off-by: Ralf Lici <ralf@...1186...= .2726...>
---
M src/openvpn/mroute.c
M src/openvpn/mroute.h
= M src/openvpn/multi.c
3 files changed, 11 insertions(+), 2 deletions(-)<= br>
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/1=
092/2
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
@@ -41= 5,6 +415,10 @@
{
= buf_printf(&out, "%s:", proto2ascii(maddr.proto, = AF_INET, 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_EMPTY_IF_UNDEF) ? IA_EMPTY_IF_UNDEF : 0, gc));<= /span>
if (maddr.type & MR_WITH_NETBITS)
@@ -442,6 +446,10 @@
{<= br> buf_printf(&out, "%s:", proto2a= scii(maddr.proto, AF_INET6, false));
}
+ if (fla= gs & MAPF_SHOW_FAMILY)
+ {
+ buf_printf(&out, "[AF_INET6]");
+ }=
if (IN6_IS_ADDR_V4MAPPED( &maddr.v6.addr ) )=
{
bu= f_printf(&out, "%s", print_in_addr_t(maddr.v4mappedv6.addr,
diff --git a/src/openvpn/mroute.h b/src/openvpn/mroute.h
index c359fd2..4f9fc03 100644
--- a/src/openvp= n/mroute.h
+++ b/src/openvpn/mroute.h
@@ -1= 50,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 flag= s,
struct gc_arena *gc);<= /span>
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 4696686..69ec2da 100644
--- a/src/openvpn= /multi.c
+++ b/src/openvpn/multi.c
@@ -3274= ,8 +3274,8 @@
msg(D_MULTI_MEDIUM, "peer %" P= RIu32 " (%s) floated from %s to %s",
mi-= >context.c2.tls_multi->peer_id,
tls_common_n= ame(mi->context.c2.tls_multi, false),
- mroute_addr_print(&mi->real, &gc),
- print_link_socke= t_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->ha= sh, &mi->real));

To view, visit = change 1= 092. To unsubscribe, or for help writing mail filters, visit settings.

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