core: fix setting is_software for software devices created by NM
These devices don't have a platform device at creation time, thus is_software wasn't getting set properly. Move the is_software decision to constructed() because by this point, the iface and ifindex (if present) will be known for all cases and thus we can figure out if it's a software device or not in one place.
This commit is contained in:
@@ -579,6 +579,9 @@ constructed (GObject *object)
|
|||||||
priv->carrier = TRUE;
|
priv->carrier = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (priv->ifindex > 0)
|
||||||
|
priv->is_software = nm_platform_link_is_software (priv->ifindex);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (nm_device_parent_class)->constructed)
|
if (G_OBJECT_CLASS (nm_device_parent_class)->constructed)
|
||||||
G_OBJECT_CLASS (nm_device_parent_class)->constructed (object);
|
G_OBJECT_CLASS (nm_device_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
@@ -5062,7 +5065,6 @@ set_property (GObject *object, guint prop_id,
|
|||||||
g_free (priv->iface);
|
g_free (priv->iface);
|
||||||
priv->iface = g_strdup (platform_device->name);
|
priv->iface = g_strdup (platform_device->name);
|
||||||
priv->ifindex = platform_device->ifindex;
|
priv->ifindex = platform_device->ifindex;
|
||||||
priv->is_software = nm_platform_link_is_software (priv->ifindex);
|
|
||||||
g_free (priv->driver);
|
g_free (priv->driver);
|
||||||
priv->driver = g_strdup (platform_device->driver);
|
priv->driver = g_strdup (platform_device->driver);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user