Change in openvpn[master]: socket: Avoid conversion warning in get_addr_generic
A message that is not in the archive (sent off-list or not yet received): gerrit.1768578994000.I5ad13bc6674b3403251cc552d1f2c0f057431817@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email
to review the following change.
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.
---
M src/openvpn/options.c
M src/openvpn/socket.c
2 files changed, 11 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/75/1475/1
src/openvpn/options.c +1 -4
@@ -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 ); } static char *
src/openvpn/socket.c +10 -10
@@ -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 = bits; + *netbits = (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 *act, const struct addrinfo *local, bool do_listen,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5ad13bc6674b3403251cc552d1f2c0f057431817
Gerrit-Change-Number: 1475
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email )
Change subject: socket: Avoid conversion warning in get_addr_generic
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5ad13bc6674b3403251cc552d1f2c0f057431817
Gerrit-Change-Number: 1475
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 19 Jan 2026 12:25:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 socket: Avoid conversion warning in get_addr_generic
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
We already check earlier that bits is smaller that max_bits, so the cast is safe.
While reviewing the callers, remove some unused
variables.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1475
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1475
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/options.c +1 -4
@@ -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 ); } static char *
src/openvpn/socket.c +10 -10
@@ -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 = bits; + *netbits = (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 *act, const struct addrinfo *local, bool do_listen,
[Openvpn-devel] [PATCH applied] Re: socket: Avoid conversion warning in get_addr_generic
Easy enough, simplifies things, and while it doesn't "get rid of #pragma", it at least reduces the non-monitored scope.
Good find, ipv6_addr_safe_hexplusbits() :-)
Your patch has been applied to the master branch.
commit 2cc00e80bca26c1c7129fa45e48714ca68b56b28
Author: Frank Lichtenheld Date: Mon Jan 19 13:25:51 2026 +0100
socket: Avoid conversion warning in get_addr_generic
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1475
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35324.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1475
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35324.html
---
M src/openvpn/options.c
M src/openvpn/socket.c
2 files changed, 11 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/75/1475/2
src/openvpn/options.c +1 -4
@@ -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 ); } static char *
src/openvpn/socket.c +10 -10
@@ -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 = bits; + *netbits = (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 *act, const struct addrinfo *local, bool do_listen,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5ad13bc6674b3403251cc552d1f2c0f057431817
Gerrit-Change-Number: 1475
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email )
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1475
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35324.html
---
M src/openvpn/options.c
M src/openvpn/socket.c
2 files changed, 11 insertions(+), 14 deletions(-)
src/openvpn/options.c +1 -4
@@ -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 ); } static char *
src/openvpn/socket.c +10 -10
@@ -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 = bits; + *netbits = (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 *act, const struct addrinfo *local, bool do_listen,
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1475?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5ad13bc6674b3403251cc552d1f2c0f057431817
Gerrit-Change-Number: 1475
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>