diff options
author | Thomas Haller <thaller@redhat.com> | 2017-01-02 15:47:16 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-01-04 14:18:01 +0100 |
commit | a2dce28fc8f8319ab517f0bd4d5813f0a2acf98f (patch) | |
tree | 98e6b02c5178ff2bdb3c8c8f0f10fcc738c10d54 | |
parent | c2bc2fbac30c2f434385268188adc476ae99a912 (diff) | |
download | NetworkManager-a2dce28fc8f8319ab517f0bd4d5813f0a2acf98f.tar.gz |
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().
-rw-r--r-- | src/devices/nm-device.c | 13 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 8d1fd23311..8bfc9688cd 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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 diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c index 92593644d7..33f4847ed1 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-connection.c @@ -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); } |