From f95910fe6bbf64bb9b5cea7546a1778ba96ce782 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 10 Feb 2016 18:41:11 +0000 Subject: nbd: implement TLS support in the protocol negotiation This extends the NBD protocol handling code so that it is capable of negotiating TLS support during the connection setup. This involves requesting the STARTTLS protocol option before any other NBD options. Signed-off-by: Daniel P. Berrange Message-Id: <1455129674-17255-14-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- nbd/common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'nbd/common.c') diff --git a/nbd/common.c b/nbd/common.c index 2b19c95..bde673a 100644 --- a/nbd/common.c +++ b/nbd/common.c @@ -75,3 +75,18 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc, g_free(local_iov_head); return done; } + + +void nbd_tls_handshake(Object *src, + Error *err, + void *opaque) +{ + struct NBDTLSHandshakeData *data = opaque; + + if (err) { + TRACE("TLS failed %s", error_get_pretty(err)); + data->error = error_copy(err); + } + data->complete = true; + g_main_loop_quit(data->loop); +} -- cgit v1.1