pub fn smoltcp_poll_loop(
shared: Arc<SharedState>,
config: PollLoopConfig,
network_policy: NetworkPolicy,
dns_config: DnsConfig,
tls_state: Option<Arc<TlsState>>,
published_ports: Vec<PublishedPort>,
max_connections: Option<usize>,
tokio_handle: Handle,
)Expand description
Main smoltcp poll loop. Runs on a dedicated OS thread.
Processes guest frames with pre-inspection, drives smoltcp’s TCP/IP stack,
and sleeps via poll(2) between events.
§Phases per iteration
- Drain guest frames — pop from
tx_ring, classify, pre-inspect. - smoltcp egress + maintenance — transmit queued packets, run timers.
- Service connections — relay data between smoltcp sockets and proxy tasks (added by later tasks).
- Sleep —
poll(2)ontx_wake+proxy_wakepipes with smoltcp’s requested timeout.
§Arguments
shared- Stack-wide shared state:tx_ring/rx_ringfor the virtio-net boundary and the wake eventfds.config- Resolved per-sandbox parameters (gateway / guest MAC + IPv4 + IPv6, MTU).network_policy- User-provided egress policy. Evaluated against the sandbox’s gateway IPs (stored onSharedState) soDestinationGroup::Hostrules match.dns_config- DNS interception settings (block lists, upstreams, timeout).tls_state- Optional TLS MITM state; drives interception of intercepted ports and DoT when present.published_ports- Host → guest port publishes; the publisher accepts inbound connections on the host-bind address and forwards into the guest.max_connections- Optional cap on concurrent guest connections tracked byConnectionTracker;Noneuses the default.tokio_handle- Runtime handle used for proxy tasks, DNS forwarding, port publishing, and ICMP relays.