2015-09-18 11:52:44

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH bluetooth-next 0/4] GHC compression detection

Hello.

This is a first stab at RFC7400. So far we only hook into the NHC framework to
detect the three registered GHC types (extension header, UDP and ICMPv6).
This is aligned with how we detect the NHC frames.

Changes since RFC:
o prefixed new files with nhc_ to stay in line with other nhc modules
o added linux-bluetooth to CC

Stefan Schmidt (4):
6lowpan: clarify Kconfig entries for upcoming GHC support
6lowpan: add nhc module for GHC extension header detection
6lowpan: add nhc module for GHC UDP detection
6lowpan: add nhc module for GHC ICMPv6 detection

net/6lowpan/Kconfig | 20 ++++++++++++++++++--
net/6lowpan/Makefile | 5 +++++
net/6lowpan/nhc_ghc_extension_header.c | 27 +++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_icmpv6.c | 27 +++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_udp.c | 27 +++++++++++++++++++++++++++
5 files changed, 104 insertions(+), 2 deletions(-)
create mode 100644 net/6lowpan/nhc_ghc_extension_header.c
create mode 100644 net/6lowpan/nhc_ghc_icmpv6.c
create mode 100644 net/6lowpan/nhc_ghc_udp.c

regards
Stefan Schmidt

--
2.4.3


2015-09-18 22:14:30

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 2/4] 6lowpan: add nhc module for GHC extension header detection

On Fri, Sep 18, 2015 at 11:44:15PM +0200, Alexander Aring wrote:
> Hi,
>
> On Fri, Sep 18, 2015 at 01:52:46PM +0200, Stefan Schmidt wrote:

....

>
> btw:
>
> Something is wrong at iana registration:
>
> https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#lowpan_nhc
>
> For RFC6282 they did each entry for each extension header, for GHC not.
>
> Don't know why :-(
>
> Also iana says it's
>
> 10110EEN whereas RFC7400 says it's 1011EIDN
> ^
> |
> I don't know where this bit comes from.
>

it isn't wrong, GHC EID is defined for 0-3 only so the first bit is
always zero. So 10110 E E N is right whereas:

1011000N -> Hop
1011001N -> Routing
1011010N -> Fragment
1011011N -> Destination

Seems like Mobility and IPv6 is not defined for GHC.

But I still don't know why iana put it for RFC6282 in a new entry on the
list for each EID and for GHC they did only one entry for the mask without
EID bits.

- Alex

2015-09-18 21:51:01

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 4/4] 6lowpan: add nhc module for GHC ICMPv6 detection

