net/udp: Fix the bug of overwriting when the udp recv buffer is full

Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
This commit is contained in:
wangyingdong
2023-06-08 10:50:53 +08:00
committed by Alin Jerpelea
parent 0b69731a97
commit a7926405ca
+3 -3
View File
@@ -75,13 +75,13 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev,
uint8_t offset = 0; uint8_t offset = 0;
#if CONFIG_NET_RECV_BUFSIZE > 0 #if CONFIG_NET_RECV_BUFSIZE > 0
while (iob_get_queue_size(&conn->readahead) > conn->rcvbufs) if (iob_get_queue_size(&conn->readahead) > conn->rcvbufs)
{ {
iob = iob_remove_queue(&conn->readahead); netdev_iob_release(dev);
iob_free_chain(iob);
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
g_netstats.udp.drop++; g_netstats.udp.drop++;
#endif #endif
return 0;
} }
#endif #endif