Skip to content

Commit

Permalink
6lowpan: nhc: add other known rfc6282 compressions
Browse files Browse the repository at this point in the history
This patch adds other known rfc6282 compression formats to the nhc
framework. These compression formats are known but not implemented yet.
For now this is useful to printout a warning which compression format
isn't supported.

Signed-off-by: Alexander Aring <[email protected]>
Cc: Martin Townsend <[email protected]>
Reviewed-by: Stefan Schmidt <[email protected]>
Acked-by: Jukka Rissanen <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
alexaring authored and holtmann committed Feb 14, 2015
1 parent cc6ed26 commit ff0fcc2
Show file tree
Hide file tree
Showing 9 changed files with 213 additions and 0 deletions.
38 changes: 38 additions & 0 deletions net/6lowpan/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,44 @@ menuconfig 6LOWPAN_NHC

if 6LOWPAN_NHC

config 6LOWPAN_NHC_DEST
tristate "Destination Options Header Support"
default y
---help---
6LoWPAN IPv6 Destination Options Header compression according to
RFC6282.

config 6LOWPAN_NHC_FRAGMENT
tristate "Fragment Header Support"
default y
---help---
6LoWPAN IPv6 Fragment Header compression according to RFC6282.

config 6LOWPAN_NHC_HOP
tristate "Hop-by-Hop Options Header Support"
default y
---help---
6LoWPAN IPv6 Hop-by-Hop Options Header compression according to
RFC6282.

config 6LOWPAN_NHC_IPV6
tristate "IPv6 Header Support"
default y
---help---
6LoWPAN IPv6 Header compression according to RFC6282.

config 6LOWPAN_NHC_MOBILITY
tristate "Mobility Header Support"
default y
---help---
6LoWPAN IPv6 Mobility Header compression according to RFC6282.

config 6LOWPAN_NHC_ROUTING
tristate "Routing Header Support"
default y
---help---
6LoWPAN IPv6 Routing Header compression according to RFC6282.

config 6LOWPAN_NHC_UDP
tristate "UDP Header Support"
default y
Expand Down
6 changes: 6 additions & 0 deletions net/6lowpan/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ obj-$(CONFIG_6LOWPAN) += 6lowpan.o
6lowpan-y := iphc.o nhc.o

#rfc6282 nhcs
obj-$(CONFIG_6LOWPAN_NHC_DEST) += nhc_dest.o
obj-$(CONFIG_6LOWPAN_NHC_FRAGMENT) += nhc_fragment.o
obj-$(CONFIG_6LOWPAN_NHC_HOP) += nhc_hop.o
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
6 changes: 6 additions & 0 deletions net/6lowpan/iphc.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,12 @@ EXPORT_SYMBOL_GPL(lowpan_header_compress);

