@@ -295,7 +295,7 @@ static int pico_ethernet_ipv6_dst(struct pico_frame *f, struct pico_eth *const d
295
295
296
296
/* Ethernet send, first attempt: try our own address.
297
297
* Returns 0 if the packet is not for us.
298
- * Returns 1 if the packet is cloned to our own receive queue, so the caller can discard the original frame.
298
+ * Returns 1 if the packet is cloned to our own receive queue and the original frame is dicarded .
299
299
* */
300
300
static int32_t pico_ethsend_local (struct pico_frame * f , struct pico_eth_hdr * hdr )
301
301
{
@@ -308,7 +308,9 @@ static int32_t pico_ethsend_local(struct pico_frame *f, struct pico_eth_hdr *hdr
308
308
dbg ("sending out packet destined for our own mac\n" );
309
309
if (pico_ethernet_receive (clone ) < 0 ) {
310
310
dbg ("pico_ethernet_receive() failed\n" );
311
+ return 0 ;
311
312
}
313
+ pico_frame_discard (f );
312
314
return 1 ;
313
315
}
314
316
@@ -317,13 +319,12 @@ static int32_t pico_ethsend_local(struct pico_frame *f, struct pico_eth_hdr *hdr
317
319
318
320
/* Ethernet send, second attempt: try bcast.
319
321
* Returns 0 if the packet is not bcast, so it will be handled somewhere else.
320
- * Returns 1 if the packet is handled by the pico_device_broadcast() function, so it can be discarded.
322
+ * Returns 1 if the packet is handled by the pico_device_broadcast() function and is discarded.
321
323
* */
322
324
static int32_t pico_ethsend_bcast (struct pico_frame * f )
323
325
{
324
326
if (IS_LIMITED_BCAST (f )) {
325
- (void )pico_device_broadcast (f ); /* We can discard broadcast even if it's not sent. */
326
- return 1 ;
327
+ return (pico_device_broadcast (f ) > 0 ); // Return 1 on success, ret > 0
327
328
}
328
329
329
330
return 0 ;
0 commit comments