mgmtops: Pass UUID-128's in little endian format to the kernel
To be consistent with the rest of the management interface the UUIDs
should also be sent in little endian byte order.
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 3aca861..65b32e6 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -650,6 +650,7 @@
struct mgmt_hdr *hdr = (void *) buf;
struct mgmt_cp_add_uuid *cp = (void *) &buf[sizeof(*hdr)];
uuid_t uuid128;
+ uint128_t uint128;
DBG("index %d", index);
@@ -660,7 +661,9 @@
hdr->len = htobs(sizeof(*cp));
hdr->index = htobs(index);
- memcpy(cp->uuid, uuid128.value.uuid128.data, 16);
+ ntoh128((uint128_t *) uuid128.value.uuid128.data, &uint128);
+ htob128(&uint128, (uint128_t *) cp->uuid);
+
cp->svc_hint = svc_hint;
if (write(mgmt_sock, buf, sizeof(buf)) < 0)
@@ -675,6 +678,7 @@
struct mgmt_hdr *hdr = (void *) buf;
struct mgmt_cp_remove_uuid *cp = (void *) &buf[sizeof(*hdr)];
uuid_t uuid128;
+ uint128_t uint128;
DBG("index %d", index);
@@ -685,7 +689,8 @@
hdr->len = htobs(sizeof(*cp));
hdr->index = htobs(index);
- memcpy(cp->uuid, uuid128.value.uuid128.data, 16);
+ ntoh128((uint128_t *) uuid128.value.uuid128.data, &uint128);
+ htob128(&uint128, (uint128_t *) cp->uuid);
if (write(mgmt_sock, buf, sizeof(buf)) < 0)
return -errno;