[PATCH net-next 05/15] 6lowpan: use short IEEE 802.15.4 addresses for broadcast destination

Subsystems: ieee 802.15.4 subsystem, networking [general], the rest

STALE5095d

2 messages, 2 authors, 2012-10-23 · open the first message on its own page

[PATCH net-next 05/15] 6lowpan: use short IEEE 802.15.4 addresses for broadcast destination

From: Tony Cheneau <hidden>
Date: 2012-10-23 04:09:47

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 <redacted>
---
 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);
-- 
1.7.8.6


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct

Re: [PATCH net-next 05/15] 6lowpan: use short IEEE 802.15.4 addresses for broadcast destination

From: Jan Ceuleers <hidden>
Date: 2012-10-23 07:10:14

On 10/23/2012 06:09 AM, Tony Cheneau wrote:
quoted hunk
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 <redacted>
---
 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 */
David likes comments in the networking code to look

		/* Like
		 * this
		 */

Note that the comment is closed on a line by itself. There's an example
at the top of this hunk.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help