Hi Tony,

On Mon, Mar 25, 2013 at 11:59:25PM -0400, Tony Cheneau wrote:
> The IEEE 802.15.4 standard uses the 0xFFFF short address (2 bytes) for message
> broadcasting.
> 
> Signed-off-by: Tony Cheneau <tony.chen...@amnesiak.org>
> ---
>  net/ieee802154/6lowpan.c | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
> index e7f61de..0eebb96 100644
> --- a/net/ieee802154/6lowpan.c
> +++ b/net/ieee802154/6lowpan.c
> @@ -572,21 +572,28 @@ static int lowpan_header_create(struct sk_buff *skb,
>        * this isn't implemented in mainline yet, so currently we assign 0xff
>        */
>       {
> +             mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
> +
>               /* prepare wpan address data */
>               sa.addr_type = IEEE802154_ADDR_LONG;
>               sa.pan_id = 0xff;
> -
> -             da.addr_type = IEEE802154_ADDR_LONG;
> -             da.pan_id = 0xff;
> -
> -             memcpy(&(da.hwaddr), daddr, 8);
>               memcpy(&(sa.hwaddr), saddr, 8);
>  
> -             mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
> +             da.pan_id = 0xff;
> +             /*
> +              * if the destination address is the broadcast address, use the
> +              * corresponding short address
> +              */
> +             if (lowpan_is_addr_broadcast(daddr)) {
> +                     da.addr_type = IEEE802154_ADDR_SHORT;
> +                     da.short_addr = IEEE802154_ADDR_BROADCAST;
> +             } else {
> +                     da.addr_type = IEEE802154_ADDR_LONG;
> +                     memcpy(&(da.hwaddr), daddr, 8);

It's some nitpick here.
Maybe it's better to use IEEE802154_ADDR_LEN instead of 8.

I mean we have this define, and we should use it if we mean the
ieee802154 address length.

Alex

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to