From 9c80a6625344768572777accbe77ac968c10250f Mon Sep 17 00:00:00 2001 From: Joel Cunningham Date: Fri, 20 Jan 2017 13:52:11 -0600 Subject: [PATCH] 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 --- src/core/netif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/netif.c b/src/core/netif.c index c5bd3c50..6956f0ab 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -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);