Netif: add netif_num overflow assert

This commit adds an LWIP_ASSERT to detect when netif_num overflows and
we no longer have unique numbers per netif.  Unique netif numbers are
needed to support interface indexes (task #14314)

The only cases where this could occur are with a deployment that attempts
to use the maximum 256 netifs at the same time or where netifs are being
constantly adding and removed.  Neither of these use cases fit the
lightweight goals of LwIP

See discussion in task #14314 for more details
This commit is contained in:
Joel Cunningham 2017-01-20 13:52:11 -06:00
parent 645ca84704
commit 9c80a66253

View File

@ -299,6 +299,7 @@ netif_add(struct netif *netif,
/* remember netif specific state information data */
netif->state = state;
netif->num = netif_num++;
LWIP_ASSERT("Netif num overflow, too many netifs or adds/removes", netif->num < 255);
netif->input = input;
NETIF_SET_HWADDRHINT(netif, NULL);