On Fri, Sep 18, 2015 at 01:52:48PM +0200, Stefan Schmidt wrote:
> Signed-off-by: Stefan Schmidt <[email protected]>
> ---
> net/6lowpan/Kconfig | 5 +++++
> net/6lowpan/Makefile | 1 +
> net/6lowpan/nhc_ghc_icmpv6.c | 27 +++++++++++++++++++++++++++
> 3 files changed, 33 insertions(+)
> create mode 100644 net/6lowpan/nhc_ghc_icmpv6.c
>
> diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
> index 67a786b..a34693d 100644
> --- a/net/6lowpan/Kconfig
> +++ b/net/6lowpan/Kconfig
> @@ -69,4 +69,9 @@ config 6LOWPAN_GHC_UDP
> default y
> ---help---
>
> +config 6LOWPAN_GHC_ICMPV6
> + tristate "GHC ICMPv6 Support"
> + default y
> + ---help---
> +
> endif
> diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
> index fc65efb..49256b7f 100644
> --- a/net/6lowpan/Makefile
> +++ b/net/6lowpan/Makefile
> @@ -14,3 +14,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
> #rfc7400 ghcs
> obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
> obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
> +obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o
> diff --git a/net/6lowpan/nhc_ghc_icmpv6.c b/net/6lowpan/nhc_ghc_icmpv6.c
> new file mode 100644
> index 0000000..378ebfe
> --- /dev/null
> +++ b/net/6lowpan/nhc_ghc_icmpv6.c
> @@ -0,0 +1,27 @@
> +/*
> + * 6LoWPAN ICMPv6 compression according to RFC7400
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include "nhc.h"
> +
> +#define LOWPAN_GHC_ICMPV6_IDLEN 1
> +#define LOWPAN_GHC_ICMPV6_ID_0 0xdf
> +#define LOWPAN_GHC_ICMPV6_MASK_0 0xff
> +
> +static void icmpv6_ghid_setup(struct lowpan_nhc *nhc)
> +{
> + nhc->id[0] = LOWPAN_GHC_ICMPV6_ID_0;
> + nhc->idmask[0] = LOWPAN_GHC_ICMPV6_MASK_0;
> +}
> +
> +LOWPAN_NHC(ghc_icmpv6, "RFC7400 ICMPv6", NEXTHDR_HOP, 0,

s/NEXTHDR_HOP/NEXTHDR_ICMP/

- Alex

2015-09-18 21:50:29

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 3/4] 6lowpan: add nhc module for GHC UDP detection

On Fri, Sep 18, 2015 at 01:52:47PM +0200, Stefan Schmidt wrote:
> Signed-off-by: Stefan Schmidt <[email protected]>
> ---
> net/6lowpan/Kconfig | 5 +++++
> net/6lowpan/Makefile | 1 +
> net/6lowpan/nhc_ghc_udp.c | 27 +++++++++++++++++++++++++++
> 3 files changed, 33 insertions(+)
> create mode 100644 net/6lowpan/nhc_ghc_udp.c
>
> diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
> index f541f50..67a786b 100644
> --- a/net/6lowpan/Kconfig
> +++ b/net/6lowpan/Kconfig
> @@ -64,4 +64,9 @@ config 6LOWPAN_GHC_EXTENSION_HEADER
> default y
> ---help---
>
> +config 6LOWPAN_GHC_UDP
> + tristate "GHC UDP Support"
> + default y
> + ---help---
> +
> endif
> diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
> index 2b42bd0..fc65efb 100644
> --- a/net/6lowpan/Makefile
> +++ b/net/6lowpan/Makefile
> @@ -13,3 +13,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
>
> #rfc7400 ghcs
> obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
> +obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
> diff --git a/net/6lowpan/nhc_ghc_udp.c b/net/6lowpan/nhc_ghc_udp.c
> new file mode 100644
> index 0000000..2675683
> --- /dev/null
> +++ b/net/6lowpan/nhc_ghc_udp.c
> @@ -0,0 +1,27 @@
> +/*
> + * 6LoWPAN UDP compression according to RFC7400
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include "nhc.h"
> +
> +#define LOWPAN_GHC_UDP_IDLEN 1
> +#define LOWPAN_GHC_UDP_ID_0 0xd0
> +#define LOWPAN_GHC_UDP_MASK_0 0xf8
> +
> +static void udp_ghid_setup(struct lowpan_nhc *nhc)
> +{
> + nhc->id[0] = LOWPAN_GHC_UDP_ID_0;
> + nhc->idmask[0] = LOWPAN_GHC_UDP_MASK_0;
> +}
> +
> +LOWPAN_NHC(ghc_udp, "RFC7400 UDP", NEXTHDR_HOP, 0,

s/NEXTHDR_HOP/NEXTHDR_UDP/

Sadly is that we can't load two modules which contains NEXTHDR_UDP, when
another NEXTHDR_UDP is registered. But we should support all nhcid's
for receving side.

Maybe we can simple remove the check if nexthdr for compression
(tranmsit side) is already registered, actually this returns -EBUSY. We
prior for compression then the first loaded module (which should have a
compression method).

The real solution would be some configurable netlink framework. :-)

- Alex

2015-09-18 21:44:19

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 2/4] 6lowpan: add nhc module for GHC extension header detection

Hi,

On Fri, Sep 18, 2015 at 01:52:46PM +0200, Stefan Schmidt wrote:
> Signed-off-by: Stefan Schmidt <[email protected]>
> ---
> net/6lowpan/Kconfig | 5 +++++
> net/6lowpan/Makefile | 3 +++
> net/6lowpan/nhc_ghc_extension_header.c | 27 +++++++++++++++++++++++++++
> 3 files changed, 35 insertions(+)
> create mode 100644 net/6lowpan/nhc_ghc_extension_header.c
>
> diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
> index 6af7a46..f541f50 100644
> --- a/net/6lowpan/Kconfig
> +++ b/net/6lowpan/Kconfig
> @@ -59,4 +59,9 @@ config 6LOWPAN_NHC_UDP
> ---help---
> 6LoWPAN IPv6 UDP Header compression according to RFC6282.
>
> +config 6LOWPAN_GHC_EXTENSION_HEADER
> + tristate "GHC Extension Header Support"
> + default y
> + ---help---
> +
> endif
> diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
> index c6ffc55..2b42bd0 100644
> --- a/net/6lowpan/Makefile
> +++ b/net/6lowpan/Makefile
> @@ -10,3 +10,6 @@ obj-$(CONFIG_6LOWPAN_NHC_IPV6) += nhc_ipv6.o
> obj-$(CONFIG_6LOWPAN_NHC_MOBILITY) += nhc_mobility.o
> obj-$(CONFIG_6LOWPAN_NHC_ROUTING) += nhc_routing.o
> obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
> +
> +#rfc7400 ghcs
> +obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
> diff --git a/net/6lowpan/nhc_ghc_extension_header.c b/net/6lowpan/nhc_ghc_extension_header.c
> new file mode 100644
> index 0000000..eeeabfa
> --- /dev/null
> +++ b/net/6lowpan/nhc_ghc_extension_header.c
> @@ -0,0 +1,27 @@
> +/*
> + * 6LoWPAN Extension Header compression according to RFC7400
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include "nhc.h"
> +
> +#define LOWPAN_GHC_EXTENSION_HEADER_IDLEN 1
> +#define LOWPAN_GHC_EXTENSION_HEADER_ID_0 0xb0
> +#define LOWPAN_GHC_EXTENSION_HEADER_MASK_0 0xf8
> +

Sorry,

This is actually wrong.

http://tools.ietf.org/html/rfc7400#section-3.2

describes the id with:

1 0 1 1 E I D H

whereas E I D is the same like

http://tools.ietf.org/html/rfc6282#section-4.2

So this header compression should be splitted in 5 modules for each
extension header:

1 0 1 1 0 0 0 NH -> Hop-by-Hop
1 0 1 1 0 0 1 NH -> Routing
1 0 1 1 0 1 0 NH -> Fragment
....

like we have it in the others extension headers for RFC6282.

Maybe make also the name smaller

LOWPAN_GHC_EXT_HDR_HOP_XXXX

use the same coding style like the others extension header modules.

also _maybe_ change the to module name "nhc_ghc_ext_hdr_foobar".

> +static void ext_ghid_setup(struct lowpan_nhc *nhc)
> +{
> + nhc->id[0] = LOWPAN_GHC_EXTENSION_HEADER_ID_0;
> + nhc->idmask[0] = LOWPAN_GHC_EXTENSION_HEADER_MASK_0;
> +}
> +
> +LOWPAN_NHC(ghc_extension_header, "RFC7400 Extension Header", NEXTHDR_HOP, 0,

Care about the right NEXTHDR_FOOBAR value here.

btw:

Something is wrong at iana registration:

https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#lowpan_nhc

For RFC6282 they did each entry for each extension header, for GHC not.

Don't know why :-(

Also iana says it's

10110EEN whereas RFC7400 says it's 1011EIDN
^
|
I don't know where this bit comes from.

- Alex

2015-09-18 11:52:46

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH bluetooth-next 2/4] 6lowpan: add nhc module for GHC extension header detection

Signed-off-by: Stefan Schmidt <[email protected]>
---
net/6lowpan/Kconfig | 5 +++++
net/6lowpan/Makefile | 3 +++
net/6lowpan/nhc_ghc_extension_header.c | 27 +++++++++++++++++++++++++++
3 files changed, 35 insertions(+)
create mode 100644 net/6lowpan/nhc_ghc_extension_header.c

diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index 6af7a46..f541f50 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -59,4 +59,9 @@ config 6LOWPAN_NHC_UDP
---help---
6LoWPAN IPv6 UDP Header compression according to RFC6282.

+config 6LOWPAN_GHC_EXTENSION_HEADER
+ tristate "GHC Extension Header Support"
+ default y
+ ---help---
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index c6ffc55..2b42bd0 100644
--- a/net/6lowpan/Makefile
+++ b/net/6lowpan/Makefile
@@ -10,3 +10,6 @@ obj-$(CONFIG_6LOWPAN_NHC_IPV6) += nhc_ipv6.o
obj-$(CONFIG_6LOWPAN_NHC_MOBILITY) += nhc_mobility.o
obj-$(CONFIG_6LOWPAN_NHC_ROUTING) += nhc_routing.o
obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
+
+#rfc7400 ghcs
+obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
diff --git a/net/6lowpan/nhc_ghc_extension_header.c b/net/6lowpan/nhc_ghc_extension_header.c
new file mode 100644
index 0000000..eeeabfa
--- /dev/null
+++ b/net/6lowpan/nhc_ghc_extension_header.c
@@ -0,0 +1,27 @@
+/*
+ * 6LoWPAN Extension Header compression according to RFC7400
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "nhc.h"
+
+#define LOWPAN_GHC_EXTENSION_HEADER_IDLEN 1
+#define LOWPAN_GHC_EXTENSION_HEADER_ID_0 0xb0
+#define LOWPAN_GHC_EXTENSION_HEADER_MASK_0 0xf8
+
+static void ext_ghid_setup(struct lowpan_nhc *nhc)
+{
+ nhc->id[0] = LOWPAN_GHC_EXTENSION_HEADER_ID_0;
+ nhc->idmask[0] = LOWPAN_GHC_EXTENSION_HEADER_MASK_0;
+}
+
+LOWPAN_NHC(ghc_extension_header, "RFC7400 Extension Header", NEXTHDR_HOP, 0,
+ ext_ghid_setup, LOWPAN_GHC_EXTENSION_HEADER_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_extension_header);
+MODULE_DESCRIPTION("6LoWPAN generic header RFC7400 Extension Header compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-09-18 11:52:47

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH bluetooth-next 3/4] 6lowpan: add nhc module for GHC UDP detection

Signed-off-by: Stefan Schmidt <[email protected]>
---
net/6lowpan/Kconfig | 5 +++++
net/6lowpan/Makefile | 1 +
net/6lowpan/nhc_ghc_udp.c | 27 +++++++++++++++++++++++++++
3 files changed, 33 insertions(+)
create mode 100644 net/6lowpan/nhc_ghc_udp.c

diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index f541f50..67a786b 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -64,4 +64,9 @@ config 6LOWPAN_GHC_EXTENSION_HEADER
default y
---help---

+config 6LOWPAN_GHC_UDP
+ tristate "GHC UDP Support"
+ default y
+ ---help---
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index 2b42bd0..fc65efb 100644
--- a/net/6lowpan/Makefile
+++ b/net/6lowpan/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o

#rfc7400 ghcs
obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
+obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
diff --git a/net/6lowpan/nhc_ghc_udp.c b/net/6lowpan/nhc_ghc_udp.c
new file mode 100644
index 0000000..2675683
--- /dev/null
+++ b/net/6lowpan/nhc_ghc_udp.c
@@ -0,0 +1,27 @@
+/*
+ * 6LoWPAN UDP compression according to RFC7400
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "nhc.h"
+
+#define LOWPAN_GHC_UDP_IDLEN 1
+#define LOWPAN_GHC_UDP_ID_0 0xd0
+#define LOWPAN_GHC_UDP_MASK_0 0xf8
+
+static void udp_ghid_setup(struct lowpan_nhc *nhc)
+{
+ nhc->id[0] = LOWPAN_GHC_UDP_ID_0;
+ nhc->idmask[0] = LOWPAN_GHC_UDP_MASK_0;
+}
+
+LOWPAN_NHC(ghc_udp, "RFC7400 UDP", NEXTHDR_HOP, 0,
+ udp_ghid_setup, LOWPAN_GHC_UDP_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_udp);
+MODULE_DESCRIPTION("6LoWPAN generic header RFC7400 UDP compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-09-18 11:52:48

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH bluetooth-next 4/4] 6lowpan: add nhc module for GHC ICMPv6 detection

Signed-off-by: Stefan Schmidt <[email protected]>
---
net/6lowpan/Kconfig | 5 +++++
net/6lowpan/Makefile | 1 +
net/6lowpan/nhc_ghc_icmpv6.c | 27 +++++++++++++++++++++++++++
3 files changed, 33 insertions(+)
create mode 100644 net/6lowpan/nhc_ghc_icmpv6.c

diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index 67a786b..a34693d 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -69,4 +69,9 @@ config 6LOWPAN_GHC_UDP
default y
---help---

+config 6LOWPAN_GHC_ICMPV6
+ tristate "GHC ICMPv6 Support"
+ default y
+ ---help---
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index fc65efb..49256b7f 100644
--- a/net/6lowpan/Makefile
+++ b/net/6lowpan/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
#rfc7400 ghcs
obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
+obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o
diff --git a/net/6lowpan/nhc_ghc_icmpv6.c b/net/6lowpan/nhc_ghc_icmpv6.c
new file mode 100644
index 0000000..378ebfe
--- /dev/null
+++ b/net/6lowpan/nhc_ghc_icmpv6.c
@@ -0,0 +1,27 @@
+/*
+ * 6LoWPAN ICMPv6 compression according to RFC7400
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "nhc.h"
+
+#define LOWPAN_GHC_ICMPV6_IDLEN 1
+#define LOWPAN_GHC_ICMPV6_ID_0 0xdf
+#define LOWPAN_GHC_ICMPV6_MASK_0 0xff
+
+static void icmpv6_ghid_setup(struct lowpan_nhc *nhc)
+{
+ nhc->id[0] = LOWPAN_GHC_ICMPV6_ID_0;
+ nhc->idmask[0] = LOWPAN_GHC_ICMPV6_MASK_0;
+}
+
+LOWPAN_NHC(ghc_icmpv6, "RFC7400 ICMPv6", NEXTHDR_HOP, 0,
+ icmpv6_ghid_setup, LOWPAN_GHC_ICMPV6_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_icmpv6);
+MODULE_DESCRIPTION("6LoWPAN generic header RFC7400 ICMPv6 compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-09-18 11:52:45

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH bluetooth-next 1/4] 6lowpan: clarify Kconfig entries for upcoming GHC support

Signed-off-by: Stefan Schmidt <[email protected]>
---
net/6lowpan/Kconfig | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index 7fa0f38..6af7a46 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -6,11 +6,12 @@ menuconfig 6LOWPAN
"6LoWPAN" which is supported by IEEE 802.15.4 or Bluetooth stacks.

menuconfig 6LOWPAN_NHC
- tristate "Next Header Compression Support"
+ tristate "Next Header and Generic Header Compression Support"
depends on 6LOWPAN
default y
---help---
- Support for next header compression.
+ Support for next header and generic header compression defined in
+ RFC6282 and RFC7400.

if 6LOWPAN_NHC

--
2.4.3


2015-11-25 13:50:20

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 2/4] 6lowpan: add nhc module for GHC extension header detection

Hello.

On 18/09/15 23:44, Alexander Aring wrote:
> Hi,
>
> On Fri, Sep 18, 2015 at 01:52:46PM +0200, Stefan Schmidt wrote:
>> Signed-off-by: Stefan Schmidt<[email protected]>
>> ---
>> net/6lowpan/Kconfig | 5 +++++
>> net/6lowpan/Makefile | 3 +++
>> net/6lowpan/nhc_ghc_extension_header.c | 27 +++++++++++++++++++++++++++
>> 3 files changed, 35 insertions(+)
>> create mode 100644 net/6lowpan/nhc_ghc_extension_header.c
>>
>> diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
>> index 6af7a46..f541f50 100644
>> --- a/net/6lowpan/Kconfig
>> +++ b/net/6lowpan/Kconfig
>> @@ -59,4 +59,9 @@ config 6LOWPAN_NHC_UDP
>> ---help---
>> 6LoWPAN IPv6 UDP Header compression according to RFC6282.
>>
>> +config 6LOWPAN_GHC_EXTENSION_HEADER
>> + tristate "GHC Extension Header Support"
>> + default y
>> + ---help---
>> +
>> endif
>> diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
>> index c6ffc55..2b42bd0 100644
>> --- a/net/6lowpan/Makefile
>> +++ b/net/6lowpan/Makefile
>> @@ -10,3 +10,6 @@ obj-$(CONFIG_6LOWPAN_NHC_IPV6) += nhc_ipv6.o
>> obj-$(CONFIG_6LOWPAN_NHC_MOBILITY) += nhc_mobility.o
>> obj-$(CONFIG_6LOWPAN_NHC_ROUTING) += nhc_routing.o
>> obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
>> +
>> +#rfc7400 ghcs
>> +obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
>> diff --git a/net/6lowpan/nhc_ghc_extension_header.c b/net/6lowpan/nhc_ghc_extension_header.c
>> new file mode 100644
>> index 0000000..eeeabfa
>> --- /dev/null
>> +++ b/net/6lowpan/nhc_ghc_extension_header.c
>> @@ -0,0 +1,27 @@
>> +/*
>> + * 6LoWPAN Extension Header compression according to RFC7400
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version
>> + * 2 of the License, or (at your option) any later version.
>> + */
>> +
>> +#include "nhc.h"
>> +
>> +#define LOWPAN_GHC_EXTENSION_HEADER_IDLEN 1
>> +#define LOWPAN_GHC_EXTENSION_HEADER_ID_0 0xb0
>> +#define LOWPAN_GHC_EXTENSION_HEADER_MASK_0 0xf8
>> +
> Sorry,
>
> This is actually wrong.
>
> http://tools.ietf.org/html/rfc7400#section-3.2
>
> describes the id with:
>
> 1 0 1 1 E I D H
>
> whereas E I D is the same like
>
> http://tools.ietf.org/html/rfc6282#section-4.2
>
> So this header compression should be splitted in 5 modules for each
> extension header:
>
> 1 0 1 1 0 0 0 NH -> Hop-by-Hop
> 1 0 1 1 0 0 1 NH -> Routing
> 1 0 1 1 0 1 0 NH -> Fragment
> ....
>
> like we have it in the others extension headers for RFC6282.

