aboutgitcodebugslistschat
path: root/tcp_splice.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-06-27 00:55:07 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-07-02 21:33:57 +0200
commit403a7c14a000a239b758c6495dd053377f751be7 (patch)
tree5ec7cdf054b6b9f4ef6971710b786a855c15489e /tcp_splice.c
parent21ee1eb2de40c8377de22a9ff7e65663f245a61c (diff)
downloadpasst-403a7c14a000a239b758c6495dd053377f751be7.tar
passt-403a7c14a000a239b758c6495dd053377f751be7.tar.gz
passt-403a7c14a000a239b758c6495dd053377f751be7.tar.bz2
passt-403a7c14a000a239b758c6495dd053377f751be7.tar.lz
passt-403a7c14a000a239b758c6495dd053377f751be7.tar.xz
passt-403a7c14a000a239b758c6495dd053377f751be7.tar.zst
passt-403a7c14a000a239b758c6495dd053377f751be7.zip
tcp_splice: Check return value of setsockopt() for SO_RCVLOWAT
Spotted by Coverity, harmless as we would consider that successful and check on the socket later from the timer, but printing a debug message in that case is definitely wise, should it ever happen. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tcp_splice.c')
-rw-r--r--tcp_splice.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tcp_splice.c b/tcp_splice.c
index 5a406c6..f2d4fc6 100644
--- a/tcp_splice.c
+++ b/tcp_splice.c
@@ -598,11 +598,16 @@ eintr:
readlen > (long)c->tcp.pipe_size / 10) {
int lowat = c->tcp.pipe_size / 4;
- setsockopt(conn->s[fromside], SOL_SOCKET,
- SO_RCVLOWAT, &lowat, sizeof(lowat));
-
- conn_flag(c, conn, lowat_set_flag);
- conn_flag(c, conn, lowat_act_flag);
+ if (setsockopt(conn->s[fromside], SOL_SOCKET,
+ SO_RCVLOWAT,
+ &lowat, sizeof(lowat))) {
+ flow_trace(conn,
+ "Setting SO_RCVLOWAT %i: %s",
+ lowat, strerror(errno));
+ } else {
+ conn_flag(c, conn, lowat_set_flag);
+ conn_flag(c, conn, lowat_act_flag);
+ }
}
break;