aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-09-02 08:21:28 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-09-17 07:20:04 -0400
commitc6fdbba3eadd5af695c1290c59fe917ce8d9295f (patch)
tree49af11a948d229c0eafbb56e6c66d19fd5831140
parentad663600e1a8e2db1c4343bae73836f793ff4e08 (diff)
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>
-rw-r--r--net/ieee802154/6lowpan/rx.c16
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)
260 return (dispatch & LOWPAN_DISPATCH_FIRST) == LOWPAN_DISPATCH_NALP; 260 return (dispatch & LOWPAN_DISPATCH_FIRST) == LOWPAN_DISPATCH_NALP;
261} 261}
262 262
263/* Lookup for reserved dispatch values at:
264 * https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#_6lowpan-parameters-1
265 *
266 * Last Updated: 2015-01-22
267 */
268static inline bool lowpan_is_reserved(u8 dispatch)
269{
270 return ((dispatch >= 0x44 && dispatch <= 0x4F) ||
271 (dispatch >= 0x51 && dispatch <= 0x5F) ||
272 (dispatch >= 0xc8 && dispatch <= 0xdf) ||
273 (dispatch >= 0xe8 && dispatch <= 0xff));
274}
275
263/* lowpan_rx_h_check checks on generic 6LoWPAN requirements 276/* lowpan_rx_h_check checks on generic 6LoWPAN requirements
264 * in MAC and 6LoWPAN header. 277 * in MAC and 6LoWPAN header.
265 * 278 *
@@ -271,7 +284,8 @@ static inline bool lowpan_rx_h_check(struct sk_buff *skb)
271 if (unlikely(!skb->len)) 284 if (unlikely(!skb->len))
272 return false; 285 return false;
273 286
274 if (lowpan_is_nalp(*skb_network_header(skb))) 287 if (lowpan_is_nalp(*skb_network_header(skb)) ||
288 lowpan_is_reserved(*skb_network_header(skb)))
275 return false; 289 return false;
276 290
277 return true; 291 return true;