[riot-notifications] [RIOT-OS/RIOT] net/gnrc/netif: Added CC1xxx adaption layer (#10638)

Marian Buschsieweke notifications at github.com
Wed Jan 9 18:08:10 CET 2019


maribu commented on this pull request.



> +    /* get the payload size and the dst address details */
+    size = gnrc_pkt_len(pkt->next);
+    DEBUG("[cc1xxx-gnrc] send: payload of packet is %i\n", (int)size);
+    netif_hdr = (gnrc_netif_hdr_t *)pkt->data;
+
+
+    l2hdr.src_addr = cc1xxx_dev->addr;
+    if (netif_hdr->flags & BCAST) {
+        l2hdr.dest_addr = 0x00;
+        DEBUG("[cc1xxx-gnrc] send: preparing to send broadcast\n");
+    }
+    else {
+        /* check that destination address is valid */
+        assert(netif_hdr->dst_l2addr_len > 0);
+        uint8_t *addr = gnrc_netif_hdr_get_dst_addr(netif_hdr);
+        l2hdr.dest_addr = addr[netif_hdr->dst_l2addr_len - 1];

Cargo cult programming I guess:

https://github.com/RIOT-OS/RIOT/blob/d99d72c583789bba3d8696274358af2d52d19ac9/drivers/cc110x/gnrc_cc110x/gnrc_cc110x.c#L60-L61

Btw: Would it not be better to even use

```
assert(netif_hdr->dst_l2addr_len == 0);
uint8_t *addr = gnrc_netif_hdr_get_dst_addr(netif_hdr);
l2hdr.dest_addr = addr[0];
```
(Note the change assert.) For CC1xxx devices Layer 2 addresses will always be 1 byte long

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10638#discussion_r246455466
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190109/238aac10/attachment.html>


More information about the notifications mailing list