Skip to main content

Module net

Module net 

Source
Expand description

Opt-in user-space L2/L3/L4 NAT network stack (wasm_driver_net_*) for unkernel.

Provides a classic SLiRP IPv4 subnet (10.0.2.0/24, guest 10.0.2.15, gateway 10.0.2.2, DNS 10.0.2.3) with:

  • ARP, DHCP, ICMP echo, UDP DNS A-record forwarding, and TCP NAT over host sockets.
  • Zero /etc/resolv.conf reads after boot (nameservers pre-loaded before Landlock).
  • Built-in SSRF / homelab protection: blocks loopback, RFC1918 private, link-local, CGNAT, and multicast IPv4 targets by default unless allow_lan = true.
  • Optional allow_hosts domain allowlist enforced on BOTH DNS lookup and TCP connect.

Structs§

NetConfig
Egress network configuration for the guest VM (air-gapped by default).
NetStack
Host user-space NAT network stack bridged to wasm_driver_net_*.
NetStackDevice
Adapter exposing an Arc<NetStack> through the NetDevice trait.
PortForward
Inbound host-to-guest TCP port forward ([host_ip:]host_port:guest_port).

Constants§

DNS_IP
ETH_ARP
ETH_IP
GUEST_IP
GUEST_MAC_DEFAULT
GW_IP
GW_MAC
MASK_IP
NET_IP

Traits§

NetDevice
Abstract L2 Ethernet device wired to wasm_driver_net_* inside a guest VM.

Functions§

is_non_public_ipv4
Returns true if ip is loopback, RFC1918 private, link-local, CGNAT, broadcast, or reserved.
load_host_resolvers