From: "ralf_lici (Code Review)" Date: Fri, 18 Jul 2025 14:41:03 +0000 References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <814f8b3811918085c1307ed295ade451044eaa0d-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="B3A56YgcBMo="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: add flag to print mroute_addr address family List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --B3A56YgcBMo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1092?usp=3Demail to review the following change. Change subject: add flag to print mroute_addr address family ...................................................................... add flag to print mroute_addr address family Add the MAPF_SHOW_FAMILY flag to prepend the address family to the address when printing an mroute_addr object, similar to how it's done in print_sockaddr_ex(). Note that when using this flag with an IPv4-mapped IPv6 address, the output will look like: [AF_INET6]a.b.c.d Change-Id: I43cd3d564d8c6ad4e41de5a38130d90cb6778395 Signed-off-by: Ralf Lici --- M src/openvpn/mroute.c M src/openvpn/mroute.h 2 files changed, 9 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/1092/1 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); -- 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: 1 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --B3A56YgcBMo= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

ralf_lici would like plaisthos and flichtenheld to review this change.

V= iew Change

add flag to print mroute_addr address family

Add the = MAPF_SHOW_FAMILY flag to prepend the address family to the
address when = printing an mroute_addr object, similar to how it's done in
print_so= ckaddr_ex().

Note that when using this flag with an IPv4-mapped IPv6= address, the
output will look like: [AF_INET6]a.b.c.d

Change-Id:= I43cd3d564d8c6ad4e41de5a38130d90cb6778395
Signed-off-by: Ralf Lici <= ralf@...2726...>
---
M src/openvpn/mroute.c
M src/openvpn/mrout= e.h
2 files changed, 9 insertions(+), 0 deletions(-)

git pull =
ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/1092/1
diff =
--git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
index a= 617b33..e3b1e9b 100644
--- a/src/openvpn/mroute.c+++ b/src/openvpn/mroute.c
@@ -415,6 +415,10 @@
{
buf_pri= ntf(&out, "%s:", proto2ascii(maddr.proto, AF_INET, false));
}
+ if (flags & MAPF_SHOW_FAMILY)
<= span style=3D"color: hsl(120, 100%, 40%);">+ {

+ buf_printf(&a= mp;out, "[AF_INET]");

+ }
buf_printf(&= amp;out, "%s", print_in_addr_t(ntohl(maddr.v4.addr),
(flags & MA= PF_IA_EMPTY_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_I= NET6, false));
}
+ if (flags & MAPF_SHOW_FAM= ILY)
+ = {
+ = buf_printf(&out, "[AF_INET6]");
+ }
= if (IN6_IS_ADDR_V4MAPPED( &maddr.v6.addr ) )
= {
buf_printf(&out, &qu= ot;%s", print_in_addr_t(maddr.v4mappedv6.addr,
diff --= git a/src/openvpn/mroute.h b/src/openvpn/mroute.h
index c35= 9fd2..4f9fc03 100644
--- a/src/openvpn/mroute.h
<= span>+++ b/src/openvpn/mroute.h
@@ -150,6 +150,7 @@<= br> #define MAPF_SUBNET (1<<0)
#def= ine MAPF_IA_EMPTY_IF_UNDEF (1<<1)
#define MAPF_SHOW_= ARP (1<<2)
+#define MAPF_SHOW_FAMILY (1<<3)
const ch= ar *mroute_addr_print_ex(const struct mroute_addr *ma,
= const unsigned int flags,
= struct gc_arena *gc);

To view, visit change 1092. To unsubscribe, or for help writing m= ail filters, visit settings<= /a>.

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