*/
#include "qemu/osdep.h"
-#include "migration/migration.h"
+#include "channel.h"
+#include "migration.h"
+#include "tls.h"
#include "io/channel-tls.h"
#include "crypto/tlscreds.h"
#include "qemu/error-report.h"
}
-static void migration_tls_incoming_handshake(Object *src,
- Error *err,
+static void migration_tls_incoming_handshake(QIOTask *task,
gpointer opaque)
{
- QIOChannel *ioc = QIO_CHANNEL(src);
+ QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
+ Error *err = NULL;
- if (err) {
+ if (qio_task_propagate_error(task, &err)) {
trace_migration_tls_incoming_handshake_error(error_get_pretty(err));
- error_report("%s", error_get_pretty(err));
+ error_report_err(err);
} else {
trace_migration_tls_incoming_handshake_complete();
- migration_channel_process_incoming(migrate_get_current(), ioc);
+ migration_channel_process_incoming(ioc);
}
object_unref(OBJECT(ioc));
}
tioc = qio_channel_tls_new_server(
ioc, creds,
- NULL, /* XXX pass ACL name */
+ s->parameters.tls_authz,
errp);
if (!tioc) {
return;
qio_channel_tls_handshake(tioc,
migration_tls_incoming_handshake,
NULL,
+ NULL,
NULL);
}
-static void migration_tls_outgoing_handshake(Object *src,
- Error *err,
+static void migration_tls_outgoing_handshake(QIOTask *task,
gpointer opaque)
{
MigrationState *s = opaque;
- QIOChannel *ioc = QIO_CHANNEL(src);
+ QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
+ Error *err = NULL;
- if (err) {
+ if (qio_task_propagate_error(task, &err)) {
trace_migration_tls_outgoing_handshake_error(error_get_pretty(err));
- s->to_dst_file = NULL;
- migrate_fd_error(s, err);
} else {
trace_migration_tls_outgoing_handshake_complete();
- migration_channel_connect(s, ioc, NULL);
}
+ migration_channel_connect(s, ioc, NULL, err);
object_unref(OBJECT(ioc));
}
return;
}
- if (s->parameters.tls_hostname) {
+ if (s->parameters.tls_hostname && *s->parameters.tls_hostname) {
hostname = s->parameters.tls_hostname;
}
if (!hostname) {
qio_channel_tls_handshake(tioc,
migration_tls_outgoing_handshake,
s,
+ NULL,
NULL);
}