diff --git a/drivers/netdev_ieee802154/netdev_ieee802154.c b/drivers/netdev_ieee802154/netdev_ieee802154.c index 36259430c1..9c04a19be2 100644 --- a/drivers/netdev_ieee802154/netdev_ieee802154.c +++ b/drivers/netdev_ieee802154/netdev_ieee802154.c @@ -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);