From: Varka Bhadram <varkabhadram@gmail.com>
To: Alexander Aring <alex.aring@gmail.com>, linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de
Subject: Re: [PATCH bluetooth-next 11/18] ieee802154: add ieee802154_random_extended_addr
Date: Thu, 06 Nov 2014 07:24:37 +0530 [thread overview]
Message-ID: <545AD4DD.9030101@gmail.com> (raw)
In-Reply-To: <1415217089-24919-12-git-send-email-alex.aring@gmail.com>
Hi Alex,
I have few doubts on this patch.
On Thursday 06 November 2014 01:21 AM, Alexander Aring wrote:
> This patch adds a new function to generate a random IEEE 802.15.4
> extended address.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> include/linux/ieee802154.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
> index a907fe5..d043449 100644
> --- a/include/linux/ieee802154.h
> +++ b/include/linux/ieee802154.h
> @@ -24,6 +24,7 @@
> #define LINUX_IEEE802154_H
>
> #include <linux/types.h>
> +#include <linux/random.h>
> #include <asm/byteorder.h>
>
> #define IEEE802154_MTU 127
> @@ -215,4 +216,17 @@ static inline bool ieee802154_is_valid_extended_addr(const __le64 addr)
> (addr != cpu_to_le64(0xffffffffffffffffULL)));
> }
>
> +/**
> + * ieee802154_random_extended_addr - generates a random extended address
> + * @addr: extended addr pointer to place the random address
> + */
> +static inline void ieee802154_random_extended_addr(__le64 *addr)
First of all why do we need this functionality. Extended address will be configured by the
user by using iz ..?
> +{
> + get_random_bytes(addr, IEEE802154_EXTENDED_ADDR_LEN);
> +
Here we are getting random bytes of 8.
> + /* toggle some bit if we hit an invalid extended addr */
> + if (!ieee802154_is_valid_extended_addr(*addr))
> + ((u8 *)addr)[IEEE802154_EXTENDED_ADDR_LEN - 1] ^= 0x01;
If those 8 bytes not a valid addr, then you are toggling last bit, Why..?
> +}
> +
> #endif /* LINUX_IEEE802154_H */
>
--
Thanks and Regards,
Varka Bhadram.
next prev parent reply other threads:[~2014-11-06 1:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 19:51 [PATCH bluetooth-next 00/18] ieee802154: interface registration and perm address support Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 01/18] ieee802154: rework wpan_phy index assignment Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 02/18] ieee802154: remove nl802154 unused functions Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 03/18] mac802154: move interface del handling in iface Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 04/18] mac802154: move interface add " Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 05/18] mac802154: move dev_hold out of ieee802154_if_add Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 06/18] ieee802154: rework interface registration Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 07/18] ieee802154: remove mlme get_phy callback Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 08/18] mac802154: add default interface registration Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 09/18] mac802154: add ieee802154_vif struct Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 10/18] ieee802154: add IEEE802154_EXTENDED_ADDR_LEN Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 11/18] ieee802154: add ieee802154_random_extended_addr Alexander Aring
2014-11-06 1:54 ` Varka Bhadram [this message]
2014-11-06 10:03 ` Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 12/18] mac802154: add ieee802154_le64_to_be64 Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 13/18] mac802154: cleanup ieee802154_netdev_to_extended_addr Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 14/18] mac802154: add support for perm_extended_addr Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 15/18] at86rf230: generate random perm extended address Alexander Aring
2014-11-06 5:52 ` Varka Bhadram
2014-11-06 10:05 ` Alexander Aring
2014-12-12 14:56 ` Alexander Aring
[not found] ` <CAEUmHya_1iG9Rs-Wq+bq8MT2rwjgG_zUvr8wB-zTLnSCyj-StA@mail.gmail.com>
2014-12-13 9:08 ` Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 16/18] at86rf230: add force slotted operation bit Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 17/18] mac802154: use IEEE802154_EXTENDED_ADDR_LEN Alexander Aring
2014-11-05 19:51 ` [PATCH bluetooth-next 18/18] mac802154: fix typo promisuous to promiscuous Alexander Aring
2014-11-05 20:54 ` [PATCH bluetooth-next 00/18] ieee802154: interface registration and perm address support Marcel Holtmann
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=545AD4DD.9030101@gmail.com \
--to=varkabhadram@gmail.com \
--cc=alex.aring@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-wpan@vger.kernel.org \
/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).