From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=Rq6hvaeN; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 25D7F5A0622 for ; Tue, 18 Feb 2025 12:04:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1739876654; bh=uf9Zo38s5ZT5L3LoIHm3Ui5PA0dHmmJvMuOwFesgUMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rq6hvaeNfuli1D0G5nEfrjT4PHMtTesaAP2wO5dGM/gP8hQmpFZfiHbDeOxcdWGFF dz4VIlf7cPzfNPzKWAB2SP1xilRHCbWH7Fhc//W3qkxD9oc+rWp57rbHNO/uXI1aBW pCayv6FtvvGHjKuCGl34mAH/h67E2rDovZFqBkcS3T1X+swBl2TKSYYEGtfQ0oWuT0 h3M7qfFTprPo6FrYN2In83UEE35FfEXj4q/7fndTZyKoFgcusM3WQkixhAa6I6a3TW RW1GF7gHRvH6LVA958dzvoWntFgHFmKb/v6V4t4EweLbL6wzmDs5Aw8W3o8ptLNFU5 6EPxnS51dOZ3w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YxxVQ1h3Tz4wcm; Tue, 18 Feb 2025 22:04:14 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 1/4] tcp: More type safety for tcp_flow_migrate_target_ext() Date: Tue, 18 Feb 2025 19:59:21 +1100 Message-ID: <20250218085924.2627517-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250218085924.2627517-1-david@gibson.dropbear.id.au> References: <20250218085924.2627517-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: XI7MMXDYYTIFVOZKAV26VLK2FQPT4YDE X-Message-ID-Hash: XI7MMXDYYTIFVOZKAV26VLK2FQPT4YDE X-MailFrom: dgibson@gandalf.ozlabs.org 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: tcp_flow_migrate_target_ext() takes a raw union flow *, although it is TCP specific, and requires a FLOW_TYPE_TCP entry. Our usual convention is that such functions should take a struct tcp_tap_conn * instead. Convert it to do so. Signed-off-by: David Gibson --- flow.c | 2 +- tcp.c | 7 +++---- tcp_conn.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/flow.c b/flow.c index cc881e86..abe95b25 100644 --- a/flow.c +++ b/flow.c @@ -1106,7 +1106,7 @@ int flow_migrate_target(struct ctx *c, const struct migrate_stage *stage, repair_flush(c); for (i = 0; i < count; i++) { - rc = tcp_flow_migrate_target_ext(c, flowtab + i, fd); + rc = tcp_flow_migrate_target_ext(c, &flowtab[i].tcp, fd); if (rc) { debug("Migration data failure at flow %u: %s, abort", i, strerror_(-rc)); diff --git a/tcp.c b/tcp.c index 98e1c6a1..272e4cd5 100644 --- a/tcp.c +++ b/tcp.c @@ -3394,14 +3394,13 @@ int tcp_flow_migrate_target(struct ctx *c, int fd) /** * tcp_flow_migrate_target_ext() - Receive extended data for flow, set, connect * @c: Execution context - * @flow: Existing flow for this connection data + * @conn: Connection entry to complete with extra data * @fd: Descriptor for state migration * * Return: 0 on success, negative on fatal failure, but 0 on single flow failure */ -int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd) +int tcp_flow_migrate_target_ext(struct ctx *c, struct tcp_tap_conn *conn, int fd) { - struct tcp_tap_conn *conn = &flow->tcp; uint32_t peek_offset = conn->seq_to_tap - conn->seq_ack_from_tap; struct tcp_tap_transfer_ext t; int s = conn->sock, rc; @@ -3413,7 +3412,7 @@ int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd) } if (!t.tcpi_state) { /* Source wants us to skip this flow */ - flow_err(flow, "Dropping as requested by source"); + flow_err(conn, "Dropping as requested by source"); goto fail; } diff --git a/tcp_conn.h b/tcp_conn.h index 42dff481..53887c0e 100644 --- a/tcp_conn.h +++ b/tcp_conn.h @@ -239,7 +239,7 @@ int tcp_flow_migrate_source_ext(int fd, int fidx, const struct tcp_tap_conn *conn); int tcp_flow_migrate_target(struct ctx *c, int fd); -int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd); +int tcp_flow_migrate_target_ext(struct ctx *c, struct tcp_tap_conn *conn, int fd); bool tcp_flow_is_established(const struct tcp_tap_conn *conn); -- 2.48.1