I aligned this with how the extension header is handled in plain NHC.
Thanks for pointing this out. No idea how I missed it.

Will be fixed in a new patchset coming later today.

> Maybe make also the name smaller
>
> LOWPAN_GHC_EXT_HDR_HOP_XXXX

I shortened this as well.

> use the same coding style like the others extension header modules.
>
> also _maybe_ change the to module name "nhc_ghc_ext_hdr_foobar".

Also shortened. I left out the hdr part in both to make it even shorter
and the hdr part did not really differentiate anything so we could leave
it out.

regards
Stefan Schmidt


2015-11-25 13:50:33

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 4/4] 6lowpan: add nhc module for GHC ICMPv6 detection

Hello.

On 18/09/15 23:51, Alexander Aring wrote:
> On Fri, Sep 18, 2015 at 01:52:48PM +0200, Stefan Schmidt wrote:
>> Signed-off-by: Stefan Schmidt<[email protected]>
>> ---
>> net/6lowpan/Kconfig | 5 +++++
>> net/6lowpan/Makefile | 1 +
>> net/6lowpan/nhc_ghc_icmpv6.c | 27 +++++++++++++++++++++++++++
>> 3 files changed, 33 insertions(+)
>> create mode 100644 net/6lowpan/nhc_ghc_icmpv6.c
>>
>> diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
>> index 67a786b..a34693d 100644
>> --- a/net/6lowpan/Kconfig
>> +++ b/net/6lowpan/Kconfig
>> @@ -69,4 +69,9 @@ config 6LOWPAN_GHC_UDP
>> default y
>> ---help---
>>
>> +config 6LOWPAN_GHC_ICMPV6
>> + tristate "GHC ICMPv6 Support"
>> + default y
>> + ---help---
>> +
>> endif
>> diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
>> index fc65efb..49256b7f 100644
>> --- a/net/6lowpan/Makefile
>> +++ b/net/6lowpan/Makefile
>> @@ -14,3 +14,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
>> #rfc7400 ghcs
>> obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
>> obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
>> +obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o
>> diff --git a/net/6lowpan/nhc_ghc_icmpv6.c b/net/6lowpan/nhc_ghc_icmpv6.c
>> new file mode 100644
>> index 0000000..378ebfe
>> --- /dev/null
>> +++ b/net/6lowpan/nhc_ghc_icmpv6.c
>> @@ -0,0 +1,27 @@
>> +/*
>> + * 6LoWPAN ICMPv6 compression according to RFC7400
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version
>> + * 2 of the License, or (at your option) any later version.
>> + */
>> +
>> +#include "nhc.h"
>> +
>> +#define LOWPAN_GHC_ICMPV6_IDLEN 1
>> +#define LOWPAN_GHC_ICMPV6_ID_0 0xdf
>> +#define LOWPAN_GHC_ICMPV6_MASK_0 0xff
>> +
>> +static void icmpv6_ghid_setup(struct lowpan_nhc *nhc)
>> +{
>> + nhc->id[0] = LOWPAN_GHC_ICMPV6_ID_0;
>> + nhc->idmask[0] = LOWPAN_GHC_ICMPV6_MASK_0;
>> +}
>> +
>> +LOWPAN_NHC(ghc_icmpv6, "RFC7400 ICMPv6", NEXTHDR_HOP, 0,
> s/NEXTHDR_HOP/NEXTHDR_ICMP/

Fixed in the new patchset coming later today.

regards
Stefan Schmidt

2015-11-25 13:50:10

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 2/4] 6lowpan: add nhc module for GHC extension header detection

