Re: [PATCH] network: Check full BNEP UUID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi P-G,

On Wed, Aug 15, 2012, Par-Gunnar HJALMDAHL wrote:
> 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
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux