summary refs log tree commit diff stats
path: root/nbd/common.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-02-10 18:41:11 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2016-02-16 17:16:28 +0100
commitf95910fe6bbf64bb9b5cea7546a1778ba96ce782 (patch)
treeca32a89428ee209e5de8c7da9f7c52139a91ef6b /nbd/common.c
parent69b49502d8b7b582af79fac5bef7b7ccc2dc9c1e (diff)
downloadfocaccia-qemu-f95910fe6bbf64bb9b5cea7546a1778ba96ce782.tar.gz
focaccia-qemu-f95910fe6bbf64bb9b5cea7546a1778ba96ce782.zip
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 <berrange@redhat.com>
Message-Id: <1455129674-17255-14-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd/common.c')
-rw-r--r--nbd/common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/nbd/common.c b/nbd/common.c
index 2b19c95099..bde673a04a 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);
+}