Subject: Re: [Linux-zigbee-devel] [PATCH net-next v3 1/4] ieee802154: add generic header handling routines

From: Alexander Aring <[email-masked]>
Date: Tue, 4 Mar 2014 15:14:08 +0100

Hi Phoebe,

On Mon, Mar 03, 2014 at 11:07:52PM +0100, Phoebe Buckheister wrote:
> Add a generic set of 802.15.4 header operations on sk_buffs: push header
> onto skb, pull header from skb, and peek address fields from the mac_hdr
> part of an skb.
> 
> These routines support the full 802.15.4 header as described in the
> standard, including the security header. They are useful for everything
> that must create, modify or read 802.15.4 headers, which of course
> includes the wpan rx/tx path, but also 6lowpan. In the future,
> link-layer security will also require means to modify packet headers.
> 
> Signed-off-by: Phoebe Buckheister <[email-masked]>
> Tested-by: Alexander Aring <[email-masked]>
> ---
> +static int
> +ieee802154_hdr_get_addrs(const u8 *buf, struct ieee802154_hdr *hdr)
> +{
> +	int pos = 0;
> +
> +	pos += ieee802154_hdr_get_addr(buf + pos,
> +				       IEEE802154_FC_DAMODE(hdr->fc),
> +				       false, &hdr->dest);
> +	pos += ieee802154_hdr_get_addr(buf + pos,
> +				       IEEE802154_FC_SAMODE(hdr->fc),
> +				       hdr->fc & IEEE802154_FC_INTRA_PAN,
> +				       &hdr->source);
> +
> +	if (hdr->fc && IEEE802154_FC_INTRA_PAN)
I think this should be:

if (hdr->fc & IEEE802154_FC_INTRA_PAN)

- Alex