device: do nothing in NMDevice's link_changed() function
All implementations of link_changed() chain up to NMDevice's base implementation. Thus, everybody wants to set the carrier. Refactor the code to set the carrier outside of link_changed().
This commit is contained in:
@@ -1981,8 +1981,12 @@ device_link_changed (NMDevice *self)
|
|||||||
_LOGD (LOGD_DEVICE, "IPv6 tokenized identifier present on device %s", priv->iface);
|
_LOGD (LOGD_DEVICE, "IPv6 tokenized identifier present on device %s", priv->iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (klass->link_changed)
|
/* Update carrier from link event if applicable. */
|
||||||
klass->link_changed (self, &info);
|
if ( nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)
|
||||||
|
&& !nm_device_has_capability (self, NM_DEVICE_CAP_NONSTANDARD_CARRIER))
|
||||||
|
nm_device_set_carrier (self, pllink->connected);
|
||||||
|
|
||||||
|
klass->link_changed (self, &info);
|
||||||
|
|
||||||
/* Update DHCP, etc, if needed */
|
/* Update DHCP, etc, if needed */
|
||||||
if (ip_ifname_changed)
|
if (ip_ifname_changed)
|
||||||
@@ -2121,10 +2125,7 @@ link_changed_cb (NMPlatform *platform,
|
|||||||
static void
|
static void
|
||||||
link_changed (NMDevice *self, const NMPlatformLink *pllink)
|
link_changed (NMDevice *self, const NMPlatformLink *pllink)
|
||||||
{
|
{
|
||||||
/* Update carrier from link event if applicable. */
|
/* stub implementation of virtual function to allow subclasses to chain up. */
|
||||||
if ( nm_device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)
|
|
||||||
&& !nm_device_has_capability (self, NM_DEVICE_CAP_NONSTANDARD_CARRIER))
|
|
||||||
nm_device_set_carrier (self, pllink->connected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@@ -197,8 +197,8 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self)
|
|||||||
devtimeout, ifname, nm_connection_get_id (NM_CONNECTION (self)));
|
devtimeout, ifname, nm_connection_get_id (NM_CONNECTION (self)));
|
||||||
|
|
||||||
priv->devtimeout_link_changed_handler =
|
priv->devtimeout_link_changed_handler =
|
||||||
g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED,
|
g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED,
|
||||||
G_CALLBACK (link_changed), self);
|
G_CALLBACK (link_changed), self);
|
||||||
priv->devtimeout_timeout_id = g_timeout_add_seconds (devtimeout, devtimeout_expired, self);
|
priv->devtimeout_timeout_id = g_timeout_add_seconds (devtimeout, devtimeout_expired, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user