From a09aeb4bd600fcb92d0341fd51858e6cee0bbea4 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 24 Jul 2024 13:31:09 +1000 Subject: tcp: Correctly update SO_PEEK_OFF when tcp_send_frames() drops frames When using the new SO_PEEK_OFF feature on TCP sockets, we must adjust the SO_PEEK_OFF value whenever we move conn->seq_to_tap backwards. Although it was discussed during development, somewhere during the shuffles the case where we move the pointer backwards because we lost frames while sending them to the guest. This can happen, for example, if the socket buffer on the Unix socket to qemu overflows. Fixing this is slightly complicated because we need to pass a non-const context pointer to some places we previously didn't need it. While we're there also fix a small stylistic issue in the function comment for tcp_revert_seq() - it was using spaces instead of tabs. Fixes: e63d281871ef ("tcp: leverage support of SO_PEEK_OFF socket option when available") Signed-off-by: David Gibson Reviewed-by: Stefano Brivio --- tcp_buf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tcp_buf.h') diff --git a/tcp_buf.h b/tcp_buf.h index 14be7b9..3db4c56 100644 --- a/tcp_buf.h +++ b/tcp_buf.h @@ -9,7 +9,7 @@ void tcp_sock4_iov_init(const struct ctx *c); void tcp_sock6_iov_init(const struct ctx *c); void tcp_flags_flush(const struct ctx *c); -void tcp_payload_flush(const struct ctx *c); +void tcp_payload_flush(struct ctx *c); int tcp_buf_data_from_sock(struct ctx *c, struct tcp_tap_conn *conn); int tcp_buf_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags); -- cgit v1.2.3