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 network
Main 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
└─ TcpRelayTable
Component 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