ieee802154: 6lowpan: check on valid 802.15.4 frame
This patch adds frame control checks to check if the received frame is something which could contain a 6LoWPAN packet. Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:

committed by
Marcel Holtmann

parent
c6fdbba3ea
commit
54552d0302
@@ -249,6 +249,21 @@ struct ieee802154_ops {
|
||||
const bool on);
|
||||
};
|
||||
|
||||
/**
|
||||
* ieee802154_get_fc_from_skb - get the frame control field from an skb
|
||||
* @skb: skb where the frame control field will be get from
|
||||
*/
|
||||
static inline __le16 ieee802154_get_fc_from_skb(const struct sk_buff *skb)
|
||||
{
|
||||
/* return some invalid fc on failure */
|
||||
if (unlikely(skb->mac_len < 2)) {
|
||||
WARN_ON(1);
|
||||
return cpu_to_le16(0);
|
||||
}
|
||||
|
||||
return (__force __le16)__get_unaligned_memmove16(skb_mac_header(skb));
|
||||
}
|
||||
|
||||
/**
|
||||
* ieee802154_be64_to_le64 - copies and convert be64 to le64
|
||||
* @le64_dst: le64 destination pointer
|
||||
|
Reference in New Issue
Block a user