summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Šimerda <psimerda@redhat.com>2013-08-27 14:17:30 +0200
committerPavel Šimerda <psimerda@redhat.com>2013-08-29 19:57:46 +0200
commit31235c545d591547c756307fdb88959b0e12bc4a (patch)
tree6f09dde581a760990f10bcc99d6c7e2dda7e5a94
parent1be3bf17bc85cd5d5239d2b9860c2e3754bcb52a (diff)
downloadNetworkManager-31235c545d591547c756307fdb88959b0e12bc4a.tar.gz
trivial: add some comments to nm-device's link-changed handlers
Acked-by: Dan Winship <danw@gnome.org>
-rw-r--r--src/devices/nm-device.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index c207a08bc0..1d6ac87d0d 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1179,9 +1179,16 @@ link_changed_cb (NMPlatform *platform, int ifindex, NMPlatformLink *info, NMPlat
NMDeviceClass *klass = NM_DEVICE_GET_CLASS (device);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
+ /* Ignore other devices. */
if (ifindex != nm_device_get_ifindex (device))
return;
+ /* We don't filter by 'reason' because we are interested in *all* link
+ * changes. For example a call to nm_platform_link_set_up() may result
+ * in an internal carrier change (i.e. we ask the kernel to set IFF_UP
+ * and it results in also setting IFF_LOWER_UP.
+ */
+
if (info->udi && g_strcmp0 (info->udi, priv->udi)) {
/* Update UDI to what udev gives us */
g_free (priv->udi);
@@ -1196,6 +1203,7 @@ link_changed_cb (NMPlatform *platform, int ifindex, NMPlatformLink *info, NMPlat
static void
link_changed (NMDevice *device, NMPlatformLink *info)
{
+ /* Update carrier from link event if applicable. */
if ( device_has_capability (device, NM_DEVICE_CAP_CARRIER_DETECT)
&& !device_has_capability (device, NM_DEVICE_CAP_NONSTANDARD_CARRIER))
nm_device_set_carrier (device, info->connected);