All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets
@ 2016-01-13 15:57 Lukasz Duda
  2016-01-14 10:30 ` Jukka Rissanen
  2016-01-23 12:27 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Duda @ 2016-01-13 15:57 UTC (permalink / raw)
  To: alex.aring; +Cc: linux-bluetooth, glenn.ruben.bakke

This patch fixes incorrect handling of the 6lowpan packets that contain
uncompressed IPv6 header.

RFC4944 specifies a special dispatch for 6lowpan to carry uncompressed
IPv6 header. This dispatch (1 byte long) has to be removed during
reception and skb data pointer has to be moved. To correctly point in
the beginning of the IPv6 header the dispatch byte has to be pulled off
before packet can be processed by netif_rx_in().

Test scenario: IPv6 packets are not correctly interpreted by the network
layer when IPv6 header is not compressed (e.g. ICMPv6 Echo Reply is not
propagated correctly to the ICMPv6 layer because the extra byte will make
the header look corrupted).

Similar approach is done for IEEE 802.15.4.

Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
Signed-off-by: Glenn Ruben Bakke <glenn.ruben.bakke@nordicsemi.no>
---
 net/bluetooth/6lowpan.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index d040365..350f379 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -307,6 +307,9 @@ static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
 
 	/* check that it's our buffer */
 	if (lowpan_is_ipv6(*skb_network_header(skb))) {
+		/* Pull off the 1-byte of 6lowpan header. */
+		skb_pull(skb, 1);
+
 		/* Copy the packet so that the IPv6 header is
 		 * properly aligned.
 		 */
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets
  2016-01-13 15:57 [PATCH] Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets Lukasz Duda
@ 2016-01-14 10:30 ` Jukka Rissanen
  2016-01-23 12:27 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Jukka Rissanen @ 2016-01-14 10:30 UTC (permalink / raw)
  To: Lukasz Duda, alex.aring; +Cc: linux-bluetooth, glenn.ruben.bakke

Hi,

good catch.

Acked-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>


On Wed, 2016-01-13 at 16:57 +0100, Lukasz Duda wrote:
> This patch fixes incorrect handling of the 6lowpan packets that
> contain
> uncompressed IPv6 header.
> 
> RFC4944 specifies a special dispatch for 6lowpan to carry
> uncompressed
> IPv6 header. This dispatch (1 byte long) has to be removed during
> reception and skb data pointer has to be moved. To correctly point in
> the beginning of the IPv6 header the dispatch byte has to be pulled
> off
> before packet can be processed by netif_rx_in().
> 
> Test scenario: IPv6 packets are not correctly interpreted by the
> network
> layer when IPv6 header is not compressed (e.g. ICMPv6 Echo Reply is
> not
> propagated correctly to the ICMPv6 layer because the extra byte will
> make
> the header look corrupted).
> 
> Similar approach is done for IEEE 802.15.4.
> 
> Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
> Signed-off-by: Glenn Ruben Bakke <glenn.ruben.bakke@nordicsemi.no>
> ---
>  net/bluetooth/6lowpan.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
> index d040365..350f379 100644
> --- a/net/bluetooth/6lowpan.c
> +++ b/net/bluetooth/6lowpan.c
> @@ -307,6 +307,9 @@ static int recv_pkt(struct sk_buff *skb, struct
> net_device *dev,
>  
>  	/* check that it's our buffer */
>  	if (lowpan_is_ipv6(*skb_network_header(skb))) {
> +		/* Pull off the 1-byte of 6lowpan header. */
> +		skb_pull(skb, 1);
> +
>  		/* Copy the packet so that the IPv6 header is
>  		 * properly aligned.
>  		 */


Cheers,
Jukka


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets
  2016-01-13 15:57 [PATCH] Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets Lukasz Duda
  2016-01-14 10:30 ` Jukka Rissanen
@ 2016-01-23 12:27 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2016-01-23 12:27 UTC (permalink / raw)
  To: Lukasz Duda; +Cc: alex.aring, linux-bluetooth, glenn.ruben.bakke

Hi Lukasz,

On Wed, Jan 13, 2016, Lukasz Duda wrote:
> This patch fixes incorrect handling of the 6lowpan packets that contain
> uncompressed IPv6 header.
> 
> RFC4944 specifies a special dispatch for 6lowpan to carry uncompressed
> IPv6 header. This dispatch (1 byte long) has to be removed during
> reception and skb data pointer has to be moved. To correctly point in
> the beginning of the IPv6 header the dispatch byte has to be pulled off
> before packet can be processed by netif_rx_in().
> 
> Test scenario: IPv6 packets are not correctly interpreted by the network
> layer when IPv6 header is not compressed (e.g. ICMPv6 Echo Reply is not
> propagated correctly to the ICMPv6 layer because the extra byte will make
> the header look corrupted).
> 
> Similar approach is done for IEEE 802.15.4.
> 
> Signed-off-by: Lukasz Duda <lukasz.duda@nordicsemi.no>
> Signed-off-by: Glenn Ruben Bakke <glenn.ruben.bakke@nordicsemi.no>
> ---
>  net/bluetooth/6lowpan.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied to bluetooth.git. Thanks.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-23 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-13 15:57 [PATCH] Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets Lukasz Duda
2016-01-14 10:30 ` Jukka Rissanen
2016-01-23 12:27 ` Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.