Skip to main content

get_networkd_state

Function get_networkd_state 

Source
pub async fn get_networkd_state(socket_path: &str) -> Result<NetworkdState>
Expand description

Collect networkd interface stats via the io.systemd.Network varlink Describe method.

No spawn_blocking here, unlike the streaming io.systemd.Metrics.List call in varlink_units: a single-shot zlink call holds no !Send stream across an await, so it runs on the main runtime like any other future.

NOTE: measured ~15ms slower than the file-based fallback on a 35-interface host (systemd 259): Describe returns a ~112KB payload — every interface plus the full route/nexthop/policy tables, which monitord discards — while the fallback just reads the small state files in /run/systemd/netif/links. The cost is daemon-side serialization, so nothing client-side avoids it; varlink still wins on authority (one RPC vs. scraping daemon-private files).