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:
Thomas Haller
2017-01-02 15:47:16 +01:00
parent c2bc2fbac3
commit a2dce28fc8
2 changed files with 9 additions and 8 deletions

View File

@@ -1981,8 +1981,12 @@ device_link_changed (NMDevice *self)
_LOGD (LOGD_DEVICE, "IPv6 tokenized identifier present on device %s", priv->iface);
}
if (klass->link_changed)
klass->link_changed (self, &info);
/* Update carrier from link event if applicable. */
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 */
if (ip_ifname_changed)
@@ -2121,10 +2125,7 @@ link_changed_cb (NMPlatform *platform,
static void
link_changed (NMDevice *self, const NMPlatformLink *pllink)
{
/* Update carrier from link event if applicable. */
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);
/* stub implementation of virtual function to allow subclasses to chain up. */
}
static gboolean

View File

@@ -197,8 +197,8 @@ nm_ifcfg_connection_check_devtimeout (NMIfcfgConnection *self)
devtimeout, ifname, nm_connection_get_id (NM_CONNECTION (self)));
priv->devtimeout_link_changed_handler =
g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED,
G_CALLBACK (link_changed), self);
g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED,
G_CALLBACK (link_changed), self);
priv->devtimeout_timeout_id = g_timeout_add_seconds (devtimeout, devtimeout_expired, self);
}