[riot-notifications] [RIOT-OS/RIOT] gnrc_ipv6_nib: use generated EUI-64 for ARO build and check (#10817)

Marian Buschsieweke notifications at github.com
Fri Jan 18 16:50:53 CET 2019

maribu commented on this pull request.

> +#endif /* defined(MODULE_CC110X) || defined(MODULE_NRFMIN) */
+int gnrc_netif_eui64_from_addr(const gnrc_netif_t *netif,
+                               const uint8_t *addr, size_t addr_len,
+                               eui64_t *eui64)
+    if (netif->flags & GNRC_NETIF_FLAGS_HAS_L2ADDR) {
+        switch (netif->device_type) {
+#if defined(MODULE_NETDEV_ETH) || defined(MODULE_ESP_NOW) || \
+            case NETDEV_TYPE_ETHERNET:
+            case NETDEV_TYPE_ESP_NOW:
+            case NETDEV_TYPE_BLE:
+                if (addr_len == sizeof(eui48_t)) {
+                    eui48_to_eui64(eui64, (const eui48_t *)addr);

The only options to fix I see are:

1. Change the signature of `gnrc_netif_eui64_from_addr` to require `addr` to be aligned to two bytes
2. Change the signature of `eui48_to_eui64` to handle entries aligned to one byte. (The code does so already anyway.)
3. memcpy into a temporary buffer which has adequate alignment

I would favor 2.

(Btw: This bug will never trigger currently, as `eui48_to_eui64` does not make use of the memory alignment of 2 bytes. But a change there could make the bug pop up.)

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190118/a4a7697d/attachment.html>

More information about the notifications mailing list