mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Netif: add allowance for init to override netif->num
Adjusts assert logic from 9c80a66253
to allow for a netif driver's init callback to manually override
the number. When the init function is taking care of the unique
assignment, the assert simply checks that a valid number was provided
This commit is contained in:
parent
edac92d03a
commit
e158f87286
@ -300,7 +300,6 @@ 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);
|
||||||
@ -317,6 +316,11 @@ netif_add(struct netif *netif,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check that netif_num has not overflowed or that init callback
|
||||||
|
provided a valid number (we don't support 255 since that can't be
|
||||||
|
converted to an index) */
|
||||||
|
LWIP_ASSERT("Netif num overflow/invalid num", netif->num < 255);
|
||||||
|
|
||||||
/* add this netif to the list */
|
/* add this netif to the list */
|
||||||
netif->next = netif_list;
|
netif->next = netif_list;
|
||||||
netif_list = netif;
|
netif_list = netif;
|
||||||
|
Loading…
Reference in New Issue
Block a user