From: "cron2 (Code Review)" Date: Thu, 19 Sep 2024 06:15:42 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <20a2c28a488f0fe3db894d7fc411e2cad2b72727-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="80AES1Dlcr4="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: socket: Change return types of link_socket_write* to ssize_t List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --80AES1Dlcr4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/74= 0?usp=3Demail ) Change subject: socket: Change return types of link_socket_write* to ssize_t ...................................................................... socket: Change return types of link_socket_write* to ssize_t This is the actual return value of send/sendto/sendmsg. We will leave it to the single caller of link_socket_write() to decide how to map that to the int buffer world. For now just cast it explicitly. Change-Id: I7852c06d331326c1dbab7b642254c0c00d4cebb8 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20240918204844.2820-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29= 323.html Signed-off-by: Gert Doering --- M src/openvpn/forward.c M src/openvpn/socket.c M src/openvpn/socket.h 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 374ba47..8c02407 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1792,7 +1792,7 @@ socks_preprocess_outgoing_link(c, &to_addr, &size_delta); /* Send packet */ - size =3D link_socket_write(c->c2.link_socket, &c->c2.to_li= nk, to_addr); + size =3D (int)link_socket_write(c->c2.link_socket, &c->c2.= to_link, to_addr); /* Undo effect of prepend */ link_socket_write_post_size_adjust(&size, size_delta, &c->= c2.to_link); diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 17c5e76..6c790a0 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3399,7 +3399,7 @@ * Socket Write Routines */ -int +ssize_t link_socket_write_tcp(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -3418,7 +3418,7 @@ #if ENABLE_IP_PKTINFO -size_t +ssize_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index 47083ad..bbdabfb 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -1099,9 +1099,9 @@ * Socket Write routines */ -int link_socket_write_tcp(struct link_socket *sock, - struct buffer *buf, - struct link_socket_actual *to); +ssize_t link_socket_write_tcp(struct link_socket *sock, + struct buffer *buf, + struct link_socket_actual *to); #ifdef _WIN32 @@ -1135,12 +1135,12 @@ #else /* ifdef _WIN32 */ -size_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock, - struct buffer *buf, - struct link_socket_actual *to); +ssize_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock, + struct buffer *buf, + struct link_socket_actual *to); -static inline size_t +static inline ssize_t link_socket_write_udp_posix(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -1158,7 +1158,7 @@ (socklen_t) af_addr_size(to->dest.addr.sa.sa_family)); } -static inline size_t +static inline ssize_t link_socket_write_tcp_posix(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -1168,7 +1168,7 @@ #endif /* ifdef _WIN32 */ -static inline size_t +static inline ssize_t link_socket_write_udp(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) @@ -1181,7 +1181,7 @@ } /* write a TCP or UDP packet to link */ -static inline int +static inline ssize_t link_socket_write(struct link_socket *sock, struct buffer *buf, struct link_socket_actual *to) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/740?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: I7852c06d331326c1dbab7b642254c0c00d4cebb8 Gerrit-Change-Number: 740 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --80AES1Dlcr4= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

socket: Change return types of link_socket_wri=
te* to ssize_t

This is the actual return value of send/sendto/sendms= g.
We will leave it to the single caller of link_socket_write()
to de= cide how to map that to the int buffer world. For now
just cast it expli= citly.

Change-Id: I7852c06d331326c1dbab7b642254c0c00d4cebb8
Signe= d-off-by: Frank Lichtenheld <frank@...2641...>
Acked-by: Gert Doer= ing <gert@...1296...>
Message-Id: <20240918204844.2820-1-gert@...220...= ..1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1439...= ceforge.net/msg29323.html
Signed-off-by: Gert Doering <gert@...2132...= .>
---
M src/openvpn/forward.c
M src/openvpn/socket.c
M src/= openvpn/socket.h
3 files changed, 13 insertions(+), 13 deletions(-)
<= br>
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 374ba47..8c02407 100644
--- a/src/openvpn/forward.= c
+++ b/src/openvpn/forward.c
@@ -1792,7 +1= 792,7 @@
socks_preprocess_outgoing_link(c,= &to_addr, &size_delta);

= /* Send packet */
- size =3D link_socket_write(c->c2.link_socket, &= c->c2.to_link, to_addr);
+ size =3D (int)link_socket_write(c->c2.link_socke= t, &c->c2.to_link, to_addr);

= /* Undo effect of prepend */
l= ink_socket_write_post_size_adjust(&size, size_delta, &c->c2.to_l= ink);
diff --git a/src/openvpn/socket.c b/src/openvpn/socke= t.c
index 17c5e76..6c790a0 100644
--- a/src= /openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -3399,7 +3399,7 @@
* Socket Write Routines */

-int
+ssize_t<= /span>
link_socket_write_tcp(struct link_socket *sock,
= struct buffer *buf,
= struct link_socket_actual *to)
@@ -3418,7 +341= 8,7 @@

#if ENABLE_IP_PKTINFO
<= span>

-size_t+ssize_t
lin= k_socket_write_udp_posix_sendmsg(struct link_socket *sock,
= struct buffer *buf,
= struct link_socket_actual *to)diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h
<= span>index 47083ad..bbdabfb 100644
--- a/src/openvpn/socket= .h
+++ b/src/openvpn/socket.h
@@ -1099,9 +1= 099,9 @@
* Socket Write routines
*/


-int lin= k_socket_write_tcp(struct link_socket *sock,
- struct buffer *buf,=
- st= ruct link_socket_actual *to);
+ssize_t link_socket_write_tcp(struct link_socket *sock,+ = struct buffer *buf,
= + struct link_socket_actual *to);

#ifdef _WIN32

@@ -= 1135,12 +1135,12 @@

#else /* ifdef _WIN= 32 */

-size_t link_socket_write_udp_posix_sendmsg(struct link_socket *sock,
- = struct buffer *buf,
- struct link_socke= t_actual *to);
+ssize= _t link_socket_write_udp_posix_sendmsg(struct link_socket *sock,
= + = struct buffer *buf,
+ struct link_socke= t_actual *to);


-static inline size_t
+static inline ssize_t
link_s= ocket_write_udp_posix(struct link_socket *sock,
= struct buffer *buf,
= struct link_socket_actual *to)
@@ -1158,7 +1158,7 @= @
(socklen_t) af_addr_size(to->dest.a= ddr.sa.sa_family));
}

-static inline size_t
+static inline ssize_t
= link_socket_write_tcp_posix(struct link_socket *sock,
= struct buffer *buf,
= struct link_socket_actual *to)
@@ -1168,7 +11= 68,7 @@

#endif /* ifdef _WIN32 */=

-static inl= ine size_t
+static in= line ssize_t
link_socket_write_udp(struct link_socket *soc= k,
struct buffer *buf,
struct link_socket_actual *to)

@@= -1181,7 +1181,7 @@
}

/= * write a TCP or UDP packet to link */
-static inline int
+static inline ssize_t
link_socket_write(str= uct link_socket *sock,
struct buffer *bu= f,
struct link_socket_actual *to)=

To view, visit change 740. To unsubscribe, or for = help writing mail filters, visit settings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7852c06d331326c1dbab7b64225= 4c0c00d4cebb8
Gerrit-Change-Number: 740
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>
Gerrit-MessageType: merged
--80AES1Dlcr4=--