Files
EasyTier/easytier-core
fe18f32c8b fix(peer_manager): 按 NIC 过滤器改写后的目的地址路由 (#2740)
* fix(peer_manager): route by destination rewritten in the nic packet pipeline

NIC packet filters receive &mut ZCPacket and may rewrite the IP header (e.g. a NAT filter that maps a virtual peer address to an address on the local subnet). send_msg_by_ip parsed the destination before running the filter pipeline and then routed by that stale address, so rewritten packets were looked up by the pre-filter destination and dropped as unreachable.

Re-parse the destination after run_nic_packet_process_pipeline and route by the rewritten address. Expose instance::packet_io as pub(crate) so peers can reuse the parser.

* test(peer-manager): cover NIC destination rewrite routing

Exercise IPv4 and IPv6 delivery through three peers connected by memory
tunnels. A NIC filter rewrites the destination without setting a peer
ID; verify delivery to the rewritten peer and no delivery to the
original.

Cover original destinations with and without an existing route. Wait for
route convergence before sending each packet once, without data retries.

Both regression tests fail with the PR routing fix removed and pass with
it restored. All 37 peer-manager tests and formatting checks pass.
Scoped Clippy completes with warnings in pre-existing code.

---------

Co-authored-by: ldoubil <ldoubil@users.noreply.github.com>
Co-authored-by: KKRainbow <5665404+KKRainbow@users.noreply.github.com>
2026-10-25 13:13:32 +08:00
..