Files
EasyTier/easytier/src
fanyang 19647f296a perf(packet_def): apply #2385 ZCPacket safe initialization
Cherry-pick packet_def.rs changes from PR #2385:
- new_with_payload: write_bytes + copy_nonoverlapping (no aliasing check)
- new_for_tun: resize instead of unsafe set_len
- new_for_foreign_network: stack-allocated header + single write
- convert_type: resize instead of set_len

Eliminates UB from set_len on uninitialized memory. copy_nonoverlapping
skips aliasing checks, slightly faster for TCP path.

Benchmark (10s, 1400B):
  TCP:  440K -> 464K pps (+5.5%)
  Ring: 508K -> 473K pps (-7%, header zeroing overhead)

Ring regression is acceptable: ring is only for in-process benchmark,
real deployments use TCP/UDP over WAN where the TCP gain matters.

All 37 packet + 16 forward_packet tests pass.
2026-06-28 23:07:33 +08:00
..