Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Stefan Schmidt <stefan@osg.samsung.com>
Cc: linux-wpan@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [RFC 14/16] ieee802154: 6lowpan: add check for reserved dispatch
Date: Thu, 13 Aug 2015 22:17:26 +0200	[thread overview]
Message-ID: <20150813201712.GA2732@omega> (raw)
In-Reply-To: <55CB4C1D.8000300@osg.samsung.com>

On Wed, Aug 12, 2015 at 03:37:33PM +0200, Stefan Schmidt wrote:
> Hello.
> 
> On 03/08/15 08:23, Alexander Aring wrote:
> >This patch adds checks for reserved dispatch value by check on all known
> >dispatch values.
> >
> >Signed-off-by: Alexander Aring<alex.aring@gmail.com>
> >---
> >  net/ieee802154/6lowpan/rx.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> >diff --git a/net/ieee802154/6lowpan/rx.c b/net/ieee802154/6lowpan/rx.c
> >index 146aa14..48869ac 100644
> >--- a/net/ieee802154/6lowpan/rx.c
> >+++ b/net/ieee802154/6lowpan/rx.c
> >@@ -248,6 +248,15 @@ static inline bool lowpan_is_nalp(u8 dispatch)
> >  	return (dispatch & LOWPAN_DISPATCH_FIRST) == LOWPAN_DISPATCH_NALP;
> >  }
> >+static inline bool lowpan_is_reserved(u8 dispatch)
> >+{
> >+	return !(lowpan_is_nalp(dispatch) || lowpan_is_iphc(dispatch) ||
> 
> OK, this is fishy. First of all you check lowpan_is_nalp here and negate it,
> but below you are checking without negation.
> One must be wrong. :)
> 
> 
> >+		 lowpan_is_ipv6(dispatch) || lowpan_is_hc1(dispatch) ||
> >+		 lowpan_is_bc0(dispatch) || lowpan_is_mesh(dispatch) ||
> >+		 lowpan_is_esc(dispatch) || lowpan_is_frag1(dispatch) ||
> >+		 lowpan_is_fragn(dispatch));
> >+}
> >+
> >  /* lowpan_rx_h_check checks on generic 6LoWPAN requirements
> >   * in MAC and 6LoWPAN header.
> >   *
> >@@ -259,7 +268,8 @@ static 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)) ||
> 
> Here are you checking it as well. but without negating it.
> 

yes, I think we should work here with ranges. Not checking all known
values. (Maybe we can also do some bit magic there then).

Also I should lookup more iana registrations for dispatches. I forget

LOWPAN_DFF

See [0]. But then somebody else should send a patch to introduce some
"netdev warning message".

btw: we should add some of these warning messages for lowpan_nhc as well.
[1]. I am fine for introduce just a name and known nhc id for printing
some warning that we don't support $NAME right now, instead of
"unknown".

(Also wondering why "11111111 - Unassigned, reserved for extensions" -
does this mean now that when we have "11111111" an additional nhc id
byte is there? I don't see anything in rfc6282 which mention that. For
this reason I had implement the such complicated rbtree lookup mechanism
because I was not sure about this -> "When we know an additional nhc id
byte is there". Anyway it's some variable length bitstring and rbtree
structure should be fit there (I hope).

- Alex

[0] https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#_6lowpan-parameters-1
[1] https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#lowpan_nhc

  reply	other threads:[~2015-08-13 20:17 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03  6:23 [RFC 00/16] ieee802154: 6lowpan: cleanup and rework dispatch evaluation Alexander Aring
2015-08-03  6:23 ` [RFC 01/16] ieee802154: 6lowpan: change dev vars to wdev and ldev Alexander Aring
2015-08-12  8:49   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 02/16] ieee802154: 6lowpan: remove set to zero Alexander Aring
2015-08-12  8:49   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 03/16] ieee802154: 6lowpan: remove EXPORT_SYMBOL Alexander Aring
2015-08-12  8:49   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 04/16] ieee802154: 6lowpan: remove check on wdev is running Alexander Aring
2015-08-12  8:49   ` Stefan Schmidt
2015-08-15 11:50   ` Alexander Aring
2015-08-03  6:23 ` [RFC 05/16] ieee802154: 6lowpan: cleanup pull of iphc bytes Alexander Aring
2015-08-12  9:03   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 06/16] ieee802154: 6lowpan: trivial checks at first Alexander Aring
2015-08-12  9:04   ` Stefan Schmidt
2015-08-12  9:21     ` Alexander Aring
2015-08-15  9:15   ` Alexander Aring
2015-08-03  6:23 ` [RFC 07/16] ieee802154: 6lowpan: change skb->dev earlier Alexander Aring
2015-08-12  9:13   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 08/16] ieee802154: 6lowpan: change frag return value handling Alexander Aring
2015-08-12  9:14   ` Stefan Schmidt
2015-08-12  9:26     ` Alexander Aring
2015-08-03  6:23 ` [RFC 09/16] ieee820154: 6lowpan: dispatch evaluation rework Alexander Aring
2015-08-12 12:51   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 10/16] ieee802154: 6lowpan: add dispatch evalualtion helpers Alexander Aring
2015-08-12 12:51   ` Stefan Schmidt
2015-08-12 13:20     ` Alexander Aring
2015-08-12 13:48       ` Stefan Schmidt
2015-08-12 13:55         ` Alexander Aring
2015-08-03  6:23 ` [RFC 11/16] ieee802154: 6lowpan: fix fragmentation dispatch mask Alexander Aring
2015-08-12 12:51   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 12/16] ieee802154: 6lowpan: add generic lowpan header check Alexander Aring
2015-08-12 13:37   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 13/16] ieee802154: 6lowpan: add handler for all dispatch values Alexander Aring
2015-08-12 13:37   ` Stefan Schmidt
2015-08-03  6:23 ` [RFC 14/16] ieee802154: 6lowpan: add check for reserved dispatch Alexander Aring
2015-08-12 13:37   ` Stefan Schmidt
2015-08-13 20:17     ` Alexander Aring [this message]
2015-08-03  6:23 ` [RFC 15/16] ieee802154: 6lowpan: check on valid 802.15.4 frame Alexander Aring
2015-08-12 13:37   ` Stefan Schmidt
2015-08-12 13:54     ` Alexander Aring
2015-08-03  6:23 ` [RFC 16/16] ieee802154: 6lowpan: remove packet type to host Alexander Aring
2015-08-12 13:37   ` Stefan Schmidt
2015-08-12  8:15 ` [RFC 00/16] ieee802154: 6lowpan: cleanup and rework dispatch evaluation Stefan Schmidt
2015-08-13  9:10   ` Stefan Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150813201712.GA2732@omega \
    --to=alex.aring@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    --cc=stefan@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox