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,7 +1981,11 @@ 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. */
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); klass->link_changed (self, &info);
/* Update DHCP, etc, if needed */ /* Update DHCP, etc, if needed */
@@ -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