2015-11-25 14:59:10

by Stefan Schmidt

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

Hello.

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

Changes since v1:
o Use correct NEXTHDR defines for LOWPAN_NHC()
o Split out different extension headers into one module each
o Add some help text for configure options

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 (7):
6lowpan: clarify Kconfig entries for upcoming GHC support
6lowpan: add nhc module for GHC hop-by-hopextension header detection
6lowpan: add nhc module for GHC UDP detection
6lowpan: add nhc module for GHC ICMPv6 detection
6lowpan: add nhc module for GHC destination extension header detection
6lowpan: add nhc module for GHC fragmentation extension header
detection
6lowpan: add nhc module for GHC routing extension header detection

net/6lowpan/Kconfig | 39 +++++++++++++++++++++++++++++++++++++--
net/6lowpan/Makefile | 8 ++++++++
net/6lowpan/nhc_ghc_ext_dest.c | 27 +++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_ext_frag.c | 28 ++++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_ext_hop.c | 27 +++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_ext_route.c | 27 +++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_icmpv6.c | 27 +++++++++++++++++++++++++++
net/6lowpan/nhc_ghc_udp.c | 27 +++++++++++++++++++++++++++
8 files changed, 208 insertions(+), 2 deletions(-)
create mode 100644 net/6lowpan/nhc_ghc_ext_dest.c
create mode 100644 net/6lowpan/nhc_ghc_ext_frag.c
create mode 100644 net/6lowpan/nhc_ghc_ext_hop.c
create mode 100644 net/6lowpan/nhc_ghc_ext_route.c
create mode 100644 net/6lowpan/nhc_ghc_icmpv6.c
create mode 100644 net/6lowpan/nhc_ghc_udp.c

--
2.4.3



2015-11-27 12:30:55

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH v2 bluetooth-next 0/7] GHC compression detection

Hello.

On 27/11/15 13:13, Alexander Aring wrote:
> On Wed, Nov 25, 2015 at 03:59:10PM +0100, Stefan Schmidt wrote:
>> Hello.
>>
>> This is a first stab at RFC7400. So far we only hook into the NHC framework to
>> detect the registered GHC types (extension headers, UDP and ICMPv6).
>> This is aligned with how we detect the NHC frames.
>>
> TODO for next is to make possible that we can load multiple nhc modules
> for the transmit side. We have a 1(tranmit):n(receive) mapping here, and
> we should support all nhc's for receive side.
>
> For tranmsmit side we should have a disable by default and offer a
> debugfs entry (nhc framework debugfs support) to enable/disable it
> at runtime. It's a 1:nexhdr mapping, so only one for nexthdr can running
> at the same time currently. If somebody tries that it should be return
> -EBUSY.
>
> I would suggest additional patches:
>
> 1. Allow to have register everything and disable compression methods of
> all nhcs by default. The receive handling should always possible,
> the compression should be disabled by default because other 6LoWPAN
> stacks may not support e.g. GHC types.
>
> Maybe we can do a nhc directory for the debugfs interface related entry
> for that. So the nhc framework offers some support e.g. enable compression
> for nhc xy.
>
> 2. Add all you nhc's _after_ all other nhc modules. This will occur that
> the first ones has a higher priority. Our priority strategy is then
> like the order of the list. See [0].
>
> 3. Add "default y" to all nhc's for support receiving always.
>
>
> That's huge work, but maybe the next steps.

Yes, I will tackle them with the next set. I'm working on the actual
compression and decrompression code for GHC at the moment. Once that is
working I will tackle the items you listed above and put them together
in one patchset.
> Otherwise it's looking good and let the NHC framework as first known
> about these next header compressions, so:
>
> Acked-by: Alexander Aring <[email protected]>

Thanks. I think with your and Jukka's ACK this set would be ready to land.


2015-11-27 12:13:34

by Alexander Aring

[permalink] [raw]
Subject: Re: [PATCH v2 bluetooth-next 0/7] GHC compression detection

On Wed, Nov 25, 2015 at 03:59:10PM +0100, Stefan Schmidt wrote:
> Hello.
>
> This is a first stab at RFC7400. So far we only hook into the NHC framework to
> detect the registered GHC types (extension headers, UDP and ICMPv6).
> This is aligned with how we detect the NHC frames.
>

