Change in openvpn[master]: ps: Fix conversion warnings related to send/recv return values
A message that is not in the archive (sent off-list or not yet received): gerrit.1758036965000.Id070d1a45d45f9029309d23df7f3cab9ce792205@...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/+/1194?usp=email
to review the following change.
Change subject: ps: Fix conversion warnings related to send/recv return values
......................................................................
ps: Fix conversion warnings related to send/recv return values
We know that these values can't be big since they are limited to the size of the input buffer. So we can explicitly cast them to int if required.
---
M src/openvpn/ps.c
1 file changed, 9 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/1194/1
src/openvpn/ps.c +9 -18
@@ -475,11 +475,6 @@return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/* * This function runs in the context of the background proxy process. * Receive a control message from the parent (sent by the port_share_sendmsg
@@ -539,7 +534,7 @@if (status >=2 && command ==COMMAND_REDIRECT ) { - buf.len = status -1 ; + buf.len = (int )status -1 ;if (proxy_entry_new (list, es, server_addr, received_fd, &buf, journal_dir)) {CLEAR (buf);/* we gave the buffer to proxy_entry_new */
@@ -566,7 +561,7 @@ proxy_connection_io_recv(struct proxy_connection *pc) {/* recv data from socket */ -const int status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {return (errno ==EAGAIN ) ?IOSTAT_EAGAIN_ON_READ :IOSTAT_READ_ERROR ;
@@ -577,8 +572,8 @@ {return IOSTAT_READ_ERROR ; } -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %d" , (int )pc->sd, status); - pc->buf.len = status; +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %zd" , (int )pc->sd, status); + pc->buf.len = (int )status; }return IOSTAT_GOOD ; }
@@ -587,7 +582,7 @@ proxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent) { const socket_descriptor_t sd = pc->counterpart->sd; -const int status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {
@@ -596,17 +591,17 @@ }else { - *bytes_sent += status; + *bytes_sent += (int )status;if (status != pc->buf.len) { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%d" , (int )sd, +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%zd" , (int )sd, pc->buf.len, status); -buf_advance (&pc->buf, status); +buf_advance (&pc->buf, (int )status);return IOSTAT_EAGAIN_ON_WRITE ; }else { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %d" , (int )sd, status); +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %zd" , (int )sd, status); pc->buf.len =0 ; pc->buf.offset =0 ; }
@@ -797,10 +792,6 @@msg (M_INFO ,"PORT SHARE PROXY: proxy exiting" ); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -/* * Called from the main OpenVPN process to enable the port * share proxy.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205
Gerrit-Change-Number: 1194
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email )
Change subject: ps: Fix conversion warnings related to send/recv return values
......................................................................
Patch Set 7: Code-Review-1
(1 comment)
File src/openvpn/ps.c:
http://gerrit.openvpn.net/c/openvpn/+/1194/comment/3900c122_56818612 :
PS7, Line 575: dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: read[%d] %zd", (int)pc->sd, status);
I should probably fix this to use SOCKET_PRINTF at the same time...
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205
Gerrit-Change-Number: 1194
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Thu, 18 Sep 2025 14:03:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email )
Change subject: ps: Fix conversion warnings related to send/recv return values
......................................................................
Patch Set 7: -Code-Review
(1 comment)
File src/openvpn/ps.c:
http://gerrit.openvpn.net/c/openvpn/+/1194/comment/db9519f8_851d0944 :
PS7, Line 575: dmsg(D_PS_PROXY_DEBUG, "PORT SHARE PROXY: read[%d] %zd", (int)pc->sd, status);
Quoted 1 line
I should probably fix this to use
SOCKET_PRINTFat the same time...
Nvm, I looked into it, and that would be a change worthy of its own commit
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205
Gerrit-Change-Number: 1194
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Thu, 18 Sep 2025 14:45:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email )
Change subject: ps: Fix conversion warnings related to send/recv return values
......................................................................
Patch Set 7: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205
Gerrit-Change-Number: 1194
Gerrit-PatchSet: 7
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[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: Wed, 24 Sep 2025 08:21:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v7 1/1 ps: Fix conversion warnings related to send/recv return values
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
We know that these values can't be big since they are limited to the size of the input buffer. So we can explicitly cast them to int if required.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1194
---
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/+/1194
This mail reflects revision 7 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/ps.c +9 -18
@@ -475,11 +475,6 @@return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/* * This function runs in the context of the background proxy process. * Receive a control message from the parent (sent by the port_share_sendmsg
@@ -539,7 +534,7 @@if (status >=2 && command ==COMMAND_REDIRECT ) { - buf.len = status -1 ; + buf.len = (int )status -1 ;if (proxy_entry_new (list, es, server_addr, received_fd, &buf, journal_dir)) {CLEAR (buf);/* we gave the buffer to proxy_entry_new */
@@ -566,7 +561,7 @@ proxy_connection_io_recv(struct proxy_connection *pc) {/* recv data from socket */ -const int status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {return (errno ==EAGAIN ) ?IOSTAT_EAGAIN_ON_READ :IOSTAT_READ_ERROR ;
@@ -577,8 +572,8 @@ {return IOSTAT_READ_ERROR ; } -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %d" , (int )pc->sd, status); - pc->buf.len = status; +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %zd" , (int )pc->sd, status); + pc->buf.len = (int )status; }return IOSTAT_GOOD ; }
@@ -587,7 +582,7 @@ proxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent) { const socket_descriptor_t sd = pc->counterpart->sd; -const int status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {
@@ -596,17 +591,17 @@ }else { - *bytes_sent += status; + *bytes_sent += (int )status;if (status != pc->buf.len) { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%d" , (int )sd, +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%zd" , (int )sd, pc->buf.len, status); -buf_advance (&pc->buf, status); +buf_advance (&pc->buf, (int )status);return IOSTAT_EAGAIN_ON_WRITE ; }else { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %d" , (int )sd, status); +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %zd" , (int )sd, status); pc->buf.len =0 ; pc->buf.offset =0 ; }
@@ -797,10 +792,6 @@msg (M_INFO ,"PORT SHARE PROXY: proxy exiting" ); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -/* * Called from the main OpenVPN process to enable the port * share proxy.
[Openvpn-devel] [PATCH applied] Re: ps: Fix conversion warnings related to send/recv return values
.. and out goes the next #ifdef block.
Tested on the t_server testbed that has an HTTP port-share instance ("still works", and everything else as well).
Your patch has been applied to the master branch.
commit 26a4cd686275252fc27fa21deedc58a310e864d9
Author: Frank Lichtenheld Date: Wed Sep 24 10:21:15 2025 +0200
ps: Fix conversion warnings related to send/recv return values
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1194
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237926/
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#8) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: ps: Fix conversion warnings related to send/recv return values
......................................................................
ps: Fix conversion warnings related to send/recv return values
We know that these values can't be big since they are limited to the size of the input buffer. So we can explicitly cast them to int if required.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1194
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237926/
---
M src/openvpn/ps.c
1 file changed, 9 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/94/1194/8
src/openvpn/ps.c +9 -18
@@ -475,11 +475,6 @@return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/* * This function runs in the context of the background proxy process. * Receive a control message from the parent (sent by the port_share_sendmsg
@@ -539,7 +534,7 @@if (status >=2 && command ==COMMAND_REDIRECT ) { - buf.len = status -1 ; + buf.len = (int )status -1 ;if (proxy_entry_new (list, es, server_addr, received_fd, &buf, journal_dir)) {CLEAR (buf);/* we gave the buffer to proxy_entry_new */
@@ -566,7 +561,7 @@ proxy_connection_io_recv(struct proxy_connection *pc) {/* recv data from socket */ -const int status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {return (errno ==EAGAIN ) ?IOSTAT_EAGAIN_ON_READ :IOSTAT_READ_ERROR ;
@@ -577,8 +572,8 @@ {return IOSTAT_READ_ERROR ; } -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %d" , (int )pc->sd, status); - pc->buf.len = status; +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %zd" , (int )pc->sd, status); + pc->buf.len = (int )status; }return IOSTAT_GOOD ; }
@@ -587,7 +582,7 @@ proxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent) { const socket_descriptor_t sd = pc->counterpart->sd; -const int status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {
@@ -596,17 +591,17 @@ }else { - *bytes_sent += status; + *bytes_sent += (int )status;if (status != pc->buf.len) { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%d" , (int )sd, +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%zd" , (int )sd, pc->buf.len, status); -buf_advance (&pc->buf, status); +buf_advance (&pc->buf, (int )status);return IOSTAT_EAGAIN_ON_WRITE ; }else { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %d" , (int )sd, status); +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %zd" , (int )sd, status); pc->buf.len =0 ; pc->buf.offset =0 ; }
@@ -797,10 +792,6 @@msg (M_INFO ,"PORT SHARE PROXY: proxy exiting" ); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -/* * Called from the main OpenVPN process to enable the port * share proxy.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205
Gerrit-Change-Number: 1194
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email )
Change subject: ps: Fix conversion warnings related to send/recv return values
......................................................................
ps: Fix conversion warnings related to send/recv return values
We know that these values can't be big since they are limited to the size of the input buffer. So we can explicitly cast them to int if required.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1194
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59237926/
---
M src/openvpn/ps.c
1 file changed, 9 insertions(+), 18 deletions(-)
src/openvpn/ps.c +9 -18
@@ -475,11 +475,6 @@return true; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/* * This function runs in the context of the background proxy process. * Receive a control message from the parent (sent by the port_share_sendmsg
@@ -539,7 +534,7 @@if (status >=2 && command ==COMMAND_REDIRECT ) { - buf.len = status -1 ; + buf.len = (int )status -1 ;if (proxy_entry_new (list, es, server_addr, received_fd, &buf, journal_dir)) {CLEAR (buf);/* we gave the buffer to proxy_entry_new */
@@ -566,7 +561,7 @@ proxy_connection_io_recv(struct proxy_connection *pc) {/* recv data from socket */ -const int status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =recv (pc->sd,BPTR (&pc->buf),BCAP (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {return (errno ==EAGAIN ) ?IOSTAT_EAGAIN_ON_READ :IOSTAT_READ_ERROR ;
@@ -577,8 +572,8 @@ {return IOSTAT_READ_ERROR ; } -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %d" , (int )pc->sd, status); - pc->buf.len = status; +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: read[%d] %zd" , (int )pc->sd, status); + pc->buf.len = (int )status; }return IOSTAT_GOOD ; }
@@ -587,7 +582,7 @@ proxy_connection_io_send(struct proxy_connection *pc, int *bytes_sent) { const socket_descriptor_t sd = pc->counterpart->sd; -const int status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL ); +const ssize_t status =send (sd,BPTR (&pc->buf),BLEN (&pc->buf),MSG_NOSIGNAL );if (status <0 ) {
@@ -596,17 +591,17 @@ }else { - *bytes_sent += status; + *bytes_sent += (int )status;if (status != pc->buf.len) { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%d" , (int )sd, +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: partial write[%d], tried=%d got=%zd" , (int )sd, pc->buf.len, status); -buf_advance (&pc->buf, status); +buf_advance (&pc->buf, (int )status);return IOSTAT_EAGAIN_ON_WRITE ; }else { -dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %d" , (int )sd, status); +dmsg (D_PS_PROXY_DEBUG ,"PORT SHARE PROXY: wrote[%d] %zd" , (int )sd, status); pc->buf.len =0 ; pc->buf.offset =0 ; }
@@ -797,10 +792,6 @@msg (M_INFO ,"PORT SHARE PROXY: proxy exiting" ); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -/* * Called from the main OpenVPN process to enable the port * share proxy.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1194?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id070d1a45d45f9029309d23df7f3cab9ce792205
Gerrit-Change-Number: 1194
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged