Change in openvpn[master]: socks: Fix conversion warnings with MinGW
A message that is not in the archive (sent off-list or not yet received): gerrit.1759942426000.I977bab08cb614c2d59c34ceebc112f3add9bd168@...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/+/1262?usp=email
to review the following change.
Change subject: socks: Fix conversion warnings with MinGW
......................................................................
socks: Fix conversion warnings with MinGW
The winsock2 APIs are a bit weird at times...
---
M src/openvpn/socks.c
1 file changed, 11 insertions(+), 17 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/62/1262/1
src/openvpn/socks.c +11 -17
@@ -80,11 +80,6 @@free (sp); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static bool socks_proxy_recv_char(char *c, const char *name, socket_descriptor_t sd, struct event_timeout *server_poll_timeout,
@@ -98,7 +93,8 @@ tv.tv_sec =get_server_poll_remaining_time (server_poll_timeout); tv.tv_usec =0 ; -const int status =select (sd +1 , &reads,NULL ,NULL , &tv); +/* NB: first argument ignored on Windows where socket_descriptor_t != int */ +const int status =select ((int )sd +1 , &reads,NULL ,NULL , &tv);get_signal (signal_received);if (*signal_received)
@@ -139,10 +135,7 @@ volatile int *signal_received) {char to_send[516 ]; -char buf[2 ]; -int len =0 ;struct user_pass creds; -ssize_t size;bool ret = false;CLEAR (creds);
@@ -161,9 +154,10 @@int sret =snprintf (to_send,sizeof (to_send),"\x01%c%s%c%s" , (int )strlen (creds.username), creds.username, (int )strlen (creds.password), creds.password); -ASSERT (sret <=sizeof (to_send)); +ASSERT (sret >=0 && sret <=sizeof (to_send)); - size =send (sd, to_send,strlen (to_send),MSG_NOSIGNAL ); +/* NB: int because Windows APIs */ +ssize_t size =send (sd, to_send, (int )strlen (to_send),MSG_NOSIGNAL );if (size !=strlen (to_send)) {
@@ -172,6 +166,8 @@ goto cleanup; } +int len =0 ; +char buf[2 ];while (len <2 ) {char c;
@@ -419,8 +415,10 @@ buf[5 + len +1 ] = (char )(port &0xff ); { -const ssize_t size =send (sd, buf,5 + len +2 ,MSG_NOSIGNAL ); -if ((int )size !=5 + (int )len +2 ) +/* int because Windows APIs */ +int send_len =5 + (int )len +2 ; +const ssize_t size =send (sd, buf, send_len,MSG_NOSIGNAL ); +if (size != send_len) {msg (D_LINK_ERRORS |M_ERRNO ,"establish_socks_proxy_passthru: TCP port write failed on send()" );
@@ -443,10 +441,6 @@return ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void establish_socks_proxy_udpassoc(struct socks_proxy_info *p, socket_descriptor_t ctrl_sd, /* already open to proxy */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1262?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: I977bab08cb614c2d59c34ceebc112f3add9bd168
Gerrit-Change-Number: 1262
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.
stipa has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1262?usp=email )
Change subject: socks: Fix conversion warnings with MinGW
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1262?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: I977bab08cb614c2d59c34ceebc112f3add9bd168
Gerrit-Change-Number: 1262
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 10 Oct 2025 07:56:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, plaisthos.
stipa has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1262?usp=email )
Change subject: socks: Fix conversion warnings with MinGW
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
I checked the Winsock API and indeed type conversion looks correct.
I was a bit puzzled by "NB" in comment (what is that?) but not too much to not to ack it.
I didn't test it - only compiled with msvc cl/clang.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1262?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: I977bab08cb614c2d59c34ceebc112f3add9bd168
Gerrit-Change-Number: 1262
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 10 Oct 2025 07:58:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
PATCH 1/1 socks: Fix conversion warnings with MinGW
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
The winsock2 APIs are a bit weird at times...
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1262
---
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/+/1262
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Lev Stipakov <[email protected]...>
src/openvpn/socks.c +11 -17
@@ -80,11 +80,6 @@free (sp); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static bool socks_proxy_recv_char(char *c, const char *name, socket_descriptor_t sd, struct event_timeout *server_poll_timeout,
@@ -98,7 +93,8 @@ tv.tv_sec =get_server_poll_remaining_time (server_poll_timeout); tv.tv_usec =0 ; -const int status =select (sd +1 , &reads,NULL ,NULL , &tv); +/* NB: first argument ignored on Windows where socket_descriptor_t != int */ +const int status =select ((int )sd +1 , &reads,NULL ,NULL , &tv);get_signal (signal_received);if (*signal_received)
@@ -139,10 +135,7 @@ volatile int *signal_received) {char to_send[516 ]; -char buf[2 ]; -int len =0 ;struct user_pass creds; -ssize_t size;bool ret = false;CLEAR (creds);
@@ -161,9 +154,10 @@int sret =snprintf (to_send,sizeof (to_send),"\x01%c%s%c%s" , (int )strlen (creds.username), creds.username, (int )strlen (creds.password), creds.password); -ASSERT (sret <=sizeof (to_send)); +ASSERT (sret >=0 && sret <=sizeof (to_send)); - size =send (sd, to_send,strlen (to_send),MSG_NOSIGNAL ); +/* NB: int because Windows APIs */ +ssize_t size =send (sd, to_send, (int )strlen (to_send),MSG_NOSIGNAL );if (size !=strlen (to_send)) {
@@ -172,6 +166,8 @@ goto cleanup; } +int len =0 ; +char buf[2 ];while (len <2 ) {char c;
@@ -419,8 +415,10 @@ buf[5 + len +1 ] = (char )(port &0xff ); { -const ssize_t size =send (sd, buf,5 + len +2 ,MSG_NOSIGNAL ); -if ((int )size !=5 + (int )len +2 ) +/* int because Windows APIs */ +int send_len =5 + (int )len +2 ; +const ssize_t size =send (sd, buf, send_len,MSG_NOSIGNAL ); +if (size != send_len) {msg (D_LINK_ERRORS |M_ERRNO ,"establish_socks_proxy_passthru: TCP port write failed on send()" );
@@ -443,10 +441,6 @@return ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void establish_socks_proxy_udpassoc(struct socks_proxy_info *p, socket_descriptor_t ctrl_sd, /* already open to proxy */
[Openvpn-devel] [PATCH applied] Re: socks: Fix conversion warnings with MinGW
What do I know about windows... but if Lev says it's fine, and the BBs build fine, then it must be good...
Your patch has been applied to the master branch.
commit 083867b0a626b94ab93194834dddf4a38ebc8b6e
Author: Frank Lichtenheld Date: Fri Oct 10 11:57:00 2025 +0200
socks: Fix conversion warnings with MinGW
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Lev Stipakov <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1262
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244802/
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/+/1262?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by stipa
Change subject: socks: Fix conversion warnings with MinGW
......................................................................
socks: Fix conversion warnings with MinGW
The winsock2 APIs are a bit weird at times...
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1262
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244802/
---
M src/openvpn/socks.c
1 file changed, 11 insertions(+), 17 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/62/1262/2
src/openvpn/socks.c +11 -17
@@ -80,11 +80,6 @@free (sp); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static bool socks_proxy_recv_char(char *c, const char *name, socket_descriptor_t sd, struct event_timeout *server_poll_timeout,
@@ -98,7 +93,8 @@ tv.tv_sec =get_server_poll_remaining_time (server_poll_timeout); tv.tv_usec =0 ; -const int status =select (sd +1 , &reads,NULL ,NULL , &tv); +/* NB: first argument ignored on Windows where socket_descriptor_t != int */ +const int status =select ((int )sd +1 , &reads,NULL ,NULL , &tv);get_signal (signal_received);if (*signal_received)
@@ -139,10 +135,7 @@ volatile int *signal_received) {char to_send[516 ]; -char buf[2 ]; -int len =0 ;struct user_pass creds; -ssize_t size;bool ret = false;CLEAR (creds);
@@ -161,9 +154,10 @@int sret =snprintf (to_send,sizeof (to_send),"\x01%c%s%c%s" , (int )strlen (creds.username), creds.username, (int )strlen (creds.password), creds.password); -ASSERT (sret <=sizeof (to_send)); +ASSERT (sret >=0 && sret <=sizeof (to_send)); - size =send (sd, to_send,strlen (to_send),MSG_NOSIGNAL ); +/* NB: int because Windows APIs */ +ssize_t size =send (sd, to_send, (int )strlen (to_send),MSG_NOSIGNAL );if (size !=strlen (to_send)) {
@@ -172,6 +166,8 @@ goto cleanup; } +int len =0 ; +char buf[2 ];while (len <2 ) {char c;
@@ -419,8 +415,10 @@ buf[5 + len +1 ] = (char )(port &0xff ); { -const ssize_t size =send (sd, buf,5 + len +2 ,MSG_NOSIGNAL ); -if ((int )size !=5 + (int )len +2 ) +/* int because Windows APIs */ +int send_len =5 + (int )len +2 ; +const ssize_t size =send (sd, buf, send_len,MSG_NOSIGNAL ); +if (size != send_len) {msg (D_LINK_ERRORS |M_ERRNO ,"establish_socks_proxy_passthru: TCP port write failed on send()" );
@@ -443,10 +441,6 @@return ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void establish_socks_proxy_udpassoc(struct socks_proxy_info *p, socket_descriptor_t ctrl_sd, /* already open to proxy */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1262?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: I977bab08cb614c2d59c34ceebc112f3add9bd168
Gerrit-Change-Number: 1262
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1262?usp=email )
Change subject: socks: Fix conversion warnings with MinGW
......................................................................
socks: Fix conversion warnings with MinGW
The winsock2 APIs are a bit weird at times...
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1262
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59244802/
---
M src/openvpn/socks.c
1 file changed, 11 insertions(+), 17 deletions(-)
src/openvpn/socks.c +11 -17
@@ -80,11 +80,6 @@free (sp); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static bool socks_proxy_recv_char(char *c, const char *name, socket_descriptor_t sd, struct event_timeout *server_poll_timeout,
@@ -98,7 +93,8 @@ tv.tv_sec =get_server_poll_remaining_time (server_poll_timeout); tv.tv_usec =0 ; -const int status =select (sd +1 , &reads,NULL ,NULL , &tv); +/* NB: first argument ignored on Windows where socket_descriptor_t != int */ +const int status =select ((int )sd +1 , &reads,NULL ,NULL , &tv);get_signal (signal_received);if (*signal_received)
@@ -139,10 +135,7 @@ volatile int *signal_received) {char to_send[516 ]; -char buf[2 ]; -int len =0 ;struct user_pass creds; -ssize_t size;bool ret = false;CLEAR (creds);
@@ -161,9 +154,10 @@int sret =snprintf (to_send,sizeof (to_send),"\x01%c%s%c%s" , (int )strlen (creds.username), creds.username, (int )strlen (creds.password), creds.password); -ASSERT (sret <=sizeof (to_send)); +ASSERT (sret >=0 && sret <=sizeof (to_send)); - size =send (sd, to_send,strlen (to_send),MSG_NOSIGNAL ); +/* NB: int because Windows APIs */ +ssize_t size =send (sd, to_send, (int )strlen (to_send),MSG_NOSIGNAL );if (size !=strlen (to_send)) {
@@ -172,6 +166,8 @@ goto cleanup; } +int len =0 ; +char buf[2 ];while (len <2 ) {char c;
@@ -419,8 +415,10 @@ buf[5 + len +1 ] = (char )(port &0xff ); { -const ssize_t size =send (sd, buf,5 + len +2 ,MSG_NOSIGNAL ); -if ((int )size !=5 + (int )len +2 ) +/* int because Windows APIs */ +int send_len =5 + (int )len +2 ; +const ssize_t size =send (sd, buf, send_len,MSG_NOSIGNAL ); +if (size != send_len) {msg (D_LINK_ERRORS |M_ERRNO ,"establish_socks_proxy_passthru: TCP port write failed on send()" );
@@ -443,10 +441,6 @@return ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void establish_socks_proxy_udpassoc(struct socks_proxy_info *p, socket_descriptor_t ctrl_sd, /* already open to proxy */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1262?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: I977bab08cb614c2d59c34ceebc112f3add9bd168
Gerrit-Change-Number: 1262
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>