From patchwork Tue Oct 23 04:09:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Cheneau X-Patchwork-Id: 193329 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 691EC2C0180 for ; Tue, 23 Oct 2012 15:23:32 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756572Ab2JWEX0 (ORCPT ); Tue, 23 Oct 2012 00:23:26 -0400 Received: from ns.amnesiak.org ([95.130.11.136]:48538 "EHLO amnesiak.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755217Ab2JWEXM (ORCPT ); Tue, 23 Oct 2012 00:23:12 -0400 Received: from localhost (localhost [127.0.0.1]) by amnesiak.org (Postfix) with ESMTP id 2DDC87E44; Tue, 23 Oct 2012 06:14:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=amnesiak.org; s=remotebox2; t=1350965671; bh=U3dxUuWwOKYezBku3Fw+SMVFflXPdCdkm1R/uE3x3/4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=C5L20EthsP/K8leeaD1qiDMeGNQhnFWUTacsemT76BEUaUdlM7095J7ng/K6pg+KU GOiH/oFYOhe6jkvAu5LF1AUe7McACE5+Z0ZJGP953BtDtIAQ3/pZDtefJyl6p6oe04 qUngoIqc6NEVhSK8JXZwcKO7JE2stSjYhsKmy6Gw= 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 82KpW_XWr8yj; Tue, 23 Oct 2012 06:13:52 +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 9AEC57E2D; Tue, 23 Oct 2012 06:12:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=amnesiak.org; s=remotebox2; t=1350965563; bh=U3dxUuWwOKYezBku3Fw+SMVFflXPdCdkm1R/uE3x3/4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=skPmKXX1rThBHWfAesY05dpVxQcpUeeptC2F2AB+HeB5PjK4lw2CCBrqNrjQjfGg0 66zHH57qk1T2mvxa5UCyUghjRhO6vRfgPd7v14qgI3m68yQAFTCkhTfn+zucragSu8 6J6++VgdKgeYlTO7+MyavuidVidH5Wcuv3V0axOw= 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 05/15] 6lowpan: use short IEEE 802.15.4 addresses for broadcast destination Date: Tue, 23 Oct 2012 00:09:47 -0400 Message-Id: <1350965397-12384-6-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 It is intended that the IEEE 802.15.4 standard uses the 0xFFFF short address (2 bytes) for message broadcasting. Signed-off-by: Tony Cheneau --- net/ieee802154/6lowpan.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 49d91df..8a2ee95 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -577,21 +577,26 @@ static int lowpan_header_create(struct sk_buff *skb, * this isn't implemented in mainline yet, so currently we assign 0xff */ { + mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA; + /* prepare wpan address data */ sa.addr_type = IEEE802154_ADDR_LONG; sa.pan_id = 0xff; - - da.addr_type = IEEE802154_ADDR_LONG; - da.pan_id = 0xff; - - memcpy(&(da.hwaddr), daddr, 8); memcpy(&(sa.hwaddr), saddr, 8); - mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA; + da.pan_id = 0xff; + /* if the destination address is the broadcast address, + use short address */ + if (lowpan_is_addr_broadcast(daddr)) { + da.addr_type = IEEE802154_ADDR_SHORT; + da.short_addr = IEEE802154_ADDR_BROADCAST; + } else { + da.addr_type = IEEE802154_ADDR_LONG; + memcpy(&(da.hwaddr), daddr, 8); - /* request acknowledgment when possible */ - if (!lowpan_is_addr_broadcast(daddr)) + /* request acknowledgment */ mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ; + } return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev, type, (void *)&da, (void *)&sa, skb->len);