Thread (5 messages) 5 messages, 2 authors, 2012-08-15

RE: [PATCH] network: Check full BNEP UUID

From: Par-Gunnar HJALMDAHL <hidden>
Date: 2012-08-15 12:45:08

Hi Johan,
-----Original Message-----
From: Johan Hedberg [mailto:johan.hedberg@gmail.com]
Sent: den 15 augusti 2012 14:41
To: Par-Gunnar HJALMDAHL
Cc: linux-bluetooth@vger.kernel.org; Anurag GUPTA-1
Subject: Re: [PATCH] network: Check full BNEP UUID

Hi P-G,

On Wed, Aug 15, 2012, Par-Gunnar HJALMDAHL wrote:
quoted
Basically I tried to keep the patch to a minimum since it was quite a
simple issue to fix.

I have no problems to use the UUID in lib/uuid.c. I could add a 2 new
exported functions for retrieving base UUID, one for little endian
and
quoted
one for big endian, since uuid.c endian depends on CPU endian while
PAN endian is always big endian. So:
void get_le_bt_base_uuid(uint128_t *uuid);
void get_be_bt_base_uuid(uint128_t *uuid);
Note that the uuid.{c,h} name space is bt_uuid_*

So far uuid.c has been fully hiding any endianness issues in its public
API by only talking host-endianness. So, if this was to be really done
in a clean way I'd say the calling code should look like:

	uint128_t u128;
	bt_uuid_t uuid;

	u128 = bt_get_be128(dest);

	bt_uuid128_create(&uuid, u128);
	if (!bt_uuid_is_bluetooth(&uuid))
		return BNEP_CONN_INVALID_DST;

	/* same for source */

However, as this would require at least two new functions
(bt_get_be128() in lib/bluetooth.h and bt_uuid_is_bluetooth() in
lib/uuid.c) and like you say the use case is quite trivial, I think
this
might be a bit overkill.

So, since you were fine with my alteration of your patch I think I'll
just go ahead and push it upstream. If you still want to add the
necessary APIs for the "truly clean" approach, feel free, but I won't
be
bugging you about it ;)

Johan
Yes, I'm fine with your suggested patch as-is.
It's OK to just push it. :-)

/P-G
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help