From d97cea1477a7f37c81735678c2907b7eb0e26597 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 28 Mar 2011 13:59:44 +0300 Subject: [PATCH] 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. --- plugins/mgmtops.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c index 3aca861ac..65b32e6e0 100644 --- a/plugins/mgmtops.c +++ b/plugins/mgmtops.c @@ -650,6 +650,7 @@ static int mgmt_add_uuid(int index, uuid_t *uuid, uint8_t svc_hint) 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 @@ static int mgmt_add_uuid(int index, uuid_t *uuid, uint8_t svc_hint) 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 @@ static int mgmt_remove_uuid(int index, uuid_t *uuid) 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 @@ static int mgmt_remove_uuid(int index, uuid_t *uuid) 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; -- 2.47.3