From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 2A5445A061D; Fri, 07 Feb 2025 02:07:25 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH v11 8/9] fixup: Reset SO_PEEK_OFF value after incoming migration Date: Fri, 7 Feb 2025 02:07:23 +0100 Message-ID: <20250207010724.3121569-9-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250207010724.3121569-1-sbrivio@redhat.com> References: <20250207010724.3121569-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: LTXOXETJ427XZ5J77QBYNENSQ4LNXN23 X-Message-ID-Hash: LTXOXETJ427XZ5J77QBYNENSQ4LNXN23 X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: David Gibson TCP code needs to do different things depending on whether SO_PEEK_OFF is enabled on the socket, and it assumes it is already set if it is supported. However, we didn't re-enable it on sockets created for an incoming migration. Signed-off-by: David Gibson --- tcp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tcp.c b/tcp.c index f0d4a96..0f05011 100644 --- a/tcp.c +++ b/tcp.c @@ -3093,6 +3093,7 @@ int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd) { struct tcp_tap_conn *conn = &flow->tcp; struct tcp_tap_transfer_ext t; + uint32_t peek_offset; int s = conn->sock; if (read_all_buf(fd, &t, sizeof(t))) @@ -3121,5 +3122,9 @@ int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd) tcp_flow_repair_off(c, conn); + peek_offset = conn->seq_to_tap - conn->seq_ack_from_tap; + if (tcp_set_peek_offset(conn->sock, peek_offset)) + tcp_rst(c, conn); + return 0; } -- 2.43.0