aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorTony Cheneau <tony.cheneau@amnesiak.org>2013-03-25 13:59:25 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-26 12:37:56 -0400
commit58ef67c318ac1e83a7a333f66403d777e7447461 (patch)
tree51e026666b29d25ab5c1e730dbf485eac14d57ee /net/ieee802154
parentcf692061d0d575f1b9b614555ca392d8b8eabab3 (diff)
6lowpan: use short IEEE 802.15.4 addresses for broadcast destination
The IEEE 802.15.4 standard uses the 0xFFFF short address (2 bytes) for message broadcasting. Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/6lowpan.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
index e7f61de2459a..0eebb960e11d 100644
--- a/net/ieee802154/6lowpan.c
+++ b/net/ieee802154/6lowpan.c
@@ -572,21 +572,28 @@ static int lowpan_header_create(struct sk_buff *skb,
572 * this isn't implemented in mainline yet, so currently we assign 0xff 572 * this isn't implemented in mainline yet, so currently we assign 0xff
573 */ 573 */
574 { 574 {
575 mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA;
576
575 /* prepare wpan address data */ 577 /* prepare wpan address data */
576 sa.addr_type = IEEE802154_ADDR_LONG; 578 sa.addr_type = IEEE802154_ADDR_LONG;
577 sa.pan_id = 0xff; 579 sa.pan_id = 0xff;
578
579 da.addr_type = IEEE802154_ADDR_LONG;
580 da.pan_id = 0xff;
581
582 memcpy(&(da.hwaddr), daddr, 8);
583 memcpy(&(sa.hwaddr), saddr, 8); 580 memcpy(&(sa.hwaddr), saddr, 8);
584 581
585 mac_cb(skb)->flags = IEEE802154_FC_TYPE_DATA; 582 da.pan_id = 0xff;
583 /*
584 * if the destination address is the broadcast address, use the
585 * corresponding short address
586 */
587 if (lowpan_is_addr_broadcast(daddr)) {
588 da.addr_type = IEEE802154_ADDR_SHORT;
589 da.short_addr = IEEE802154_ADDR_BROADCAST;
590 } else {
591 da.addr_type = IEEE802154_ADDR_LONG;
592 memcpy(&(da.hwaddr), daddr, 8);
586 593
587 /* request acknowledgment when possible */ 594 /* request acknowledgment */
588 if (!lowpan_is_addr_broadcast(daddr))
589 mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ; 595 mac_cb(skb)->flags |= MAC_CB_FLAG_ACKREQ;
596 }
590 597
591 return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev, 598 return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
592 type, (void *)&da, (void *)&sa, skb->len); 599 type, (void *)&da, (void *)&sa, skb->len);