6lowpan: pending patches
Subsystems (7)
Alexander Aring
maintainercover 6lowpan: pending patches
Hi,
these are the current pending patches for 6lowpan based on bluetooth-next. It contains the following new features:
- per interface debugfs support, useful to add settings to offers a fast/simple userspace api for debugging.
- register of available NHC compression by IANA, see [0].
- Adding "ipv6_addr_prefix_copy" functionality for upcoming IPHC stateful compression.
- Alex
[0] https://www.iana.org/assignments/_6lowpan-parameters/_6lowpan-parameters.xhtml#lowpan_nhc
Alexander Aring (3):
6lowpan: add lowpan dev register helpers
6lowpan: add debugfs support
ipv6: add ipv6_addr_prefix_copy
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
include/net/6lowpan.h | 10 ++++++- include/net/ipv6.h | 15 +++++++++++ net/6lowpan/6lowpan_i.h | 28 +++++++++++++++++++ net/6lowpan/Kconfig | 47 ++++++++++++++++++++++++++++++-- net/6lowpan/Makefile | 9 +++++++ net/6lowpan/core.c | 59 +++++++++++++++++++++++++++++++++++++++-- net/6lowpan/debugfs.c | 53 ++++++++++++++++++++++++++++++++++++ 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 +++++++++++++++++++ net/bluetooth/6lowpan.c | 8 +++--- net/ieee802154/6lowpan/core.c | 6 ++--- 15 files changed, 384 insertions(+), 14 deletions(-) create mode 100644 net/6lowpan/6lowpan_i.h create mode 100644 net/6lowpan/debugfs.c 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
Signature · 1 line
2.6.1
A message that is not in the archive (sent off-list or not yet received): 1449697591-15991-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 1/10 6lowpan: clarify Kconfig entries for upcoming GHC support
From: Stefan Schmidt <[email protected]>
--- net/6lowpan/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/6lowpan/Kconfig +3 -2
@@ -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
Signature · 1 line
2.6.1
PATCH 2/10 6lowpan: add nhc module for GHC hop-by-hopextension header detection
In reply to a message not in the archiveFrom: 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
net/6lowpan/Kconfig +6 -0
@@ -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
net/6lowpan/Makefile +3 -0
@@ -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
net/6lowpan/nhc_ghc_ext_hop.c new file +27 -0
@@ -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" );
Signature · 1 line
2.6.1
PATCH 7/10 6lowpan: add nhc module for GHC routing extension header detection
In reply to a message not in the archiveFrom: 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
net/6lowpan/Kconfig +6 -0
@@ -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
net/6lowpan/Makefile +1 -0
@@ -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
net/6lowpan/nhc_ghc_ext_route.c new file +27 -0
@@ -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" );
Signature · 1 line
2.6.1
PATCH 8/10 6lowpan: add lowpan dev register helpers
In reply to a message not in the archiveThis patch introduces register and unregister functionality for lowpan interfaces. While register a lowpan interface there are several things which need to be initialize by the 6lowpan subsystem. Upcoming functionality need to register/unregister per interface components e.g. debugfs entry.
--- include/net/6lowpan.h | 7 ++++++- net/6lowpan/core.c | 33 +++++++++++++++++++++++++++++++-- net/bluetooth/6lowpan.c | 8 +++----- net/ieee802154/6lowpan/core.c | 6 ++---- 4 files changed, 42 insertions(+), 12 deletions(-)
include/net/6lowpan.h +6 -1
@@ -185,7 +185,12 @@ static inline void lowpan_push_hc_data(u8 **hc_ptr, const void *data, *hc_ptr += len; } -void lowpan_netdev_setup (struct net_device *dev,enum lowpan_lltypes lltype); +int lowpan_register_netdevice (struct net_device *dev, +enum lowpan_lltypes lltype); +int lowpan_register_netdev (struct net_device *dev, +enum lowpan_lltypes lltype); +void lowpan_unregister_netdevice (struct net_device *dev); +void lowpan_unregister_netdev (struct net_device *dev);/** * lowpan_header_decompress - replace 6LoWPAN header with IPv6 header
net/6lowpan/core.c +31 -2
@@ -15,7 +15,8 @@#include <net/6lowpan.h> -void lowpan_netdev_setup (struct net_device *dev,enum lowpan_lltypes lltype) +int lowpan_register_netdevice (struct net_device *dev, +enum lowpan_lltypes lltype) { dev->addr_len =EUI64_ADDR_LEN ; dev->type =ARPHRD_6LOWPAN ;
@@ -23,8 +24,36 @@ void lowpan_netdev_setup(struct net_device *dev, enum lowpan_lltypes lltype) dev->priv_flags |=IFF_NO_QUEUE ;lowpan_priv (dev)->lltype = lltype; + +return register_netdevice (dev); +} +EXPORT_SYMBOL (lowpan_register_netdevice); + +int lowpan_register_netdev (struct net_device *dev, +enum lowpan_lltypes lltype) +{ +int ret; + +rtnl_lock (); + ret =lowpan_register_netdevice (dev, lltype); +rtnl_unlock (); +return ret; +} +EXPORT_SYMBOL (lowpan_register_netdev); + +void lowpan_unregister_netdevice (struct net_device *dev) +{ +unregister_netdevice (dev); +} +EXPORT_SYMBOL (lowpan_unregister_netdevice); + +void lowpan_unregister_netdev (struct net_device *dev) +{ +rtnl_lock (); +lowpan_unregister_netdevice (dev); +rtnl_unlock (); } -EXPORT_SYMBOL (lowpan_netdev_setup); +EXPORT_SYMBOL (lowpan_unregister_netdev);static int __init lowpan_module_init (void ) {
net/bluetooth/6lowpan.c +3 -5
@@ -825,9 +825,7 @@ static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev)list_add_rcu (&(*dev)->list, &bt_6lowpan_devices);spin_unlock (&devices_lock); -lowpan_netdev_setup (netdev,LOWPAN_LLTYPE_BTLE ); - - err =register_netdev (netdev); + err =lowpan_register_netdev (netdev,LOWPAN_LLTYPE_BTLE );if (err <0 ) {BT_INFO ("register_netdev failed %d" , err);spin_lock (&devices_lock);
@@ -890,7 +888,7 @@ static void delete_netdev(struct work_struct *work) struct lowpan_dev *entry = container_of(work, struct lowpan_dev, delete_netdev); -unregister_netdev (entry->netdev); +lowpan_unregister_netdev (entry->netdev);/* The entry pointer is deleted by the netdev destructor. */ }
@@ -1348,7 +1346,7 @@ static void disconnect_devices(void)ifdown (entry->netdev);BT_DBG ("Unregistering netdev %s %p" , entry->netdev->name, entry->netdev); -unregister_netdev (entry->netdev); +lowpan_unregister_netdev (entry->netdev);kfree (entry); } }
net/ieee802154/6lowpan/core.c +2 -4
@@ -161,9 +161,7 @@ static int lowpan_newlink(struct net *src_net, struct net_device *ldev, wdev->needed_headroom; ldev->needed_tailroom = wdev->needed_tailroom; -lowpan_netdev_setup (ldev,LOWPAN_LLTYPE_IEEE802154 ); - - ret =register_netdevice (ldev); + ret =lowpan_register_netdevice (ldev,LOWPAN_LLTYPE_IEEE802154 );if (ret <0 ) {dev_put (wdev);return ret;
@@ -180,7 +178,7 @@ static void lowpan_dellink(struct net_device *ldev, struct list_head *head)ASSERT_RTNL (); wdev->ieee802154_ptr->lowpan_dev =NULL ; -unregister_netdevice (ldev); +lowpan_unregister_netdevice (ldev);dev_put (wdev); }
Signature · 1 line
2.6.1
PATCH 9/10 6lowpan: add debugfs support
In reply to a message not in the archiveThis patch will introduce a 6lowpan entry into the debugfs if enabled. Inside this 6lowpan directory we create a subdirectories of all 6lowpan interfaces to offer a per interface debugfs support.
--- include/net/6lowpan.h | 3 +++ net/6lowpan/6lowpan_i.h | 28 ++++++++++++++++++++++++++ net/6lowpan/Kconfig | 8 ++++++++ net/6lowpan/Makefile | 1 + net/6lowpan/core.c | 28 +++++++++++++++++++++++++- net/6lowpan/debugfs.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 net/6lowpan/6lowpan_i.h create mode 100644 net/6lowpan/debugfs.c
include/net/6lowpan.h +3 -0
@@ -53,6 +53,8 @@#ifndef __6LOWPAN_H__#define __6LOWPAN_H__ +#include <linux/debugfs.h> +#include <net/ipv6.h> #include <net/net_namespace.h>
@@ -98,6 +100,7 @@ enum lowpan_lltypes {struct lowpan_priv {enum lowpan_lltypes lltype; +struct dentry *iface_debugfs;/* must be last */ u8 priv[0 ]__aligned(sizeof(void *)) ;
net/6lowpan/6lowpan_i.h new file +28 -0
@@ -0,0 +1,28 @@ +#ifndef __6LOWPAN_I_H +#define __6LOWPAN_I_H + +#include <linux/netdevice.h> + +#ifdef CONFIG_6LOWPAN_DEBUGFS +int lowpan_dev_debugfs_init (struct net_device *dev); +void lowpan_dev_debugfs_exit (struct net_device *dev); + +int __init lowpan_debugfs_init (void ); +void lowpan_debugfs_exit (void ); +#else +static inline int lowpan_dev_debugfs_init (struct net_device *dev) +{ +return 0 ; +} + +static inline void lowpan_dev_debugfs_exit (struct net_device *dev) { } + +static inline int __init lowpan_debugfs_init (void ) +{ +return 0 ; +} + +static inline void lowpan_debugfs_exit (void ) { } +#endif /* CONFIG_6LOWPAN_DEBUGFS */ + +#endif /* __6LOWPAN_I_H */
net/6lowpan/Kconfig +8 -0
@@ -5,6 +5,14 @@ menuconfig 6LOWPAN This enables IPv6 over Low power Wireless Personal Area Network - "6LoWPAN" which is supported by IEEE 802.15.4 or Bluetooth stacks. +config 6LOWPAN_DEBUGFS + bool "6LoWPAN debugfs support" + depends on 6LOWPAN + depends on DEBUG_FS + ---help--- + This enables 6LoWPAN debugfs support. For example to manipulate + IPHC context information at runtime. + menuconfig 6LOWPAN_NHC tristate "Next Header and Generic Header Compression Support" depends on 6LOWPAN
net/6lowpan/Makefile +1 -0
@@ -1,6 +1,7 @@ obj-$(CONFIG_6LOWPAN) += 6lowpan.o 6lowpan-y := core.o iphc.o nhc.o +6lowpan-$(CONFIG_6LOWPAN_DEBUGFS) += debugfs.o #rfc6282 nhcs obj-$(CONFIG_6LOWPAN_NHC_DEST) += nhc_dest.o
net/6lowpan/core.c +27 -1
@@ -15,9 +15,13 @@#include <net/6lowpan.h> +#include "6lowpan_i.h" +int lowpan_register_netdevice (struct net_device *dev,enum lowpan_lltypes lltype) { +int ret; + dev->addr_len =EUI64_ADDR_LEN ; dev->type =ARPHRD_6LOWPAN ; dev->mtu =IPV6_MIN_MTU ;
@@ -25,7 +29,15 @@ int lowpan_register_netdevice(struct net_device *dev,lowpan_priv (dev)->lltype = lltype; -return register_netdevice (dev); + ret =lowpan_dev_debugfs_init (dev); +if (ret <0 ) +return ret; + + ret =register_netdevice (dev); +if (ret <0 ) +lowpan_dev_debugfs_exit (dev); + +return ret; }EXPORT_SYMBOL (lowpan_register_netdevice);
@@ -44,6 +56,7 @@ EXPORT_SYMBOL(lowpan_register_netdev);void lowpan_unregister_netdevice (struct net_device *dev) {unregister_netdevice (dev); +lowpan_dev_debugfs_exit (dev); }EXPORT_SYMBOL (lowpan_unregister_netdevice);
@@ -57,6 +70,12 @@ EXPORT_SYMBOL(lowpan_unregister_netdev);static int __init lowpan_module_init (void ) { +int ret; + + ret =lowpan_debugfs_init (); +if (ret <0 ) +return ret; +request_module_nowait ("ipv6" );request_module_nowait ("nhc_dest" );
@@ -69,6 +88,13 @@ static int __init lowpan_module_init(void)return 0 ; } + +static void __exit lowpan_module_exit(void) +{ +lowpan_debugfs_exit (); +} +module_init (lowpan_module_init); +module_exit (lowpan_module_exit);MODULE_LICENSE ("GPL" );
net/6lowpan/debugfs.c new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.6.1
Alexander Aring
maintainerPATCH 3/10 6lowpan: add nhc module for GHC UDP detection
In reply to Alexander AringFrom: 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
net/6lowpan/Kconfig +5 -0
@@ -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
net/6lowpan/Makefile +1 -0
@@ -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
net/6lowpan/nhc_ghc_udp.c new file +27 -0
@@ -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" );
Signature · 1 line
2.6.1
Alexander Aring
maintainerPATCH 4/10 6lowpan: add nhc module for GHC ICMPv6 detection
In reply to Alexander AringFrom: 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
net/6lowpan/Kconfig +5 -0
@@ -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
net/6lowpan/Makefile +1 -0
@@ -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
net/6lowpan/nhc_ghc_icmpv6.c new file +27 -0
@@ -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" );
Signature · 1 line
2.6.1
Alexander Aring
maintainerPATCH 5/10 6lowpan: add nhc module for GHC destination extension header detection
In reply to Alexander AringFrom: 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
net/6lowpan/Kconfig +6 -0
@@ -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
net/6lowpan/Makefile +1 -0
@@ -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
net/6lowpan/nhc_ghc_ext_dest.c new file +27 -0
@@ -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" );
Signature · 1 line
2.6.1
Alexander Aring
maintainerPATCH 6/10 6lowpan: add nhc module for GHC fragmentation extension header detection
In reply to Alexander AringFrom: 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
net/6lowpan/Kconfig +6 -0
@@ -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
net/6lowpan/Makefile +1 -0
@@ -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
net/6lowpan/nhc_ghc_ext_frag.c new file +28 -0
@@ -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" );
Signature · 1 line
2.6.1
Alexander Aring
maintainerPATCH 10/10 ipv6: add ipv6_addr_prefix_copy
In reply to Alexander AringThis patch adds a static inline function ipv6_addr_prefix_copy which copies a ipv6 address prefix(argument pfx) into the ipv6 address prefix. The prefix len is given by plen as bits. This function mainly based on ipv6_addr_prefix which copies one address prefix from address into a new ipv6 address destination and zero all other address bits.
The difference is that ipv6_addr_prefix_copy don't get a prefix from an ipv6 address, it sets a prefix to an ipv6 address with keeping other address bits. The use case is for context based address compression inside 6LoWPAN IPHC header which keeping ipv6 prefixes inside a context table to lookup address-bits without sending them.
--- include/net/ipv6.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/net/ipv6.h +15 -0
@@ -401,6 +401,21 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx, pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); } +static inline void ipv6_addr_prefix_copy (struct in6_addr *addr, +const struct in6_addr *pfx, +int plen) +{ +/* caller must guarantee 0 <= plen <= 128 */ +int o = plen >>3 , + b = plen &0x7 ; + +memcpy (addr->s6_addr, pfx, o); +if (b !=0 ) { + addr->s6_addr[o] &= ~(0xff00 >> b); + addr->s6_addr[o] |= (pfx->s6_addr[o] & (0xff00 >> b)); + } +} +static inline void __ipv6_addr_set_half (__be32 *addr,__be32 wh,__be32 wl) {
Signature · 1 line
2.6.1
A message that is not in the archive (sent off-list or not yet received): 1449697591-15991-11-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [PATCH bluetooth-next 10/10] ipv6: add ipv6_addr_prefix_copy
Hi Dave,
Quoted 42 lines
This patch adds a static inline function
ipv6_addr_prefix_copywhich copies a ipv6 address prefix(argument pfx) into the ipv6 address prefix. The prefix len is given by plen as bits. This function mainly based onipv6_addr_prefixwhich copies one address prefix from address into a new ipv6 address destination and zero all other address bits.The difference is that
ipv6_addr_prefix_copydon't get a prefix from an ipv6 address, it sets a prefix to an ipv6 address with keeping other address bits. The use case is for context based address compression inside 6LoWPAN IPHC header which keeping ipv6 prefixes inside a context table to lookup address-bits without sending them.Cc David S. Miller <[email protected]>Cc Alexey Kuznetsov <[email protected]>Cc James Morris <[email protected]>Cc Hideaki YOSHIFUJI <[email protected]>Cc Patrick McHardy <[email protected]>Acked-by Łukasz Duda <[email protected]>Reviewed-by Stefan Schmidt <[email protected]>Signed-off-by Alexander Aring <[email protected]>---
include/net/ipv6.h| 15 +++++++++++++++1 file changed, 15 insertions(+)include/net/ipv6.h +8
-0@@ -401,6 +401,21 @@ static inline void ipv6_addr_prefix(struct in6_addr *pfx, pfx->s6_addr[o] = addr->s6_addr[o] & (0xff00 >> b); } +static inline void ipv6_addr_prefix_copy (struct in6_addr *addr, +const struct in6_addr *pfx, +int plen) +{ +/* caller must guarantee 0 <= plen <= 128 */ +int o = plen >>3 , + b = plen &0x7 ; +
include/net/ipv6.h static inline void ipv6_addr_prefix(struct in6_addr *pfx, · line 421
Quoted 10 lines
include/net/ipv6.h +7
-0+memcpy (addr->s6_addr, pfx, o); +if (b !=0 ) { + addr->s6_addr[o] &= ~(0xff00 >> b); + addr->s6_addr[o] |= (pfx->s6_addr[o] & (0xff00 >> b)); + } +} +static inline void __ipv6_addr_set_half (__be32 *addr,__be32 wh,__be32 wl) {
if there are no objections, I would like to take this change through the bluetooth-next tree.
Regards
Marcel
A message that is not in the archive (sent off-list or not yet received): 64AE99C3-E5EB-47D8-9B0A-FA5B35E93CB2-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org
David Miller
Acked-byRe: [PATCH bluetooth-next 10/10] ipv6: add ipv6_addr_prefix_copy
From: Marcel Holtmann <[email protected]>
Date: Wed, 9 Dec 2015 14:28:38 -1000
Quoted 1 line
if there are no objections, I would like to take this change through the bluetooth-next tree.
No problem: