mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 07:33:11 +00:00
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:
parent
645ca84704
commit
9c80a66253
@ -299,6 +299,7 @@ netif_add(struct netif *netif,
|
|||||||
/* remember netif specific state information data */
|
/* remember netif specific state information data */
|
||||||
netif->state = state;
|
netif->state = state;
|
||||||
netif->num = netif_num++;
|
netif->num = netif_num++;
|
||||||
|
LWIP_ASSERT("Netif num overflow, too many netifs or adds/removes", netif->num < 255);
|
||||||
netif->input = input;
|
netif->input = input;
|
||||||
|
|
||||||
NETIF_SET_HWADDRHINT(netif, NULL);
|
NETIF_SET_HWADDRHINT(netif, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user