Skip to main content

Module switch

Module switch 

Source
Expand description

Pure-Rust virtual Layer-2 Ethernet switch (switch0) for multi-VM unkernel-rs labs.

Connects 2+ Wasmtime Linux VMs over an in-process learning L2 Ethernet switch with:

  • Automatic MAC address learning, unicast forwarding, and broadcast/unknown-unicast flooding.
  • Real-time chaos/fault injection per port: cut_link, reconnect_link, set_drop_rate, and set_delay_ms.
  • Optional zero-dependency PCAPng packet capture (Wireshark-compatible) recording every Ethernet frame traversing the switch with microsecond timestamps and source-port annotations.
  • Optional per-port NAT uplink (NetStack) so nodes can talk to each other over L2/L3 and optionally reach the internet with full VMI / TLS inspection.

Structs§

MacTableEntry
One learned entry in the switch’s L2 MAC forwarding table.
SwitchAttachment
Attachment parameters passed via crate::VmConfig::switch to wire a VM onto a VirtualSwitch.
SwitchPort
Guest-side handle representing one port on a VirtualSwitch.
SwitchPortStats
Live statistics for a single switch port.
VirtualSwitch
In-process learning Layer-2 Ethernet switch linking multiple unkernel-rs VMs.

Functions§

format_mac