aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-24 03:37:11 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-09-24 14:42:37 -0400
commitc2d5ecfaeafdedfb997a466c654c7029c511f43d (patch)
tree8d510e935c8550fb90c5b47715e2ae46907b91e6 /net/mac802154
parentf856f21dbcd162a53e30987a91d75d5ab54a7f80 (diff)
mac802154: iface: assume big endian for af_packet
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> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/iface.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index b5a0936ce514..3954bcff70e4 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -461,7 +461,7 @@ static int mac802154_header_create(struct sk_buff *skb,
461 461
462 hdr.dest.pan_id = wpan_dev->pan_id; 462 hdr.dest.pan_id = wpan_dev->pan_id;
463 hdr.dest.mode = IEEE802154_ADDR_LONG; 463 hdr.dest.mode = IEEE802154_ADDR_LONG;
464 memcpy(&hdr.dest.extended_addr, daddr, IEEE802154_EXTENDED_ADDR_LEN); 464 ieee802154_be64_to_le64(&hdr.dest.extended_addr, daddr);
465 465
466 hdr.source.pan_id = hdr.dest.pan_id; 466 hdr.source.pan_id = hdr.dest.pan_id;
467 hdr.source.mode = IEEE802154_ADDR_LONG; 467 hdr.source.mode = IEEE802154_ADDR_LONG;
@@ -469,8 +469,7 @@ static int mac802154_header_create(struct sk_buff *skb,
469 if (!saddr) 469 if (!saddr)
470 hdr.source.extended_addr = wpan_dev->extended_addr; 470 hdr.source.extended_addr = wpan_dev->extended_addr;
471 else 471 else
472 memcpy(&hdr.source.extended_addr, saddr, 472 ieee802154_be64_to_le64(&hdr.source.extended_addr, saddr);
473 IEEE802154_EXTENDED_ADDR_LEN);
474 473
475 hlen = ieee802154_hdr_push(skb, &hdr); 474 hlen = ieee802154_hdr_push(skb, &hdr);
476 if (hlen < 0) 475 if (hlen < 0)
@@ -496,8 +495,7 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
496 } 495 }
497 496
498 if (hdr.source.mode == IEEE802154_ADDR_LONG) { 497 if (hdr.source.mode == IEEE802154_ADDR_LONG) {
499 memcpy(haddr, &hdr.source.extended_addr, 498 ieee802154_le64_to_be64(haddr, &hdr.source.extended_addr);
500 IEEE802154_EXTENDED_ADDR_LEN);
501 return IEEE802154_EXTENDED_ADDR_LEN; 499 return IEEE802154_EXTENDED_ADDR_LEN;
502 } 500 }
503 501