TODO for next is to make possible that we can load multiple nhc modules
for the transmit side. We have a 1(tranmit):n(receive) mapping here, and
we should support all nhc's for receive side.

For tranmsmit side we should have a disable by default and offer a
debugfs entry (nhc framework debugfs support) to enable/disable it
at runtime. It's a 1:nexhdr mapping, so only one for nexthdr can running
at the same time currently. If somebody tries that it should be return
-EBUSY.

I would suggest additional patches:

1. Allow to have register everything and disable compression methods of
all nhcs by default. The receive handling should always possible,
the compression should be disabled by default because other 6LoWPAN
stacks may not support e.g. GHC types.

Maybe we can do a nhc directory for the debugfs interface related entry
for that. So the nhc framework offers some support e.g. enable compression
for nhc xy.

2. Add all you nhc's _after_ all other nhc modules. This will occur that
the first ones has a higher priority. Our priority strategy is then
like the order of the list. See [0].

3. Add "default y" to all nhc's for support receiving always.


That's huge work, but maybe the next steps.

Otherwise it's looking good and let the NHC framework as first known
about these next header compressions, so:

Acked-by: Alexander Aring <[email protected]>

- Alex

[0] http://lxr.free-electrons.com/source/net/6lowpan/core.c#L24

2015-11-25 15:18:49

by Jukka Rissanen

[permalink] [raw]
Subject: Re: [PATCH v2 bluetooth-next 0/7] GHC compression detection

Hi Stefan,

On Wed, 2015-11-25 at 15:59 +0100, Stefan Schmidt wrote:
> Hello.
>
> This is a first stab at RFC7400. So far we only hook into the NHC
> framework to
> detect the registered GHC types (extension headers, UDP and ICMPv6).
> This is aligned with how we detect the NHC frames.
>
> Changes since v1:
>         o Use correct NEXTHDR defines for LOWPAN_NHC()
>         o Split out different extension headers into one module each
>         o Add some help text for configure options
>
> Changes since RFC:
>         o prefixed new files with nhc_ to stay in line with other nhc
> modules
>         o added linux-bluetooth to CC


looks good and simple so far :)

Acked-by: Jukka Rissanen <[email protected]>


Cheers,
Jukka


2015-11-25 14:59:17

by Stefan Schmidt

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

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

diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index 13abcc5..bcb9d8a 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -87,4 +87,10 @@ config 6LOWPAN_GHC_EXT_HDR_FRAG
6LoWPAN IPv6 fragmentation option generic header compression
according to RFC7400.

