Skip to content
Snippets Groups Projects
Unverified Commit e888e47a authored by Martine Lenders's avatar Martine Lenders Committed by GitHub
Browse files

Merge pull request #8325 from miri64/gnrc_netif/enh/add-nrfmin-iid

 gnrc_netif: add nrfmin IID support
parents b0b79800 c6833704
No related branches found
No related tags found
No related merge requests found
......@@ -775,6 +775,21 @@ int gnrc_netif_ipv6_group_idx(gnrc_netif_t *netif, const ipv6_addr_t *addr)
return idx;
}
#if defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_CC110X) || \
defined(MODULE_NRFMIN)
static void _create_iid_from_short(const gnrc_netif_t *netif, eui64_t *eui64)
{
const unsigned offset = sizeof(eui64_t) - netif->l2addr_len;
assert(netif->l2addr_len <= 3);
memset(eui64->uint8, 0, sizeof(eui64->uint8));
eui64->uint8[3] = 0xff;
eui64->uint8[4] = 0xfe;
memcpy(&eui64->uint8[offset], netif->l2addr, netif->l2addr_len);
}
#endif /* defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_CC110X) ||
* defined(MODULE_NRFMIN) */
int gnrc_netif_ipv6_get_iid(gnrc_netif_t *netif, eui64_t *eui64)
{
#if GNRC_NETIF_L2ADDR_MAXLEN > 0
......@@ -797,14 +812,7 @@ int gnrc_netif_ipv6_get_iid(gnrc_netif_t *netif, eui64_t *eui64)
case NETDEV_TYPE_IEEE802154:
switch (netif->l2addr_len) {
case IEEE802154_SHORT_ADDRESS_LEN:
eui64->uint8[0] = 0x0;
eui64->uint8[1] = 0x0;
eui64->uint8[2] = 0x0;
eui64->uint8[3] = 0xff;
eui64->uint8[4] = 0xfe;
eui64->uint8[5] = 0x0;
eui64->uint8[6] = netif->l2addr[0];
eui64->uint8[7] = netif->l2addr[1];
_create_iid_from_short(netif, eui64);
return 0;
case IEEE802154_LONG_ADDRESS_LEN:
memcpy(eui64, netif->l2addr, sizeof(eui64_t));
......@@ -817,17 +825,10 @@ int gnrc_netif_ipv6_get_iid(gnrc_netif_t *netif, eui64_t *eui64)
}
break;
#endif
#ifdef MODULE_CC110X
#if defined(MODULE_CC110X) || defined(MODULE_NRFMIN)
case NETDEV_TYPE_CC110X:
assert(netif->l2addr_len == 1U);
eui64->uint8[0] = 0x0;
eui64->uint8[1] = 0x0;
eui64->uint8[2] = 0x0;
eui64->uint8[3] = 0xff;
eui64->uint8[4] = 0xfe;
eui64->uint8[5] = 0x0;
eui64->uint8[6] = 0x0;
eui64->uint8[7] = netif->l2addr[0];
case NETDEV_TYPE_NRFMIN:
_create_iid_from_short(netif, eui64);
return 0;
#endif
default:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment