zhhyu7 opened a new pull request, #21515:
URL: https://github.com/apache/nuttx/pull/21515
## Summary
Refactors the IP forwarding subsystem into a generic `netforward`
framework so it can forward multiple packet types, fixes a recursive
forwarding corruption bug, improves forward-path packet filtering, and
adds CAN-to-CAN forwarding on top of the new framework.
The series (6 commits, oldest to newest):
1. **ipv6_forward.c: do not compare packet length and MTU when IPFRAG is
enabled** — when IP fragmentation is enabled the length-vs-MTU check
is invalid, so it is skipped.
2. **net/forward: change ipforward name to netforward for public use** —
renames `net/ipforward/` to `net/netforward/` (and `ipfwd_*` sources
to `netfwd_*`). As a forwarding framework, netforward supports the
forwarding of multiple packet types rather than IP only. Pure
rename/move, no behavioral change.
3. **net/ipforward: fix the problem of nested forward process** — since
`netdev_upperhalf` txavail now sends directly on the current thread,
recursive mutual forwarding between interfaces could overwrite
`d_iob`. The device state is now saved/restored so recursion no
longer corrupts `d_iob` and related resources. See the ICMP
echo-request/echo-reply loopback example in the commit body.
4. **ipv4_input: Try to forward the packet if device has a configured
IP** — attempt forwarding when the receiving device has a configured
address, with filtering added to avoid duplicate forwarded packets.
5. **net/forward: add can-can forward logic** — extends the framework to
forward between CAN devices, adding `can_forward.c`, the `cangw`
public header, forwarding statistics, and the associated Kconfig/build
wiring.
6. **net/can: Revert TCF confirm flag use for can_forward** — drops an
incorrect TCF confirm-flag use introduced with the CAN forwarding
logic.
## Impact
- `net/ipforward/` is renamed to `net/netforward/`; downstream build
files (`net/Makefile`, `net/Kconfig`, `devif`, `net_initialize`) and
the `usbdev` sim defconfig are updated accordingly.
- New public header `include/nuttx/net/cangw.h`; additions to
`include/nuttx/net/netdev.h` and `include/nuttx/net/netstats.h`.
- No change to the existing IPv4/IPv6 forwarding behavior beyond the
nested-forward fix and the ipv4_input forwarding condition.
## Testing
TODO:
--
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]