Expand description
Host-side virtio-net runtime.
§Context
This module is the host-side half of the new networking path:
guest app
-> guest kernel TCP/IP stack
-> virtio-net device
-> libkrun unix-stream bridge
-> smolvm FrameStreamBridge
-> shared frame queues
-> smoltcp gateway/runtime
-> host sockets / DNS forwarding / TCP relay
-> external networkMain runtime components:
VirtioNetworkRuntime
├─ FrameStreamBridge
│ ├─ reader thread
│ └─ writer thread
├─ TcpPortListeners
│ └─ one non-blocking accept loop per `-p HOST:GUEST`
├─ Arc<NetworkFrameQueues>
│ ├─ guest_to_host
│ ├─ host_to_guest
│ ├─ guest_wake
│ ├─ host_wake
│ └─ relay_wake
└─ smolvm-net-poll thread
├─ VirtioNetworkDevice
├─ smoltcp Interface
├─ SocketSet
└─ TcpRelayTableComponent roles:
FrameStreamBridge: translates libkrun’s Unix-stream frame protocol into queue operationsTcpPortListeners: accepts host TCP connections for published ports and hands them to the poll loopNetworkFrameQueues: handoff boundary between threadsVirtioNetworkDevice: adapts those queues to smoltcp’sphy::Device- poll thread: acts as the guest-visible gateway and protocol dispatcher
TcpRelayTable: maps guest TCP flows onto host-side relay threads
This runtime is responsible for:
- exchanging raw Ethernet frames with libkrun
- presenting a gateway endpoint to the guest
- handling DNS through a gateway UDP socket and host UDP forwarding
- relaying guest TCP connections to host
TcpStreams - accepting published host TCP ports and forwarding them into guest TCP connections
Modules§
- device
- smoltcp
phy::Deviceadapter for the virtio-net backend. - frame_
stream - libkrun unix-stream framing for the virtio-net backend.
- queues
- Shared queues and wake notifications for the virtio-net backend.
- stack
- Host-side smoltcp runtime for the virtio-net backend.
- tcp_
listeners - Host-side TCP listeners for published virtio-net ports.
- tcp_
relay - TCP relay support for the virtio-net backend.
Structs§
- Guest
Network Config - Static guest network configuration for the virtio-net MVP.
- Port
Mapping - Host->guest published TCP port mapping serviced by the virtio gateway.
- Virtio
Network Runtime - Running host-side virtio-net runtime for one guest NIC.
Constants§
- DEFAULT_
DNS_ ADDR - Default upstream DNS resolver used by the gateway runtime.
Functions§
- start_
virtio_ network - Start the host-side virtio-net runtime for one guest NIC.