cloud-setup: lookup device by MAC + type instead of just MAC
This will be useful for updating configuration of Vlans and MacVlans, some of having same MAC addresses as devices of other type.
This commit is contained in:
@@ -295,7 +295,7 @@ _nmc_get_ethernet_hwaddrs(NMClient *nmc)
|
||||
}
|
||||
|
||||
static NMDevice *
|
||||
_nmc_get_device_by_hwaddr(NMClient *nmc, const char *hwaddr)
|
||||
_nmc_get_device_by_hwaddr(NMClient *nmc, NMDeviceType device_type, const char *hwaddr)
|
||||
{
|
||||
const GPtrArray *devices;
|
||||
guint i;
|
||||
@@ -307,7 +307,7 @@ _nmc_get_device_by_hwaddr(NMClient *nmc, const char *hwaddr)
|
||||
const char *hwaddr_dev;
|
||||
gs_free char *s = NULL;
|
||||
|
||||
if (!NM_IS_DEVICE_ETHERNET(device))
|
||||
if (nm_device_get_device_type(device) != device_type)
|
||||
continue;
|
||||
|
||||
hwaddr_dev = _device_get_hwaddr(device);
|
||||
@@ -590,7 +590,7 @@ _config_one(SigTermData *sigterm_data,
|
||||
if (g_cancellable_is_cancelled(sigterm_data->cancellable))
|
||||
return FALSE;
|
||||
|
||||
device = nm_g_object_ref(_nmc_get_device_by_hwaddr(nmc, hwaddr));
|
||||
device = nm_g_object_ref(_nmc_get_device_by_hwaddr(nmc, NM_DEVICE_TYPE_ETHERNET, hwaddr));
|
||||
if (!device) {
|
||||
_LOGD("config device %s: skip because device not found", hwaddr);
|
||||
return FALSE;
|
||||
|
Reference in New Issue
Block a user