提交 306f7aa1 编写于 作者: A Alexander Aring 提交者: Marcel Holtmann

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: NAlexander Aring <alex.aring@gmail.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 f9d1ce8f
......@@ -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));
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册