linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Par-Gunnar HJALMDAHL <par-gunnar.hjalmdahl@stericsson.com>
Cc: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	Anurag GUPTA-1 <anurag.gupta@stericsson.com>
Subject: Re: [PATCH] network: Check full BNEP UUID
Date: Wed, 15 Aug 2012 15:40:30 +0300	[thread overview]
Message-ID: <20120815124030.GA2498@x220> (raw)
In-Reply-To: <81C3A93C17462B4BBD7E272753C1057923B924CB0D@EXDCVYMBSTM005.EQ1STM.local>

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

  reply	other threads:[~2012-08-15 12:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27  9:06 [PATCH] network: Check full BNEP UUID Par-Gunnar Hjalmdahl
2012-08-15 10:39 ` Johan Hedberg
2012-08-15 11:17   ` Par-Gunnar HJALMDAHL
2012-08-15 12:40     ` Johan Hedberg [this message]
2012-08-15 12:45       ` Par-Gunnar HJALMDAHL

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120815124030.GA2498@x220 \
    --to=johan.hedberg@gmail.com \
    --cc=anurag.gupta@stericsson.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=par-gunnar.hjalmdahl@stericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).