summary refs log tree commit diff stats
path: root/migration/tls.c
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@suse.de>2025-02-05 13:17:22 -0300
committerFabiano Rosas <farosas@suse.de>2025-02-14 15:19:04 -0300
commit48796f6b44df1dd0f78d18757889d5ac478c33e4 (patch)
treeebf5445e92db58f6f842eb3ac446e007a4e84eff /migration/tls.c
parent322d873b634dc515220f154e29626a33f528bbfb (diff)
downloadfocaccia-qemu-48796f6b44df1dd0f78d18757889d5ac478c33e4.tar.gz
focaccia-qemu-48796f6b44df1dd0f78d18757889d5ac478c33e4.zip
migration/multifd: Terminate the TLS connection
The multifd recv side has been getting a TLS error of
GNUTLS_E_PREMATURE_TERMINATION at the end of migration when the send
side closes the sockets without ending the TLS session. This has been
masked by the code not checking the migration error after loadvm.

Start ending the TLS session at multifd_send_shutdown() so the recv
side always sees a clean termination (EOF) and we can start to
differentiate that from an actual premature termination that might
possibly happen in the middle of the migration.

There's nothing to be done if a previous migration error has already
broken the connection, so add a comment explaining it and ignore any
errors coming from gnutls_bye().

This doesn't break compat with older recv-side QEMUs because EOF has
always caused the recv thread to exit cleanly.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Diffstat (limited to 'migration/tls.c')
-rw-r--r--migration/tls.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/migration/tls.c b/migration/tls.c
index fa03d9136c..5cbf952383 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -156,6 +156,11 @@ void migration_tls_channel_connect(MigrationState *s,
                               NULL);
 }
 
+void migration_tls_channel_end(QIOChannel *ioc, Error **errp)
+{
+    qio_channel_tls_bye(QIO_CHANNEL_TLS(ioc), errp);
+}
+
 bool migrate_channel_requires_tls_upgrade(QIOChannel *ioc)
 {
     if (!migrate_tls()) {