From: "cron2 (Code Review)" Date: Mon, 19 Jan 2026 17:09:36 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="9NaPAA5Y4kM="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: socket: Avoid conversion warning in get_addr_generic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --9NaPAA5Y4kM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/14= 75?usp=3Demail ) Change subject: socket: Avoid conversion warning in get_addr_generic ...................................................................... socket: Avoid conversion warning in get_addr_generic We already check earlier that bits is smaller that max_bits, so the cast is safe. While reviewing the callers, remove some unused variables. Change-Id: I5ad13bc6674b3403251cc552d1f2c0f057431817 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1475 Message-Id: <20260119122556.15225-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 324.html Signed-off-by: Gert Doering --- M src/openvpn/options.c M src/openvpn/socket.c 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index cede758..85669e0 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1144,10 +1144,7 @@ static bool ipv6_addr_safe_hexplusbits(const char *ipv6_prefix_spec) { - struct in6_addr t_addr; - unsigned int t_bits; - - return get_ipv6_addr(ipv6_prefix_spec, &t_addr, &t_bits, M_WARN); + return get_ipv6_addr(ipv6_prefix_spec, NULL, NULL, M_WARN); } =20 static char * diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 093f822..331249d 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -72,11 +72,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /* * Functions related to the translation of DNS names to IP addresses. */ @@ -180,7 +175,7 @@ if (netbits) { - *netbits =3D bits; + *netbits =3D (unsigned int)bits; } /* restore '/' separator, if any */ @@ -683,6 +678,11 @@ } } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + static void create_socket(struct link_socket *sock, struct addrinfo *addr) { @@ -738,6 +738,10 @@ bind_local(sock, addr->ai_family); } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + #ifdef TARGET_ANDROID static void protect_fd_nonlocal(int fd, const struct sockaddr *addr) @@ -861,10 +865,6 @@ gc_free(&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static socket_descriptor_t socket_listen_accept(socket_descriptor_t sd, struct link_socket_actual *ac= t, const struct addrinfo *local, bool do_listen, -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1475?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I5ad13bc6674b3403251cc552d1f2c0f057431817 Gerrit-Change-Number: 1475 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --9NaPAA5Y4kM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

socket: Avoid conversion warning in get_addr_gen=
eric

We already check earlier that bits is smaller that
max_bits,= so the cast is safe.

While reviewing the callers, remove some unuse= d
variables.

Change-Id: I5ad13bc6674b3403251cc552d1f2c0f057431817=
Signed-off-by: Frank Lichtenheld <frank@...2641...>
Acked-by: = Gert Doering <gert@...1296...>
Gerrit URL: https://gerrit.openvpn.= net/c/openvpn/+/1475
Message-Id: <20260119122556.15225-1-gert@...1726...= ...>
URL: https://www.mail-archive.com/openvpn-devel@...1483...= e.net/msg35324.html
Signed-off-by: Gert Doering <gert@...1296...><= br>---
M src/openvpn/options.c
M src/openvpn/socket.c
2 files chan= ged, 11 insertions(+), 14 deletions(-)

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index cede758..85669e0 100644
--- a/src/openvpn/options.= c
+++ b/src/openvpn/options.c
@@ -1144,10 += 1144,7 @@
static bool
ipv6_addr_safe_hexp= lusbits(const char *ipv6_prefix_spec)
{
- struct in6_addr t_addr;
- unsigned int t_bits;-
- return get_ipv6_addr(ipv6_prefix_spec, &t_ad= dr, &t_bits, M_WARN);
+ return get_ipv6_addr(ipv6_prefix_spec, NULL, NULL, M_WARN);
}

static char *
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c

index 093f822..331249d 100644
--- a/src/openvpn/socket.c<= /span>
+++ b/src/openvpn/socket.c
@@ -72,11 +72,6 = @@
}
}

-#if defined(__GNUC__) || defined(_= _clang__)

-#pragma GCC = diagnostic push
-#pragm= a GCC diagnostic ignored "-Wconversion"
-#endif
-
/*
* Functions related to = the translation of DNS names to IP addresses.
*/@@ -180,7 +175,7 @@

if (netb= its)
{
- *netbits =3D bits;
+ *netbits =3D (unsigned int)bits;
= }

/* restore '/' separator, = if any */
@@ -683,6 +678,11 @@
}
}

+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
<= span style=3D"color: hsl(120, 100%, 40%);">+#pragma GCC diagnostic ignored = "-Wconversion"

+#endif
+<= br> static void
create_socket(struct link_socket *so= ck, struct addrinfo *addr)
{
@@ -738,6 +73= 8,10 @@
bind_local(sock, addr->ai_family); }

+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
+
#ifdef TARGET_ANDROID<= br> static void
protect_fd_nonlocal(int fd, const st= ruct sockaddr *addr)
@@ -861,10 +865,6 @@
= gc_free(&gc);
}

-#if defined(__GNUC__) || defined(__cla= ng__)
-#pragma GCC diag= nostic pop
-#endif

-
static s= ocket_descriptor_t
socket_listen_accept(socket_descriptor_= t sd, struct link_socket_actual *act,
= const struct addrinfo *local, bool do_listen,

<= /pre>

To view, visit change 1475. To unsubscribe, or for help writing mail fi= lters, visit set= tings.

=
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5ad13bc6674b3403251cc552d1f= 2c0f057431817
Gerrit-Change-Number: 1475
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --9NaPAA5Y4kM=--