diff options
author | Alexander Aring <alex.aring@gmail.com> | 2015-09-02 14:21:28 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-09-17 13:20:04 +0200 |
commit | c6fdbba3eadd5af695c1290c59fe917ce8d9295f (patch) | |
tree | 49af11a948d229c0eafbb56e6c66d19fd5831140 /net/ieee802154 | |
parent | ad663600e1a8e2db1c4343bae73836f793ff4e08 (diff) | |
download | linux-c6fdbba3eadd5af695c1290c59fe917ce8d9295f.tar.gz linux-c6fdbba3eadd5af695c1290c59fe917ce8d9295f.tar.bz2 linux-c6fdbba3eadd5af695c1290c59fe917ce8d9295f.zip |
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: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r-- | net/ieee802154/6lowpan/rx.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/net/ieee802154/6lowpan/rx.c b/net/ieee802154/6lowpan/rx.c index a9216f1e584d..45ce121369c2 100644 --- a/net/ieee802154/6lowpan/rx.c +++ b/net/ieee802154/6lowpan/rx.c @@ -260,6 +260,19 @@ static inline bool lowpan_is_nalp(u8 dispatch) 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 * in MAC and 6LoWPAN header. * @@ -271,7 +284,8 @@ static inline bool lowpan_rx_h_check(struct sk_buff *skb) if (unlikely(!skb->len)) 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 true; |