mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 02:36:11 +08:00
net/devif_loopback: Add robustness to avoid infinite loop
When ipv4_input/ipv6_input called by devif_loopback writes wrong data into buffer (another bug we're fixing), the else block does nothing but only record the 'dropped' statistic, then infinite loop happens. Refers to previous lo device with dropping logic: https://github.com/apache/nuttx/blob/releases/11.0/drivers/net/loopback.c#L178-L180 Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
@@ -119,7 +119,9 @@ int devif_loopback(FAR struct net_driver_s *dev)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
nwarn("WARNING: Unrecognized IP version\n");
|
||||
NETDEV_RXDROPPED(dev);
|
||||
dev->d_len = 0;
|
||||
}
|
||||
|
||||
NETDEV_TXDONE(dev);
|
||||
|
||||
Reference in New Issue
Block a user