+config 6LOWPAN_GHC_EXT_HDR_ROUTE
+ tristate "GHC Routing Options Header Support"
+ ---help---
+ 6LoWPAN IPv6 routing option generic header compression according
+ to RFC7400.
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index fb3f48d..9e35a5d 100644
--- a/net/6lowpan/Makefile
+++ b/net/6lowpan/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o
obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_DEST) += nhc_ghc_ext_dest.o
obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG) += nhc_ghc_ext_frag.o
+obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE) += nhc_ghc_ext_route.o
diff --git a/net/6lowpan/nhc_ghc_ext_route.c b/net/6lowpan/nhc_ghc_ext_route.c
new file mode 100644
index 0000000..d7e5bd7
--- /dev/null
+++ b/net/6lowpan/nhc_ghc_ext_route.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_EXT_ROUTE_IDLEN 1
+#define LOWPAN_GHC_EXT_ROUTE_ID_0 0xb2
+#define LOWPAN_GHC_EXT_ROUTE_MASK_0 0xfe
+
+static void route_ghid_setup(struct lowpan_nhc *nhc)
+{
+ nhc->id[0] = LOWPAN_GHC_EXT_ROUTE_ID_0;
+ nhc->idmask[0] = LOWPAN_GHC_EXT_ROUTE_MASK_0;
+}
+
+LOWPAN_NHC(ghc_ext_route, "RFC7400 Routing Extension Header", NEXTHDR_ROUTING,
+ 0, route_ghid_setup, LOWPAN_GHC_EXT_ROUTE_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_ext_route);
+MODULE_DESCRIPTION("6LoWPAN generic header routing extension compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-11-25 14:59:16

by Stefan Schmidt

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

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

diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index e5184e6..13abcc5 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -81,4 +81,10 @@ config 6LOWPAN_GHC_EXT_HDR_DEST
6LoWPAN IPv6 destination option generic header compression according
to RFC7400.

+config 6LOWPAN_GHC_EXT_HDR_FRAG
+ tristate "GHC Fragmentation Options Header Support"
+ ---help---
+ 6LoWPAN IPv6 fragmentation option generic header compression
+ according to RFC7400.
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index fc4bac0..fb3f48d 100644
--- a/net/6lowpan/Makefile
+++ b/net/6lowpan/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_HOP) += nhc_ghc_ext_hop.o
obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o
obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_DEST) += nhc_ghc_ext_dest.o
+obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG) += nhc_ghc_ext_frag.o
diff --git a/net/6lowpan/nhc_ghc_ext_frag.c b/net/6lowpan/nhc_ghc_ext_frag.c
new file mode 100644
index 0000000..1308b79
--- /dev/null
+++ b/net/6lowpan/nhc_ghc_ext_frag.c
@@ -0,0 +1,28 @@
+/*
+ * 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_EXT_FRAG_IDLEN 1
+#define LOWPAN_GHC_EXT_FRAG_ID_0 0xb4
+#define LOWPAN_GHC_EXT_FRAG_MASK_0 0xfe
+
+static void frag_ghid_setup(struct lowpan_nhc *nhc)
+{
+ nhc->id[0] = LOWPAN_GHC_EXT_FRAG_ID_0;
+ nhc->idmask[0] = LOWPAN_GHC_EXT_FRAG_MASK_0;
+}
+
+LOWPAN_NHC(ghc_ext_frag, "RFC7400 Fragmentation Extension Header",
+ NEXTHDR_FRAGMENT, 0, frag_ghid_setup,
+ LOWPAN_GHC_EXT_FRAG_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_ext_frag);
+MODULE_DESCRIPTION("6LoWPAN generic header fragmentation extension compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-11-25 14:59:15

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH v2 bluetooth-next 5/7] 6lowpan: add nhc module for GHC destination extension header detection

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

diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index 0a3f5a8..e5184e6 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -75,4 +75,10 @@ config 6LOWPAN_GHC_ICMPV6
---help---
6LoWPAN IPv6 ICMPv6 generic header compression according to RFC7400.

+config 6LOWPAN_GHC_EXT_HDR_DEST
+ tristate "GHC Destination Options Header Support"
+ ---help---
+ 6LoWPAN IPv6 destination option generic header compression according
+ to RFC7400.
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index 86af3fd..fc4bac0 100644
--- a/net/6lowpan/Makefile
+++ b/net/6lowpan/Makefile
@@ -15,3 +15,4 @@ obj-$(CONFIG_6LOWPAN_NHC_UDP) += nhc_udp.o
obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_HOP) += nhc_ghc_ext_hop.o
obj-$(CONFIG_6LOWPAN_GHC_UDP) += nhc_ghc_udp.o
obj-$(CONFIG_6LOWPAN_GHC_ICMPV6) += nhc_ghc_icmpv6.o
+obj-$(CONFIG_6LOWPAN_GHC_EXT_HDR_DEST) += nhc_ghc_ext_dest.o
diff --git a/net/6lowpan/nhc_ghc_ext_dest.c b/net/6lowpan/nhc_ghc_ext_dest.c
new file mode 100644
index 0000000..9887b3a
--- /dev/null
+++ b/net/6lowpan/nhc_ghc_ext_dest.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_EXT_DEST_IDLEN 1
+#define LOWPAN_GHC_EXT_DEST_ID_0 0xb6
+#define LOWPAN_GHC_EXT_DEST_MASK_0 0xfe
+
+static void dest_ghid_setup(struct lowpan_nhc *nhc)
+{
+ nhc->id[0] = LOWPAN_GHC_EXT_DEST_ID_0;
+ nhc->idmask[0] = LOWPAN_GHC_EXT_DEST_MASK_0;
+}
+
+LOWPAN_NHC(ghc_ext_dest, "RFC7400 Destination Extension Header", NEXTHDR_DEST,
+ 0, dest_ghid_setup, LOWPAN_GHC_EXT_DEST_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_ext_dest);
+MODULE_DESCRIPTION("6LoWPAN generic header destination extension compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-11-25 14:59:14

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH v2 bluetooth-next 4/7] 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 94d5178..0a3f5a8 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -70,4 +70,9 @@ config 6LOWPAN_GHC_UDP
---help---
6LoWPAN IPv6 UDP generic header compression according to RFC7400.

+config 6LOWPAN_GHC_ICMPV6
+ tristate "GHC ICMPv6 Support"
+ ---help---
+ 6LoWPAN IPv6 ICMPv6 generic header compression according to RFC7400.
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index 5e4f2f3..86af3fd 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_EXT_HDR_HOP) += nhc_ghc_ext_hop.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..32e7c2c
--- /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_ICMP, 0,
+ icmpv6_ghid_setup, LOWPAN_GHC_ICMPV6_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_icmpv6);
+MODULE_DESCRIPTION("6LoWPAN generic header ICMPv6 compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-11-25 14:59:13

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH v2 bluetooth-next 3/7] 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 1bd49eb..94d5178 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -65,4 +65,9 @@ config 6LOWPAN_GHC_EXT_HDR_HOP
6LoWPAN IPv6 Hop-by-Hop option generic header compression according
to RFC7400.

+config 6LOWPAN_GHC_UDP
+ tristate "GHC UDP Support"
+ ---help---
+ 6LoWPAN IPv6 UDP generic header compression according to RFC7400.
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index ba20e01..5e4f2f3 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_EXT_HDR_HOP) += nhc_ghc_ext_hop.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..17beefa
--- /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_UDP, 0,
+ udp_ghid_setup, LOWPAN_GHC_UDP_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_udp);
+MODULE_DESCRIPTION("6LoWPAN generic header UDP compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-11-25 14:59:12

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH v2 bluetooth-next 2/7] 6lowpan: add nhc module for GHC hop-by-hopextension header detection

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

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

+config 6LOWPAN_GHC_EXT_HDR_HOP
+ tristate "GHC Hop-by-Hop Options Header Support"
+ ---help---
+ 6LoWPAN IPv6 Hop-by-Hop option generic header compression according
+ to RFC7400.
+
endif
diff --git a/net/6lowpan/Makefile b/net/6lowpan/Makefile
index c6ffc55..ba20e01 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_EXT_HDR_HOP) += nhc_ghc_ext_hop.o
diff --git a/net/6lowpan/nhc_ghc_ext_hop.c b/net/6lowpan/nhc_ghc_ext_hop.c
new file mode 100644
index 0000000..baec86f
--- /dev/null
+++ b/net/6lowpan/nhc_ghc_ext_hop.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_EXT_HOP_IDLEN 1
+#define LOWPAN_GHC_EXT_HOP_ID_0 0xb0
+#define LOWPAN_GHC_EXT_HOP_MASK_0 0xfe
+
+static void hop_ghid_setup(struct lowpan_nhc *nhc)
+{
+ nhc->id[0] = LOWPAN_GHC_EXT_HOP_ID_0;
+ nhc->idmask[0] = LOWPAN_GHC_EXT_HOP_MASK_0;
+}
+
+LOWPAN_NHC(ghc_ext_hop, "RFC7400 Hop-by-Hop Extension Header", NEXTHDR_HOP, 0,
+ hop_ghid_setup, LOWPAN_GHC_EXT_HOP_IDLEN, NULL, NULL);
+
+module_lowpan_nhc(ghc_ext_hop);
+MODULE_DESCRIPTION("6LoWPAN generic header hop-by-hop extension compression");
+MODULE_LICENSE("GPL");
--
2.4.3


2015-11-25 14:59:11

by Stefan Schmidt

[permalink] [raw]
Subject: [PATCH v2 bluetooth-next 1/7] 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