summaryrefslogtreecommitdiff
path: root/include/linux/ieee802154.h
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-02-11 14:39:15 +0100
committerMarcel Holtmann <marcel@holtmann.org>2015-02-14 05:19:58 +0100
commit306f7aa1807be7588f115d7cafa475f65e72e3d1 (patch)
tree11679d7f76dc860be1c440c6dbadd6f0d19d99be /include/linux/ieee802154.h
parentf9d1ce8f81eb046626cfa1bb0f419f8dca04bcae (diff)
ieee802154: correct ieee802154_is_valid_psdu_len
This patch corrects the ieee802154_is_valid_psdu_len function that this function also checks on reserved values 6-8 for validation the psdu length. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/linux/ieee802154.h')
-rw-r--r--include/linux/ieee802154.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index 6e82d888287c..40b0ab953937 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -28,7 +28,8 @@
#include <asm/byteorder.h>
#define IEEE802154_MTU 127
-#define IEEE802154_MIN_PSDU_LEN 5
+#define IEEE802154_ACK_PSDU_LEN 5
+#define IEEE802154_MIN_PSDU_LEN 9
#define IEEE802154_PAN_ID_BROADCAST 0xffff
#define IEEE802154_ADDR_SHORT_BROADCAST 0xffff
@@ -204,11 +205,18 @@ enum {
/**
* ieee802154_is_valid_psdu_len - check if psdu len is valid
+ * available lengths:
+ * 0-4 Reserved
+ * 5 MPDU (Acknowledgment)
+ * 6-8 Reserved
+ * 9-127 MPDU
+ *
* @len: psdu len with (MHR + payload + MFR)
*/
static inline bool ieee802154_is_valid_psdu_len(const u8 len)
{
- return (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU);
+ return (len == IEEE802154_ACK_PSDU_LEN ||
+ (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU));
}
/**