Hello.

On 19/09/15 00:14, Alexander Aring wrote:
> On Fri, Sep 18, 2015 at 11:44:15PM +0200, Alexander Aring wrote:
>> Hi,
>>
>> On Fri, Sep 18, 2015 at 01:52:46PM +0200, Stefan Schmidt wrote:
> ....
>
>> btw:
>>
>> Something is wrong at iana registration:
>>
>> https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#lowpan_nhc
>>
>> For RFC6282 they did each entry for each extension header, for GHC not.
>>
>> Don't know why :-(
>>
>> Also iana says it's
>>
>> 10110EEN whereas RFC7400 says it's 1011EIDN
>> ^
>> |
>> I don't know where this bit comes from.
>>
> it isn't wrong, GHC EID is defined for 0-3 only so the first bit is
> always zero. So 10110 E E N is right whereas:
>
> 1011000N -> Hop
> 1011001N -> Routing
> 1011010N -> Fragment
> 1011011N -> Destination
>
> Seems like Mobility and IPv6 is not defined for GHC.
>
> But I still don't know why iana put it for RFC6282 in a new entry on the
> list for each EID and for GHC they did only one entry for the mask without
> EID bits.

I guess we could ask them if we really want to know.

regards
Stefan Schmidt


2015-11-25 13:49:50

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next 3/4] 6lowpan: add nhc module for GHC UDP detection

