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

ieee802154: 6lowpan: add check for reserved dispatch

This patch adds checks for reserved dispatch value. When we have a
reserved dispatch value we should drop the skb immediately.
Reviewed-by: NStefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 ad663600
...@@ -260,6 +260,19 @@ static inline bool lowpan_is_nalp(u8 dispatch) ...@@ -260,6 +260,19 @@ static inline bool lowpan_is_nalp(u8 dispatch)
return (dispatch & LOWPAN_DISPATCH_FIRST) == LOWPAN_DISPATCH_NALP; return (dispatch & LOWPAN_DISPATCH_FIRST) == LOWPAN_DISPATCH_NALP;
} }
/* Lookup for reserved dispatch values at:
* https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#_6lowpan-parameters-1
*
* Last Updated: 2015-01-22
*/
static inline bool lowpan_is_reserved(u8 dispatch)
{
return ((dispatch >= 0x44 && dispatch <= 0x4F) ||
(dispatch >= 0x51 && dispatch <= 0x5F) ||
(dispatch >= 0xc8 && dispatch <= 0xdf) ||
(dispatch >= 0xe8 && dispatch <= 0xff));
}
/* lowpan_rx_h_check checks on generic 6LoWPAN requirements /* lowpan_rx_h_check checks on generic 6LoWPAN requirements
* in MAC and 6LoWPAN header. * in MAC and 6LoWPAN header.
* *
...@@ -271,7 +284,8 @@ static inline bool lowpan_rx_h_check(struct sk_buff *skb) ...@@ -271,7 +284,8 @@ static inline bool lowpan_rx_h_check(struct sk_buff *skb)
if (unlikely(!skb->len)) if (unlikely(!skb->len))
return false; return false;
if (lowpan_is_nalp(*skb_network_header(skb))) if (lowpan_is_nalp(*skb_network_header(skb)) ||
lowpan_is_reserved(*skb_network_header(skb)))
return false; return false;
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册