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:25:41 +0200 |
commit | 0589e659ca1aab76be9ca11e705bef56c3b03f45 (patch) | |
tree | 8b1181b476d426bb09c33b890ece2829c55d2866 /src/devices/nm-device-ethernet.c | |
parent | e0c272c15328a92e68db940a5bf0d3a63f75fa11 (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
Diffstat (limited to 'src/devices/nm-device-ethernet.c')
-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 acf822a2e..d27f7dcaf 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); |