From patchwork Tue Oct 23 04:09:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Cheneau X-Patchwork-Id: 193335 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0C7732C0180 for ; Tue, 23 Oct 2012 15:23:49 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753966Ab2JWEXp (ORCPT ); Tue, 23 Oct 2012 00:23:45 -0400 Received: from ns.amnesiak.org ([95.130.11.136]:48534 "EHLO amnesiak.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754879Ab2JWEXL (ORCPT ); Tue, 23 Oct 2012 00:23:11 -0400 Received: from localhost (localhost [127.0.0.1]) by amnesiak.org (Postfix) with ESMTP id 8B2487E08; Tue, 23 Oct 2012 06:13:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=amnesiak.org; s=remotebox2; t=1350965604; bh=GaDAoBvhrQd7KL/10p7hDm26KO/O1k86Sw3LiZev5oY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=M/JKOf6yNeanz4YlmWXvXrFNoqHfB4fjBOa7lZ+1CQIVQyH4EjXdHoy/lGRXnjuq7 9+JnxlQqc8mk9itBoYMSUl43FXgcTsFdXkpbiBsTOIsqXPKPDgJj072D1UmQzwrSF1 ktQhShCdcv4FqrAahMQLDSsv5r4AupylmFj1ooVA= X-Virus-Scanned: amavisd-new at amnesiak.org Received: from amnesiak.org ([127.0.0.1]) by localhost (amnesiak.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CtyTGgWrT7tB; Tue, 23 Oct 2012 06:12:38 +0200 (CEST) Received: from localhost.localdomain (pool-71-163-77-244.washdc.east.verizon.net [71.163.77.244]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by amnesiak.org (Postfix) with ESMTPSA id 29F5A7E1C; Tue, 23 Oct 2012 06:12:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=amnesiak.org; s=remotebox2; t=1350965558; bh=GaDAoBvhrQd7KL/10p7hDm26KO/O1k86Sw3LiZev5oY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=A+zm79SZoMAo6T16hJdK72u9mE17Qr7WrPtngb2Lz7lIbZ3/Uo18utWFj91TlkEg/ UkyWi4TyWRMb/MF0FYuwTiLWcG1QkXuYHMafhZ4/Z7O/Ah1Y6I2h8Vm9LOynNzTcM2 bqKa08G1vnUuLwfWQk2KvQuf9ZU2IwCZZw220Jo8= From: Tony Cheneau To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-zigbee-devel@lists.sourceforge.net, Alan Ott , Alexander Smirnov Subject: [PATCH net-next 01/15] 6lowpan: lowpan_is_iid_16_bit_compressable() does not detect compressable address correctly Date: Tue, 23 Oct 2012 00:09:43 -0400 Message-Id: <1350965397-12384-2-git-send-email-tony.cheneau@amnesiak.org> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1350965397-12384-1-git-send-email-tony.cheneau@amnesiak.org> References: <1350965397-12384-1-git-send-email-tony.cheneau@amnesiak.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The current test is not RFC6282 compliant. The same issue has been found out and fixed in Contiki. This patch is basicaly a port of their fix. Signed-off-by: Tony Cheneau --- net/ieee802154/6lowpan.h | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h index 8c2251f..efd1a57 100644 --- a/net/ieee802154/6lowpan.h +++ b/net/ieee802154/6lowpan.h @@ -87,14 +87,16 @@ #define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE) /* - * check whether we can compress the IID to 16 bits, - * it's possible for unicast adresses with first 49 bits are zero only. - */ +* check whether we can compress the IID to 16 bits, +* it's possible for unicast adresses with first 49 bits are zero only. +*/ #define lowpan_is_iid_16_bit_compressable(a) \ ((((a)->s6_addr16[4]) == 0) && \ - (((a)->s6_addr16[5]) == 0) && \ - (((a)->s6_addr16[6]) == 0) && \ - ((((a)->s6_addr[14]) & 0x80) == 0)) + (((a)->s6_addr[10]) == 0) && \ + (((a)->s6_addr[11]) == 0xff) && \ + (((a)->s6_addr[12]) == 0xfe) && \ + (((a)->s6_addr[13]) == 0)) + /* multicast address */ #define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)