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=gHp1MXus; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 6899F5A0274 for ; Wed, 26 Feb 2025 07:04:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740549864; bh=nHguryTPpfRE2RX2qMb6y5UBcfGpxGe/O1Zqc1LLKgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gHp1MXusr93gK1C9ZtKMsLY2VplysoFc9EkKRIoQD64hByx67btpx7Oq7zPlx8sH3 Jez1d13h8Utgxs0YWG5mLFhCebGkdVlNUPQm80lEB3v3jTln9azYz2gb6ybtedNbFM WmZE7q7HI2RHd4BYyFI9H4OFbNL0r1nWmKyMq4Y8Aef6Jtop9i0yI16svUxtvvfxnJ 70bXIO6l857I0QTuWxHsLLdTMjSxuHW1WdmajZVsGcwtWcvTdYNTUUmHm3Jvryb2Il f3qcLN+vWL+yx9MNDV3AUieB49JPnxWW4EMKYLWwcxcCdERpJgHbcVBSAW7iSHEVuN GVK+VYM1lQxMA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Z2kSm3th1z4x21; Wed, 26 Feb 2025 17:04:24 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 2/3] migrate, flow: Don't attempt to migrate TCP flows without passt-repair Date: Wed, 26 Feb 2025 17:04:21 +1100 Message-ID: <20250226060422.48295-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250226060422.48295-1-david@gibson.dropbear.id.au> References: <20250226060422.48295-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: PXKSM73SANDKKJOZOJRKGFS23RWHCXFD X-Message-ID-Hash: PXKSM73SANDKKJOZOJRKGFS23RWHCXFD 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