static int __init lowpan_module_init(void)
{
request_module_nowait("nhc_dest");
request_module_nowait("nhc_fragment");
request_module_nowait("nhc_hop");
request_module_nowait("nhc_ipv6");
request_module_nowait("nhc_mobility");
request_module_nowait("nhc_routing");
request_module_nowait("nhc_udp");

return 0;
Expand Down
28 changes: 28 additions & 0 deletions net/6lowpan/nhc_dest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 6LoWPAN IPv6 Destination Options Header compression according to
* RFC6282
*
* 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_NHC_DEST_IDLEN 1
#define LOWPAN_NHC_DEST_ID_0 0xe6
#define LOWPAN_NHC_DEST_MASK_0 0xfe

static void dest_nhid_setup(struct lowpan_nhc *nhc)
{
nhc->id[0] = LOWPAN_NHC_DEST_ID_0;
nhc->idmask[0] = LOWPAN_NHC_DEST_MASK_0;
}

LOWPAN_NHC(nhc_dest, "RFC6282 Destination Options", NEXTHDR_DEST, 0,
dest_nhid_setup, LOWPAN_NHC_DEST_IDLEN, NULL, NULL);

module_lowpan_nhc(nhc_dest);
MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Destination Options compression");
MODULE_LICENSE("GPL");
27 changes: 27 additions & 0 deletions net/6lowpan/nhc_fragment.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 6LoWPAN IPv6 Fragment Header compression according to RFC6282
*
* 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_NHC_FRAGMENT_IDLEN 1
#define LOWPAN_NHC_FRAGMENT_ID_0 0xe4
#define LOWPAN_NHC_FRAGMENT_MASK_0 0xfe

static void fragment_nhid_setup(struct lowpan_nhc *nhc)
{
nhc->id[0] = LOWPAN_NHC_FRAGMENT_ID_0;
nhc->idmask[0] = LOWPAN_NHC_FRAGMENT_MASK_0;
}

LOWPAN_NHC(nhc_fragment, "RFC6282 Fragment", NEXTHDR_FRAGMENT, 0,
fragment_nhid_setup, LOWPAN_NHC_FRAGMENT_IDLEN, NULL, NULL);

module_lowpan_nhc(nhc_fragment);
MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Fragment compression");
MODULE_LICENSE("GPL");
27 changes: 27 additions & 0 deletions net/6lowpan/nhc_hop.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 6LoWPAN IPv6 Hop-by-Hop Options Header compression according to RFC6282
*
* 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_NHC_HOP_IDLEN 1
#define LOWPAN_NHC_HOP_ID_0 0xe0
#define LOWPAN_NHC_HOP_MASK_0 0xfe

static void hop_nhid_setup(struct lowpan_nhc *nhc)
{
nhc->id[0] = LOWPAN_NHC_HOP_ID_0;
nhc->idmask[0] = LOWPAN_NHC_HOP_MASK_0;
}

LOWPAN_NHC(nhc_hop, "RFC6282 Hop-by-Hop Options", NEXTHDR_HOP, 0,
hop_nhid_setup, LOWPAN_NHC_HOP_IDLEN, NULL, NULL);

module_lowpan_nhc(nhc_hop);
MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Hop-by-Hop Options compression");
MODULE_LICENSE("GPL");
27 changes: 27 additions & 0 deletions net/6lowpan/nhc_ipv6.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 6LoWPAN IPv6 Header compression according to RFC6282
*
* 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_NHC_IPV6_IDLEN 1
#define LOWPAN_NHC_IPV6_ID_0 0xee
#define LOWPAN_NHC_IPV6_MASK_0 0xfe

static void ipv6_nhid_setup(struct lowpan_nhc *nhc)
{
nhc->id[0] = LOWPAN_NHC_IPV6_ID_0;
nhc->idmask[0] = LOWPAN_NHC_IPV6_MASK_0;
}

LOWPAN_NHC(nhc_ipv6, "RFC6282 IPv6", NEXTHDR_IPV6, 0, ipv6_nhid_setup,
LOWPAN_NHC_IPV6_IDLEN, NULL, NULL);

module_lowpan_nhc(nhc_ipv6);
MODULE_DESCRIPTION("6LoWPAN next header RFC6282 IPv6 compression");
MODULE_LICENSE("GPL");
27 changes: 27 additions & 0 deletions net/6lowpan/nhc_mobility.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 6LoWPAN IPv6 Mobility Header compression according to RFC6282
*
* 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_NHC_MOBILITY_IDLEN 1
#define LOWPAN_NHC_MOBILITY_ID_0 0xe8
#define LOWPAN_NHC_MOBILITY_MASK_0 0xfe

static void mobility_nhid_setup(struct lowpan_nhc *nhc)
{
nhc->id[0] = LOWPAN_NHC_MOBILITY_ID_0;
nhc->idmask[0] = LOWPAN_NHC_MOBILITY_MASK_0;
}

LOWPAN_NHC(nhc_mobility, "RFC6282 Mobility", NEXTHDR_MOBILITY, 0,
mobility_nhid_setup, LOWPAN_NHC_MOBILITY_IDLEN, NULL, NULL);

module_lowpan_nhc(nhc_mobility);
MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Mobility compression");
MODULE_LICENSE("GPL");
27 changes: 27 additions & 0 deletions net/6lowpan/nhc_routing.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 6LoWPAN IPv6 Routing Header compression according to RFC6282
*
* 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_NHC_ROUTING_IDLEN 1
#define LOWPAN_NHC_ROUTING_ID_0 0xe2
#define LOWPAN_NHC_ROUTING_MASK_0 0xfe

static void routing_nhid_setup(struct lowpan_nhc *nhc)
{
nhc->id[0] = LOWPAN_NHC_ROUTING_ID_0;
nhc->idmask[0] = LOWPAN_NHC_ROUTING_MASK_0;
}

LOWPAN_NHC(nhc_routing, "RFC6282 Routing", NEXTHDR_ROUTING, 0,
routing_nhid_setup, LOWPAN_NHC_ROUTING_IDLEN, NULL, NULL);

module_lowpan_nhc(nhc_routing);
MODULE_DESCRIPTION("6LoWPAN next header RFC6282 Routing compression");
MODULE_LICENSE("GPL");

0 comments on commit ff0fcc2

Please sign in to comment.