1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

gnrc_netif: assert that l2addr_len is 0 without address

If the device provides an address length, but no address it is
obviously faulty.
This commit is contained in:
Martine Lenders 2018-09-24 14:00:16 +02:00 committed by Martine Lenders
parent b0e541593f
commit 05aa8ab66b

View File

@ -1192,6 +1192,11 @@ static void _update_l2addr_from_dev(gnrc_netif_t *netif)
if (res != -ENOTSUP) {
netif->flags |= GNRC_NETIF_FLAGS_HAS_L2ADDR;
}
else {
/* If no address is provided but still an address length given above,
* we are in an invalid state */
assert(netif->l2addr_len == 0);
}
if (res > 0) {
netif->l2addr_len = res;
}