diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-04-14 18:34:45 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-04-28 09:33:37 +0200 |
commit | 5fa3c1230fe1dcb5d2b1f838ed99bba8703d4e57 (patch) | |
tree | 63b8cd88bbb89714f138ffa9af3168a9684ad999 | |
parent | 1e1d5b24fd9b61e74b89680d036c72b907a79aee (diff) |
device/ethernet: ignore s390 'portname' attribute when not set
The 'portname' sysfs attribute of s390 devices is deprecated since
kernel 4.4 and always set to 'no portname required'. But even on older
kernels such value must be interpreted as an unset portname and thus
ignored.
https://bugzilla.redhat.com/show_bug.cgi?id=1327204
(cherry picked from commit 0589e659ca1aab76be9ca11e705bef56c3b03f45)
-rw-r--r-- | src/devices/nm-device-ethernet.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index acf822a2e5..d27f7dcaf1 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -194,16 +194,21 @@ _update_s390_subchannels (NMDeviceEthernet *self) } else if ( !strcmp (item, "layer2") || !strcmp (item, "portname") || !strcmp (item, "portno")) { - char *path, *value; + gs_free char *path = NULL, *value = NULL; + path = g_strdup_printf ("%s/%s", parent_path, item); value = nm_platform_sysctl_get (NM_PLATFORM_GET, path); - if (value && *value) - g_hash_table_insert (priv->s390_options, g_strdup (item), g_strdup (value)); - else + + if ( !strcmp (item, "portname") + && !g_strcmp0 (value, "no portname required")) { + /* Do nothing */ + } else if (value && *value) { + g_hash_table_insert (priv->s390_options, g_strdup (item), value); + value = NULL; + } else _LOGW (LOGD_DEVICE | LOGD_HW, "error reading %s", path); - g_free (path); - g_free (value); } + if (error) { _LOGW (LOGD_DEVICE | LOGD_HW, "%s", error->message); g_clear_error (&error); |