bridgeif/slipif/zepif: check that input callback is not NULL

This commit is contained in:
Simon Goldschmidt 2018-06-13 10:53:50 +02:00
parent 38614e4f3e
commit 25497bb387
3 changed files with 5 additions and 0 deletions

View File

@ -418,6 +418,7 @@ bridgeif_init(struct netif *netif)
mem_size_t alloc_len; mem_size_t alloc_len;
LWIP_ASSERT("netif != NULL", (netif != NULL)); LWIP_ASSERT("netif != NULL", (netif != NULL));
LWIP_ASSERT("bridgeif needs an input callback", (netif->input != NULL));
#if !BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT #if !BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT
if (netif->input == tcpip_input) { if (netif->input == tcpip_input) {
LWIP_DEBUGF(BRIDGEIF_DEBUG | LWIP_DBG_ON, ("bridgeif does not need tcpip_input, use netif_input/ethernet_input instead")); LWIP_DEBUGF(BRIDGEIF_DEBUG | LWIP_DBG_ON, ("bridgeif does not need tcpip_input, use netif_input/ethernet_input instead"));

View File

@ -362,6 +362,8 @@ slipif_init(struct netif *netif)
struct slipif_priv *priv; struct slipif_priv *priv;
u8_t sio_num; u8_t sio_num;
LWIP_ASSERT("slipif needs an input callback", netif->input != NULL);
/* netif->state contains serial port number */ /* netif->state contains serial port number */
sio_num = LWIP_PTR_NUMERIC_CAST(u8_t, netif->state); sio_num = LWIP_PTR_NUMERIC_CAST(u8_t, netif->state);

View File

@ -224,6 +224,8 @@ zepif_init(struct netif *netif)
struct zepif_init *init_state = (struct zepif_init *)netif->state; struct zepif_init *init_state = (struct zepif_init *)netif->state;
struct zepif_state *state = (struct zepif_state *)mem_malloc(sizeof(struct zepif_state)); struct zepif_state *state = (struct zepif_state *)mem_malloc(sizeof(struct zepif_state));
LWIP_ASSERT("zepif needs an input callback", netif->input != NULL);
if (state == NULL) { if (state == NULL) {
return ERR_MEM; return ERR_MEM;
} }