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

   ## Summary
   
   Some network configurations do not build on master because code calls 
`icmp_reply()` or `icmpv6_reply()` without a check that the ICMP or ICMPv6 
stack is there:
   
   - `net/ipfilter/ipfilter.c`: `ipv6_filter_in()` and `ipfilter_out()` call 
`icmpv6_reply()` for a REJECT target with no check. `CONFIG_NET_IPFILTER` + 
`CONFIG_NET_IPv6` without `CONFIG_NET_ICMPv6` fails.
   - `net/ipfrag/ipfrag.c`: the ICMPv6 Time Exceeded reply is under the check 
for the IPv4 ICMP stack. `CONFIG_NET_IPFRAG` + IPv4 + IPv6 + `CONFIG_NET_ICMP` 
without `CONFIG_NET_ICMPv6` fails.
   - `net/udp/udp_input.c` and `net/netforward/ipv6_forward.c` check 
`CONFIG_NET_ICMP` / `CONFIG_NET_ICMPv6` but not `CONFIG_NET_ICMP(v6)_NO_STACK`. 
A UDP stack with a usrsock ICMP or ICMPv6 socket (`CONFIG_NET_USRSOCK_ICMP`, 
`CONFIG_NET_USRSOCK_ICMPv6`), or IPv6 forwarding with 
`CONFIG_NET_USRSOCK_ICMPv6`, fails.
   
   The fix uses `NET_ICMP_HAVE_STACK` and `NET_ICMPv6_HAVE_STACK` from `icmp.h` 
and `icmpv6.h`, as `ipv4_input.c` and `ipv6_input.c` already do.
   
   - Commit 1: `ipfilter.c`. Without the ICMP or ICMPv6 stack, a REJECT now 
drops the packet, as DROP does. Before, `d_len` kept the packet length, and 
`devif_out()` sent the packet that the filter rejected (on input it went back 
out of the device).
   - Commit 2: `ipfrag.c`, `udp_input.c`, `ipv6_forward.c`. In `ipfrag.c` each 
family replies only if its own ICMP stack is there; otherwise the timeout only 
frees the fragments, as before for a configuration without ICMP.
   
   ## Impact
   
   Build fix for the configurations above. No change for a configuration with 
both ICMP stacks. No API, ABI or Kconfig change. Common network code: the same 
in flat, protected and kernel builds and on all architectures.
   
   ## Testing
   
   Builds with `-Werror` in the CI image (gcc 12.3), on master 28db4789c34 and 
on this branch:
   
   | Config | master | this PR |
   |---|---|---|
   | rv-virt:netnsh (flat) + NET_IPv6 + NET_IPFILTER | FAIL: `ipfilter.c:531: 
implicit declaration of function 'icmpv6_reply'` | OK |
   | rv-virt:netnsh + NET_IPv6 + NET_IPFRAG | FAIL: `ipfrag.c:251: implicit 
declaration of function 'icmpv6_reply'` | OK |
   | rv-virt:netnsh + NET_USRSOCK + NET_USRSOCK_ICMP | FAIL: `udp_input.c:424: 
implicit declaration of function 'icmp_reply'` | OK |
   | rv-virt:netnsh + NET_IPv6 + NET_IPFORWARD + NET_USRSOCK + 
NET_USRSOCK_ICMPv6 + NET_USRSOCK_UDP | FAIL (`make -k`): `ipv6_forward.c:766` 
and `udp_input.c:436: implicit declaration of function 'icmpv6_reply'` | OK |
   | rv-virt:netnsh + NET_IPFILTER, NET_ICMP off | OK | OK |
   | qemu-armv8a:netnsh + NET_IPv6 + NET_ICMPv6 + NET_ICMPv6_NEIGHBOR + 
NET_IPFILTER + NET_IPFRAG + NET_IPFORWARD | OK | OK |
   
   Also OK on this branch: qemu-armv8a:netnsh, rv-virt:netnsh, 
rv-virt:knetnsh64 (kernel), qemu-armv8a:knsh (kernel) with IPv4, IPv6, ICMP, 
ICMPv6, MLD, IPFILTER and IPFRAG.
   
   No run-time test: the change is in error paths of uncommon configurations 
(REJECT without an ICMP stack, a fragment timeout without the ICMP stack of its 
family).
   


-- 
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