Hello.

On 18/09/15 23:50, Alexander Aring wrote:
> On Fri, Sep 18, 2015 at 01:52:47PM +0200, Stefan Schmidt wrote:
>> Signed-off-by: Stefan Schmidt <[email protected]>
>> ---
>> net/6lowpan/Kconfig | 5 +++++
>> net/6lowpan/Makefile | 1 +
>> net/6lowpan/nhc_ghc_udp.c | 27 +++++++++++++++++++++++++++
>> 3 files changed, 33 insertions(+)
>> create mode 100644 net/6lowpan/nhc_ghc_udp.c
>>
>> diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
>> index f541f50..67a786b 100644
>> --- a/net/6lowpan/Kconfig
>> +++ b/net/6lowpan/Kconfig
>> @@ -64,4 +64,9 @@ config 6LOWPAN_GHC_EXTENSION_HEADER
>> default y
>> ---help---
>>
>> +config 6LOWPAN_GHC_UDP
>> + tristate "GHC UDP Support"
>> + default y
>> + ---help---
>> +
>> endif
>> diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
>> index 2b42bd0..fc65efb 100644
>> --- a/net/6lowpan/Makefile
>> +++ b/net/6lowpan/Makefile
>> @@ -13,3 +13,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
>>
>> #rfc7400 ghcs
>> obj-$(CONFIG_6LOWPAN_GHC_EXTENSION_HEADER) += nhc_ghc_extension_header.o
>> +obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
>> diff --git a/net/6lowpan/nhc_ghc_udp.c b/net/6lowpan/nhc_ghc_udp.c
>> new file mode 100644
>> index 0000000..2675683
>> --- /dev/null
>> +++ b/net/6lowpan/nhc_ghc_udp.c
>> @@ -0,0 +1,27 @@
>> +/*
>> + * 6LoWPAN UDP compression according to RFC7400
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version
>> + * 2 of the License, or (at your option) any later version.
>> + */
>> +
>> +#include "nhc.h"
>> +
>> +#define LOWPAN_GHC_UDP_IDLEN 1
>> +#define LOWPAN_GHC_UDP_ID_0 0xd0
>> +#define LOWPAN_GHC_UDP_MASK_0 0xf8
>> +
>> +static void udp_ghid_setup(struct lowpan_nhc *nhc)
>> +{
>> + nhc->id[0] = LOWPAN_GHC_UDP_ID_0;
>> + nhc->idmask[0] = LOWPAN_GHC_UDP_MASK_0;
>> +}
>> +
>> +LOWPAN_NHC(ghc_udp, "RFC7400 UDP", NEXTHDR_HOP, 0,
> s/NEXTHDR_HOP/NEXTHDR_UDP/

Fixed in the upcoming patchset.

>
> Sadly is that we can't load two modules which contains NEXTHDR_UDP, when
> another NEXTHDR_UDP is registered. But we should support all nhcid's
> for receving side.
>
> Maybe we can simple remove the check if nexthdr for compression
> (tranmsit side) is already registered, actually this returns -EBUSY. We
> prior for compression then the first loaded module (which should have a
> compression method).

At least for GHC we will know what destinations support it once we
support the 6LoWPAN Capability Indication Option (6CIO) over ND.

> The real solution would be some configurable netlink framework. :-)

Agreed. This is actually on my list of things to do. Juts no idea when i
will come to it.