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=g2bxm6Xl; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id F07465A061C for ; Thu, 20 Feb 2025 07:04:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1740031446; bh=nHguryTPpfRE2RX2qMb6y5UBcfGpxGe/O1Zqc1LLKgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g2bxm6XlE8S3W2a6/UxRT6gYAaJb4xlfcI8D6uhmPN5fxYiB5JZg20rRRPTK7eo0t sfAt/xhMrOeir4mFki+NkdCM1eChyoULtVY4TcwOXP2zUO5/EaHSg/ObyYz1vzH4BY 2ehzXcaQasqMAOA1xHCxAxQKujRDBDhY9Uk6iBx8X/JHW382eZg58ckVoRBrZscnAd R9Xuwnx7le2Wp4Iu2cxg6y3q7QAhiYppC63IEUhBZdKzTr/vFW+RTmMI7JY1Eq6gi8 oWbzQMqXctCzobrxm1My6rySvyZFHsc/4ilhhi7QDbolHziEPTXfU2NkC5X6MUGiu1 fLUu1/npYbJcA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Yz2lB0dK5z4x3S; Thu, 20 Feb 2025 17:04:06 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 2/2] migrate, flow: Don't attempt to migrate TCP flows without passt-repair Date: Thu, 20 Feb 2025 17:03:18 +1100 Message-ID: <20250220060318.1796504-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250220060318.1796504-1-david@gibson.dropbear.id.au> References: <20250220060318.1796504-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 4KAWUUIWDN4E575GA7XRN5WUXCOVQALI X-Message-ID-Hash: 4KAWUUIWDN4E575GA7XRN5WUXCOVQALI 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