[Libguestfs] [PATCH nbdkit 0/4] Reflection plugin, peer name.
Richard W.M. Jones
rjones at redhat.com
Sun Sep 15 15:04:36 UTC 2019
On Sun, Sep 15, 2019 at 03:55:41PM +0100, Richard W.M. Jones wrote:
> - Plugins could change content based on client. (The fourth patch in
> the series is a PoC of this implemented in the new reflection
> plugin.) Be cautious about combining this feature with multi-conn
> as it's not obviously always safe to do.
Given this commit, I guess we should squash in the following to the
4th patch:
diff --git a/plugins/reflection/reflection.c b/plugins/reflection/reflection.c
index a0d7c60..f765557 100644
--- a/plugins/reflection/reflection.c
+++ b/plugins/reflection/reflection.c
@@ -303,11 +303,22 @@ reflection_get_size (void *handle)
return (int64_t) h->len;
}
-/* Read-only plugin so multi-conn is safe. */
static int
reflection_can_multi_conn (void *handle)
{
- return 1;
+ switch (mode) {
+ /* Safe for exportname modes since clients should only request
+ * multi-conn with the same export name.
+ */
+ case MODE_EXPORTNAME:
+ case MODE_BASE64EXPORTNAME:
+ return 1;
+ /* Unsafe for mode=address because all multi-conn connections
+ * won't necessarily originate from the same client address.
+ */
+ case MODE_ADDRESS:
+ return 0;
+ }
}
/* Cache. */
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list