zhhyu7 opened a new pull request, #21247:
URL: https://github.com/apache/nuttx/pull/21247

   ## Summary
   `devif_out()` returns silently with `dev->d_len = 0` whenever the L2 header
   cannot be built: `arp_out()` zeroes it when the destination is off-subnet 
with
   no usable gateway, when ARP is forbidden on the interface, or when an ARP
   request for that address is already in flight; `neighbor_ethernet_out()` does
   the same for IPv6. `devif_poll_out()` ignored this and still invoked the
   driver's tx callback, handing the driver an empty packet to transmit.
   
   Bail out of `devif_poll_out()` when `d_len` is zero so the packet is dropped
   instead of being passed down.
   
   ## Impact
   Abandon the transmit if it failed to build L2 header for the packet.
   
   ## Testing
   `sim:dynconns` + `CONFIG_NET_IPv4`, `CONFIG_NET_ARP`, 
`CONFIG_DEBUG_ASSERTIONS`,
   `CONFIG_NET_ARP_SEND=n` (so the unresolved address is not rejected in 
`sendto`),
   `CONFIG_NET_IPFRAG=n`. A UDP `sendto()` to an off-subnet address with the
   gateway cleared:
   
   - before: `Assertion failed at net/netdev_upperhalf.c:297` 
(`DEBUGASSERT(dev->d_len > 0)`)
   - after: `sendto` returns 64, packet silently dropped, two consecutive sends 
survive
   
   `nxstyle` passes on `net/devif/devif_poll.c`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to