aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-02-27 16:55:13 +1100
committerStefano Brivio <sbrivio@redhat.com>2025-02-28 01:32:21 +0100
commit7b92f2e8525a94fb6f80d5e0bedba7eacc378714 (patch)
tree63c57b259a79df1f0d70057cdd6e4024722cb56c
parent87471731e6bb0b5df3a50277527caf3381b45ee4 (diff)
downloadpasst-7b92f2e8525a94fb6f80d5e0bedba7eacc378714.tar
passt-7b92f2e8525a94fb6f80d5e0bedba7eacc378714.tar.gz
passt-7b92f2e8525a94fb6f80d5e0bedba7eacc378714.tar.bz2
passt-7b92f2e8525a94fb6f80d5e0bedba7eacc378714.tar.lz
passt-7b92f2e8525a94fb6f80d5e0bedba7eacc378714.tar.xz
passt-7b92f2e8525a94fb6f80d5e0bedba7eacc378714.tar.zst
passt-7b92f2e8525a94fb6f80d5e0bedba7eacc378714.zip
migrate, flow: Trivially succeed if migrating with no flows
We could get a migration request when we have no active flows; or at least none that we need or are able to migrate. In this case after sending or receiving the number of flows we continue to step through various lists. In the target case, this could include communication with passt-repair. If passt-repair wasn't started that could cause further errors, but of course they shouldn't matter if we have nothing to repair. Make it more obvious that there's nothing to do and avoid such errors by short-circuiting flow_migrate_{source,target}() if there are no migratable flows. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--flow.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/flow.c b/flow.c
index bb5dcc3..6cf96c2 100644
--- a/flow.c
+++ b/flow.c
@@ -999,6 +999,9 @@ int flow_migrate_source(struct ctx *c, const struct migrate_stage *stage,
debug("Sending %u flows", ntohl(count));
+ if (!count)
+ return 0;
+
/* Dump and send information that can be stored in the flow table.
*
* Limited rollback options here: if we fail to transfer any data (that
@@ -1070,6 +1073,9 @@ int flow_migrate_target(struct ctx *c, const struct migrate_stage *stage,
count = ntohl(count);
debug("Receiving %u flows", count);
+ if (!count)
+ return 0;
+
if ((rc = flow_migrate_repair_all(c, true)))
return -rc;