diff --git a/cmd/incus-agent/state.go b/cmd/incus-agent/state.go index 9b0218e38ee..189d6274a10 100644 --- a/cmd/incus-agent/state.go +++ b/cmd/incus-agent/state.go @@ -123,7 +123,7 @@ func memoryState() api.InstanceStateMemory { func networkState() map[string]api.InstanceStateNetwork { result := map[string]api.InstanceStateNetwork{} - ifs, err := net.Interfaces() + ifs, err := linux.NetlinkInterfaces() if err != nil { logger.Errorf("Failed to retrieve network interfaces: %v", err) return result @@ -180,9 +180,7 @@ func networkState() map[string]api.InstanceStateNetwork { } // Addresses - addrs, _ := iface.Addrs() - - for _, addr := range addrs { + for _, addr := range iface.Addresses { addressFields := strings.Split(addr.String(), "/") networkAddress := api.InstanceStateNetworkAddress{