Daniele Lacamera / PicoTCP-Experimental_CDC_ECM_Branch

Fork of PicoTCP by Daniele Lacamera

Revision:
40:c8ab0d2bba0b
Parent:
10:dd7111d4279f
--- a/stack/pico_stack.c	Thu Jul 11 10:17:25 2013 +0000
+++ b/stack/pico_stack.c	Tue Jul 16 06:40:35 2013 +0000
@@ -333,6 +333,7 @@
 int pico_ethernet_send(struct pico_frame *f)
 {
   struct pico_eth *dstmac = NULL;
+  int ret = -1;
 
   if (IS_IPV6(f)) {
     /*TODO: Neighbor solicitation */
@@ -366,18 +367,22 @@
       hdr->proto = PICO_IDETH_IPV4;
       if(!memcmp(hdr->daddr, hdr->saddr, PICO_SIZE_ETH)){
         dbg("sending out packet destined for our own mac\n");
-        return pico_ethernet_receive(f);
+      return pico_ethernet_receive(f);
       }else if(IS_LIMITED_BCAST(f)){
-        return pico_device_broadcast(f);
+        ret = pico_device_broadcast(f);
       }else {
-        return f->dev->send(f->dev, f->start, f->len);
+        ret = f->dev->send(f->dev, f->start, f->len);
         /* Frame is discarded after this return by the caller */
       }
+
+      if(!ret) pico_frame_discard(f);
+        return ret;
     } else {
       return -1;
     }
   } /* End IPV4 ethernet addressing */
   return -1;
+
 }
 
 void pico_store_network_origin(void *src, struct pico_frame *f)