Skip to contentSkip to conversation

mini-os: free dropped lwip packets

PATCH New Samuel Thibault 1 participant 1 message Mar 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mini-os: free dropped lwip packets

mini-os: free dropped lwip packets
When lwIP can not accept a packet, it is up to us to free it.

extras/mini-os/lwip-net.c +4 -1
diff -r be3025f6af2e extras/mini-os/lwip-net.c
@@ -206,13 +206,16 @@ netfront_input(struct netif *netif, unsi
     /* skip Ethernet header */
     pbuf_header(p, -(s16)sizeof(struct eth_hdr));
     /* pass to network layer */
-    tcpip_input(p, netif);
+    if (tcpip_input(p, netif) == ERR_MEM)
+      /* Could not store it, drop */
+      pbuf_free(p);
     break;
       
   case ETHTYPE_ARP:
     /* pass p to ARP module  */
     etharp_arp_input(netif, (struct eth_addr *) netif->hwaddr, p);
     break;
+
   default:
     pbuf_free(p);
     p = NULL;