On Wed, May 11, 2022 at 5:19 AM Fotis Panagiotopoulos <f.j.pa...@gmail.com> wrote: > > I was thinking the same thing. > > Which layer is responsible for this check? > IP, UDP, or ICMP?
Logically it would seem to me that UDP should do the check and trigger sending the ICMP unreachable reply when appropriate, though it seems that it unconditionally calls icmp_reply(), which contains the logic to *avoid* sending it when it's the ANY or BROADCAST address. In other words, it is currently is coded in the ICMP layer. Looking at struct net_driver_s in include/nuttx/net/netdev.h, I am reminded that there is also IPv6, which a grep reveals has a similar handler in the IPv6 ICMP handler in icmpv6_reply() in net/icmpv6/icmpv6_reply.c. There is a function net_is_addr_mcast(), but there is no net_is_addr_bcast() currently. I think that is the function that needs to be coded, and then called from icmp_reply(). I need to go at the moment but I will try to research this further later. Cheers Nathan