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=KOVVAESX; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id A4FCD5A061D for ; Tue, 25 Feb 2025 06:51:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740462693; bh=nHguryTPpfRE2RX2qMb6y5UBcfGpxGe/O1Zqc1LLKgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOVVAESXUJwBPYahFaiFMOhbpvWHhidVaqQUeiEu4ClUy47p70WNrP+wotDeThw4D /uMz6KeO+si9gqvTMurh2asAWMmDn5jPA1CC/nf8VE0gTlvWwfFOashhsONr6tz+HQ zJoyK6bZjyyNqM5q45eS/342J0pX2UjnWi7WY13QQ/x1/rgO4Evx8TMJHgdazQkKtN zGIcFNQXu6pG8WmI6VHIaLi2NBxls34M6W6uy5pgZBhb/GJTTMIRqt+cy8q+JBpmFR v3iN7rHaBc3adbccTOIycu5idaeg8uJgMplr0btH2eGiNH+XhKtdSYyU+GIMMXAfBf 0EATyxieIblMQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Z26DP5xLMz4wyh; Tue, 25 Feb 2025 16:51:33 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 2/2] migrate, flow: Don't attempt to migrate TCP flows without passt-repair Date: Tue, 25 Feb 2025 16:51:32 +1100 Message-ID: <20250225055132.3677190-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250225055132.3677190-1-david@gibson.dropbear.id.au> References: <20250225055132.3677190-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: II7R2WYJSCDF4KWDI4YKVK3SO3HQ5Y5W X-Message-ID-Hash: II7R2WYJSCDF4KWDI4YKVK3SO3HQ5Y5W 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: Migrating TCP flows requires passt-repair in order to use TCP_REPAIR. If passt-repair is not started, our failure mode is pretty ugly though: we'll attempt the migration, hitting various problems when we can't enter repair mode. In some cases we may not roll back these changes properly, meaning we break network connections on the source. Our general approach is not to completely block migration if there are problems, but simply to break any flows we can't migrate. So, if we have no connection from passt-repair carry on with the migration, but don't attempt to migrate any TCP connections. Signed-off-by: David Gibson --- flow.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/flow.c b/flow.c index 6cf96c26..749c4984 100644 --- a/flow.c +++ b/flow.c @@ -923,6 +923,10 @@ static int flow_migrate_repair_all(struct ctx *c, bool enable) union flow *flow; int rc; + /* If we don't have a repair helper, there's nothing we can do */ + if (c->fd_repair < 0) + return 0; + foreach_established_tcp_flow(flow) { if (enable) rc = tcp_flow_repair_on(c, &flow->tcp); @@ -987,8 +991,11 @@ int flow_migrate_source(struct ctx *c, const struct migrate_stage *stage, (void)c; (void)stage; - foreach_established_tcp_flow(flow) - count++; + /* If we don't have a repair helper, we can't migrate TCP flows */ + if (c->fd_repair >= 0) { + foreach_established_tcp_flow(flow) + count++; + } count = htonl(count); if (write_all_buf(fd, &count, sizeof(count))) { -- 2.48.1