1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #10537 from miri64/netdev_ieee802154/fix/get-iid

netdev_ieee802154: fix IID getter
This commit is contained in:
Martine Lenders 2018-12-11 15:59:52 +01:00 committed by GitHub
commit 6886ca54c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,18 +33,20 @@ static int _get_iid(netdev_ieee802154_t *dev, eui64_t *value, size_t max_len)
{
(void)max_len;
uint8_t *addr;
uint8_t addr[IEEE802154_LONG_ADDRESS_LEN];
uint16_t addr_len;
assert(max_len >= sizeof(eui64_t));
if (dev->flags & NETDEV_IEEE802154_SRC_MODE_LONG) {
addr_len = IEEE802154_LONG_ADDRESS_LEN;
addr = dev->long_addr;
dev->netdev.driver->get(&dev->netdev, NETOPT_SRC_LEN, &addr_len,
sizeof(addr_len));
if (addr_len == IEEE802154_LONG_ADDRESS_LEN) {
dev->netdev.driver->get(&dev->netdev, NETOPT_ADDRESS_LONG, addr,
addr_len);
}
else {
addr_len = IEEE802154_SHORT_ADDRESS_LEN;
addr = dev->short_addr;
dev->netdev.driver->get(&dev->netdev, NETOPT_ADDRESS, addr,
addr_len);
}
ieee802154_get_iid(value, addr, addr_len);