Skip to content

Commit 26e2e1e

Browse files
wengzhepkarashchenko
authored andcommitted
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 <[email protected]>
1 parent d6747dd commit 26e2e1e

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

net/udp/udp_recvfrom.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ static inline void udp_readahead(struct udp_recvfrom_s *pstate)
170170
FAR void *srcaddr;
171171
uint8_t ifindex;
172172

173-
DEBUGASSERT(iob->io_pktlen > 0);
174-
175173
/* Unflatten saved connection information */
176174

177175
#ifdef CONFIG_NETDEV_IFINDEX

0 commit comments

Comments
 (0)