aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-07-06 17:32:27 -0400
committerMarcel Holtmann <marcel@holtmann.org>2016-07-08 07:23:12 -0400
commitaaa7088eb29a0ffe6cf8d8a443695df41e5a62f3 (patch)
tree2150a78d7d9d057328830eb92eb864197d930d2b
parent0ea0b9af9b7599ada307258dc841f4300873e8a1 (diff)
ieee802154: fix skb get fc on big endian
This patch fixes ieee802154_get_fc_from_skb function on big endian machines. The function get_unaligned_le16 converts the byte order to host byte order but we want to keep the byte order like in mac header. Signed-off-by: Alexander Aring <aar@pengutronix.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--include/net/mac802154.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index d757edd0b0b7..bb7bfecc5ab3 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -247,6 +247,8 @@ struct ieee802154_ops {
247 */ 247 */
248static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb) 248static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
249{ 249{
250 __le16 fc;
251
250 /* check if we can fc at skb_mac_header of sk buffer */ 252 /* check if we can fc at skb_mac_header of sk buffer */
251 if (unlikely(!skb_mac_header_was_set(skb) || 253 if (unlikely(!skb_mac_header_was_set(skb) ||
252 (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) { 254 (skb_tail_pointer(skb) - skb_mac_header(skb)) < 2)) {
@@ -254,7 +256,8 @@ static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
254 return cpu_to_le16(0); 256 return cpu_to_le16(0);
255 } 257 }
256 258
257 return get_unaligned_le16(skb_mac_header(skb)); 259 memcpy(&fc, skb_mac_header(skb), IEEE802154_FC_LEN);
260 return fc;
258} 261}
259 262
260/** 263/**