aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-02-27 16:55:14 +1100
committerDavid Gibson <david@gibson.dropbear.id.au>2025-04-02 14:32:10 +1100
commit83f95ade5bd97b465240c82f45669bfe3ce259f8 (patch)
tree289d812ffa757178aa46ad84f7a0b2710397a91c
parent2aa1b789b437fd92b314c8a5adcef827d6499951 (diff)
downloadpasst-83f95ade5bd97b465240c82f45669bfe3ce259f8.tar
passt-83f95ade5bd97b465240c82f45669bfe3ce259f8.tar.gz
passt-83f95ade5bd97b465240c82f45669bfe3ce259f8.tar.bz2
passt-83f95ade5bd97b465240c82f45669bfe3ce259f8.tar.lz
passt-83f95ade5bd97b465240c82f45669bfe3ce259f8.tar.xz
passt-83f95ade5bd97b465240c82f45669bfe3ce259f8.tar.zst
passt-83f95ade5bd97b465240c82f45669bfe3ce259f8.zip
migrate, flow: Don't attempt to migrate TCP flows without passt-repair
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 <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--flow.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/flow.c b/flow.c
index b187dff..4d611f5 100644
--- a/flow.c
+++ b/flow.c
@@ -943,6 +943,10 @@ static int flow_migrate_repair_all(struct ctx *c, bool enable)
unsigned i;
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(i, flow, FLOW_MAX) {
if (enable)
rc = tcp_flow_repair_on(c, &flow->tcp);
@@ -1007,8 +1011,11 @@ int flow_migrate_source(struct ctx *c, const struct migrate_stage *stage,
(void)c;
(void)stage;
- foreach_established_tcp_flow(i, flow, FLOW_MAX)
- count++;
+ /* If we don't have a repair helper, we can't migrate TCP flows */
+ if (c->fd_repair >= 0) {
+ foreach_established_tcp_flow(i, flow, FLOW_MAX)
+ count++;
+ }
count = htonl(count);
if (write_all_buf(fd, &count, sizeof(count))) {