diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2025-02-27 16:55:14 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2025-02-28 01:32:33 +0100 |
commit | 39f85bce1a3b9da3bd11458c521e589f674e587a (patch) | |
tree | 6c38baf14daef74972c5bb2b7f0f74f821679653 | |
parent | 7b92f2e8525a94fb6f80d5e0bedba7eacc378714 (diff) | |
download | passt-39f85bce1a3b9da3bd11458c521e589f674e587a.tar passt-39f85bce1a3b9da3bd11458c521e589f674e587a.tar.gz passt-39f85bce1a3b9da3bd11458c521e589f674e587a.tar.bz2 passt-39f85bce1a3b9da3bd11458c521e589f674e587a.tar.lz passt-39f85bce1a3b9da3bd11458c521e589f674e587a.tar.xz passt-39f85bce1a3b9da3bd11458c521e589f674e587a.tar.zst passt-39f85bce1a3b9da3bd11458c521e589f674e587a.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.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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))) { |