Commit fbde3fd0 authored by Christian Kellner's avatar Christian Kellner
Browse files

manager: only import hosts with stable uuids

We started auto-importing the host device in commit f9205d16, with
the reason that in non-native enumeration mode, the host device
will disappear and the generation information will thus not be
available anymore. But on embedded thunderbolt controller, the
host device has an unstable unique_id, which means that host device
will have a different uuid on next boot and thus can not be matched
with the previously stored one. Thus stale host devices would
accumulate in the store. Luckily, on embedded thunderbolt, the host
device does not have device/vendor sysfs attributes, which means
that currently creating a BoltDevice for it will not work, which is
a bug, that also prevents stale host devices for now. Once that bug
will get fixed we were to get stale host records, unless we don't
store those host devices. To do so we check if the domain of the
host device is stored which is an indicator of the uuid stability,
checked via the pci id of the native host interface. If the domain
is stored we store the host and vice versa.
parent 09aa6c53
......@@ -1504,8 +1504,23 @@ manager_maybe_import (BoltManager *mgr,
if (bolt_device_is_host (dev))
/* Store the host device, which is always authorized */
manager_do_import_device (mgr, dev, BOLT_POLICY_MANUAL);
BoltDomain *dom = bolt_device_get_domain (dev);
/* host devices are per design authorized and
* must therefore never be authorized by bolt */
/* Store the host device only if its domain is
* stored as well. Currently, the only reason
* for a domain to not be stored is that its
* uuid is not stable, i.e. changes every boot.
* But its uuid is in fact derived from the
* associated host device, i.e. this very host
* device here. Ergo, its uuid is unstable and
* thus it should not be stored */
if (bolt_domain_is_stored (dom))
manager_do_import_device (mgr, dev, policy);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment