a3ff75b29f
Safety filtering now applies at several tunnel boundaries. The relay remains the trust boundary, while the client and gateway also drop unsafe frames before spending relay bandwidth. Duplicating EtherType and IPv4/IPv6 parsers across crates would make those rules drift as the MVP grows. Move the Ethernet safety classifiers into lanparty-proto, expose typed safety drop reasons, and map them back into the existing DropReason vocabulary. The relay now uses the shared client and gateway classifiers, the gateway keeps its local LAN-send drops through the shared classifier, and the client drops the same remote-to-LAN safety cases before QUIC DATAGRAM encoding. Document the client-side local drops and list the additional suspicious drop reasons in the manual MVP test guide. Test Plan: - cargo test -p lanparty-proto safety - cargo test -p lanparty-client-core connects_to_relay_control_stream_as_client - cargo test -p lanparty-gateway connects_to_relay_control_stream_as_gateway - cargo test -p lanparty-relay - cargo fmt --check - cargo test --workspace - cargo clippy --workspace --all-targets -- -D warnings - cargo check -p lanparty-client-tap --target x86_64-pc-windows-gnu --tests - cargo check -p lanparty-client-route --target x86_64-pc-windows-gnu --tests - cargo check -p lanparty-client-tap --target x86_64-pc-windows-msvc --tests - cargo check -p lanparty-client-route --target x86_64-pc-windows-msvc --tests - git diff --check Refs: PLAN.md safety filters and client source-MAC isolation
31 lines
1.1 KiB
Rust
31 lines
1.1 KiB
Rust
//! Shared protocol primitives for the LAN party L2 tunnel.
|
|
//!
|
|
//! This crate intentionally contains no socket, TAP, QUIC, or OS-specific
|
|
//! behavior. It is the small contract that the Windows client, Linux gateway,
|
|
//! and relay must all agree on.
|
|
|
|
mod ethernet;
|
|
mod mac;
|
|
mod mtu;
|
|
mod overlay;
|
|
mod safety;
|
|
|
|
pub use ethernet::{
|
|
ETHERNET_HEADER_LEN, EthernetFrame, MAX_STANDARD_ETHERNET_FRAME_LEN,
|
|
MAX_STANDARD_ETHERNET_PAYLOAD_LEN, MIN_ETHERNET_FRAME_LEN,
|
|
};
|
|
pub use mac::{MacAddr, MacParseError};
|
|
pub use mtu::{
|
|
DEFAULT_DATAGRAM_SAFETY_MARGIN, DEFAULT_TAP_MTU, MIN_USEFUL_TAP_MTU, MtuError,
|
|
max_tap_mtu_for_datagram, recommended_tap_mtu,
|
|
};
|
|
pub use overlay::{
|
|
FrameType, OVERLAY_HEADER_LEN, OVERLAY_MAGIC, OVERLAY_VERSION, OverlayHeader, OverlayPacket,
|
|
ProtoError, decode_datagram, encode_datagram, validate_datagram_budget,
|
|
};
|
|
pub use safety::{
|
|
ETHERTYPE_8021AD, ETHERTYPE_8021Q, ETHERTYPE_EAPOL, ETHERTYPE_IPV4, ETHERTYPE_IPV6,
|
|
ETHERTYPE_LLDP, ETHERTYPE_QINQ, ETHERTYPE_SLOW_PROTOCOLS, EthernetSafetyDrop,
|
|
gateway_lan_safety_drop_reason, remote_client_safety_drop_reason,
|
|
};
|