From: Alexander Aring <alex.aring@gmail.com>
To: linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de, Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet
Date: Thu, 24 Sep 2015 09:37:11 +0200 [thread overview]
Message-ID: <1443080231-6416-2-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1443080231-6416-1-git-send-email-alex.aring@gmail.com>
The callback "create" and "parse" from header_ops are called from
netdev core upper-layer functionality, like af_packet. These callbacks
assumes big endian for addresses and we should not introduce a special
byteordering handling for ieee802154 over af_packet in userspace.
We have an identical issue with setting the mac address which also
assumes big endian byteordering.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/iface.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index b5a0936..3954bcf 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -461,7 +461,7 @@ static int mac802154_header_create(struct sk_buff *skb,
hdr.dest.pan_id = wpan_dev->pan_id;
hdr.dest.mode = IEEE802154_ADDR_LONG;
- memcpy(&hdr.dest.extended_addr, daddr, IEEE802154_EXTENDED_ADDR_LEN);
+ ieee802154_be64_to_le64(&hdr.dest.extended_addr, daddr);
hdr.source.pan_id = hdr.dest.pan_id;
hdr.source.mode = IEEE802154_ADDR_LONG;
@@ -469,8 +469,7 @@ static int mac802154_header_create(struct sk_buff *skb,
if (!saddr)
hdr.source.extended_addr = wpan_dev->extended_addr;
else
- memcpy(&hdr.source.extended_addr, saddr,
- IEEE802154_EXTENDED_ADDR_LEN);
+ ieee802154_be64_to_le64(&hdr.source.extended_addr, saddr);
hlen = ieee802154_hdr_push(skb, &hdr);
if (hlen < 0)
@@ -496,8 +495,7 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
}
if (hdr.source.mode == IEEE802154_ADDR_LONG) {
- memcpy(haddr, &hdr.source.extended_addr,
- IEEE802154_EXTENDED_ADDR_LEN);
+ ieee802154_le64_to_be64(haddr, &hdr.source.extended_addr);
return IEEE802154_EXTENDED_ADDR_LEN;
}
--
2.5.2
next prev parent reply other threads:[~2015-09-24 7:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 7:37 [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes Alexander Aring
2015-09-24 7:37 ` Alexander Aring [this message]
2015-09-24 18:44 ` [PATCH bluetooth-next 2/2] mac802154: iface: assume big endian for af_packet Marcel Holtmann
2015-09-24 18:43 ` [PATCH bluetooth-next 1/2] ieee802154: remove unnecessary includes 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=1443080231-6416-2-git-send-email-alex.aring@gmail.com \
--to=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