net/udp: Remove wrong check in udp_readahead

- Before IOB offload, srcaddr / src_addr_size / ifindex are written into
  IOB by iob_trycopyin, so io_pktlen > 0 is always true, this check is
  correct at that time. (It won't fail with zero-length UDP datagram.)
- After IOB offload, srcaddr / src_addr_size / ifindex are written into
  offset 0, without increasing io_pktlen. So this check will fail with
  zero-length UDP datagram now.
- We need to support zero-length UDP datagram and this check is
  unnecessary at this point.
  - https://stackoverflow.com/questions/5307031/how-to-detect-receipt-of-a-0-length-udp-datagram
  - https://github.com/apache/nuttx/blob/nuttx-12.1.0/net/udp/udp_callback.c#L214

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2023-05-05 11:34:11 +08:00 committed by Petro Karashchenko
parent d6747dd6ad
commit 26e2e1e32f

View File

@ -170,8 +170,6 @@ static inline void udp_readahead(struct udp_recvfrom_s *pstate)
FAR void *srcaddr;
uint8_t ifindex;
DEBUGASSERT(iob->io_pktlen > 0);
/* Unflatten saved connection information */
#ifdef CONFIG_NETDEV_IFINDEX