mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 13:00:16 +01:00
device: don't try to get carrier detection support when unrealizing
get_generic_capabilities() is called with a 0 ifindex when unrealizing: don't call nm_platform_link_supports_carrier_detect() is such case.
This commit is contained in:
parent
0dfb5d2452
commit
fa15543179
2 changed files with 13 additions and 7 deletions
|
|
@ -306,14 +306,18 @@ static NMDeviceCapabilities
|
|||
get_generic_capabilities (NMDevice *device)
|
||||
{
|
||||
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (device);
|
||||
int ifindex = nm_device_get_ifindex (device);
|
||||
|
||||
if (nm_platform_link_supports_carrier_detect (NM_PLATFORM_GET, nm_device_get_ifindex (device)))
|
||||
return NM_DEVICE_CAP_CARRIER_DETECT;
|
||||
else {
|
||||
_LOGI (LOGD_PLATFORM, "driver '%s' does not support carrier detection.",
|
||||
nm_device_get_driver (device));
|
||||
return NM_DEVICE_CAP_NONE;
|
||||
if (ifindex > 0) {
|
||||
if (nm_platform_link_supports_carrier_detect (NM_PLATFORM_GET, ifindex))
|
||||
return NM_DEVICE_CAP_CARRIER_DETECT;
|
||||
else {
|
||||
_LOGI (LOGD_PLATFORM, "driver '%s' does not support carrier detection.",
|
||||
nm_device_get_driver (device));
|
||||
}
|
||||
}
|
||||
|
||||
return NM_DEVICE_CAP_NONE;
|
||||
}
|
||||
|
||||
static guint32
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ G_DEFINE_TYPE (NMDeviceGeneric, nm_device_generic, NM_TYPE_DEVICE)
|
|||
static NMDeviceCapabilities
|
||||
get_generic_capabilities (NMDevice *dev)
|
||||
{
|
||||
if (nm_platform_link_supports_carrier_detect (NM_PLATFORM_GET, nm_device_get_ifindex (dev)))
|
||||
int ifindex = nm_device_get_ifindex (dev);
|
||||
|
||||
if (ifindex > 0 && nm_platform_link_supports_carrier_detect (NM_PLATFORM_GET, ifindex))
|
||||
return NM_DEVICE_CAP_CARRIER_DETECT;
|
||||
else
|
||||
return NM_DEVICE_CAP_NONE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue