test(relay): cover DHCPv4 client request forwarding
The MVP success path depends on the Windows TAP adapter getting an IPv4 DHCP lease from the physical LAN. The relay already allowed remote DHCP client requests and filtered remote DHCP server replies, but only the DHCPv6 client request path had explicit coverage. Add a focused relay room test for a DHCPv4 client request from the remote client to the LAN gateway. This keeps the most important DHCP path documented in the same forwarding tests as the safety filters. Test Plan: - cargo fmt --check - cargo test -p lanparty-relay allows_remote_dhcpv4_client_requests - cargo test -p lanparty-relay - cargo clippy -p lanparty-relay --all-targets -- -D warnings - git diff --check - git diff --cached --check Refs: MVP DHCP validation
This commit is contained in:
@@ -1483,6 +1483,22 @@ mod tests {
|
|||||||
assert_eq!(gateway_decision.targets(), &[client.peer().peer_id()]);
|
assert_eq!(gateway_decision.targets(), &[client.peer().peer_id()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn allows_remote_dhcpv4_client_requests() {
|
||||||
|
let mut registry = RoomRegistry::default();
|
||||||
|
let gateway = registry.join(gateway_hello()).unwrap();
|
||||||
|
let client = registry.join(client_hello(1)).unwrap();
|
||||||
|
let payload = ipv4_udp_payload(DHCPV4_CLIENT_PORT, DHCPV4_SERVER_PORT);
|
||||||
|
let frame = ethernet_with_payload(MacAddr::BROADCAST, mac(1), ETHERTYPE_IPV4, &payload);
|
||||||
|
|
||||||
|
let decision = registry
|
||||||
|
.forward_ethernet(&room(), client.peer().peer_id(), &frame)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(decision.action(), FrameAction::Forwarded);
|
||||||
|
assert_eq!(decision.targets(), &[gateway.peer().peer_id()]);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn allows_remote_dhcpv6_client_requests() {
|
fn allows_remote_dhcpv6_client_requests() {
|
||||||
let mut registry = RoomRegistry::default();
|
let mut registry = RoomRegistry::default();
|
||||||
|
|||||||
Reference in New Issue
Block a user