mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 09:58:07 +02:00
device: add function to change device capabilites
This commit is contained in:
parent
5feea58223
commit
f3df854333
1 changed files with 16 additions and 4 deletions
|
|
@ -550,6 +550,17 @@ nm_device_has_capability (NMDevice *self, NMDeviceCapabilities caps)
|
|||
return NM_FLAGS_ANY (NM_DEVICE_GET_PRIVATE (self)->capabilities, caps);
|
||||
}
|
||||
|
||||
static void
|
||||
_add_capabilities (NMDevice *self, NMDeviceCapabilities capabilities)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
if (!NM_FLAGS_ALL (priv->capabilities, capabilities)) {
|
||||
priv->capabilities |= capabilities;
|
||||
_notify (self, PROP_CAPABILITIES);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
|
||||
const char *
|
||||
|
|
@ -1931,6 +1942,7 @@ realize_start_setup (NMDevice *self, const NMPlatformLink *plink)
|
|||
NMDevicePrivate *priv;
|
||||
NMDeviceClass *klass;
|
||||
static guint32 id = 0;
|
||||
NMDeviceCapabilities capabilities = 0;
|
||||
|
||||
g_return_if_fail (NM_IS_DEVICE (self));
|
||||
|
||||
|
|
@ -1963,7 +1975,7 @@ realize_start_setup (NMDevice *self, const NMPlatformLink *plink)
|
|||
priv->dev_id = nm_platform_link_get_dev_id (NM_PLATFORM_GET, priv->ifindex);
|
||||
|
||||
if (nm_platform_link_is_software (NM_PLATFORM_GET, priv->ifindex))
|
||||
priv->capabilities |= NM_DEVICE_CAP_IS_SOFTWARE;
|
||||
capabilities |= NM_DEVICE_CAP_IS_SOFTWARE;
|
||||
|
||||
priv->mtu = nm_platform_link_get_mtu (NM_PLATFORM_GET, priv->ifindex);
|
||||
_notify (self, PROP_MTU);
|
||||
|
|
@ -1983,7 +1995,9 @@ realize_start_setup (NMDevice *self, const NMPlatformLink *plink)
|
|||
}
|
||||
|
||||
if (klass->get_generic_capabilities)
|
||||
priv->capabilities |= klass->get_generic_capabilities (self);
|
||||
capabilities |= klass->get_generic_capabilities (self);
|
||||
|
||||
_add_capabilities (self, capabilities);
|
||||
|
||||
if (!priv->udi) {
|
||||
/* Use a placeholder UDI until we get a real one */
|
||||
|
|
@ -2018,8 +2032,6 @@ realize_start_setup (NMDevice *self, const NMPlatformLink *plink)
|
|||
priv->carrier = TRUE;
|
||||
}
|
||||
|
||||
_notify (self, PROP_CAPABILITIES);
|
||||
|
||||
klass->realize_start_notify (self, plink);
|
||||
|
||||
/* Do not manage externally created software devices until they are IFF_UP
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue