From 5fff6e7ff80f8b01be269acb651c9882d3ef46fb Mon Sep 17 00:00:00 2001 From: fbernon Date: Thu, 22 Mar 2007 09:09:27 +0000 Subject: [PATCH] ethernetif.c: update netif->input calls to check return value. In older ports, it's a good idea to upgrade them, even if before, there could be another problem (access to an uninitialized mailbox). --- CHANGELOG | 5 +++++ src/netif/ethernetif.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b40c0d0f..b3912fc7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -71,6 +71,11 @@ HISTORY ++ Bug fixes: + 2007-03-22 Frédéric Bernon + * ethernetif.c: update netif->input calls to check return value. In older ports, + it's a good idea to upgrade them, even if before, there could be another problem + (access to an uninitialized mailbox). + 2007-03-21 Simon Goldschmidt * sockets.c: fixed bug #5067 (essentialy a signed/unsigned warning fixed by casting to unsigned). diff --git a/src/netif/ethernetif.c b/src/netif/ethernetif.c index ef196b75..3891b8fb 100644 --- a/src/netif/ethernetif.c +++ b/src/netif/ethernetif.c @@ -237,7 +237,11 @@ ethernetif_input(struct netif *netif) case ETHTYPE_IP: case ETHTYPE_ARP: /* full packet send to tcpip_thread to process */ - pnetif->input( p, pnetif); + if (netif->input(p, netif)!=ERR_OK) + { LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: IP input error\n")); + pbuf_free(p); + p = NULL; + } break; #else /* ETHARP_TCPIP_ETHINPUT */ @@ -252,7 +256,11 @@ ethernetif_input(struct netif *netif) /* skip Ethernet header */ pbuf_header(p, -sizeof(struct eth_hdr)); /* pass to network layer */ - netif->input(p, netif); + if (netif->input(p, netif)!=ERR_OK) + { LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: IP input error\n")); + pbuf_free(p); + p = NULL; + } break; /* ARP packet? */