summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-04-14 18:34:45 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-04-28 09:29:39 +0200
commitfc6b8ba1bf487321090de40b19766a04725b419f (patch)
tree40a37fd6ab32d1ca7ff87922055ff0a74f14f9df
parentba77eb5f439890cbacbb0301616a5b0ac879bf5d (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.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index 7f950dd648..2eb622cf5d 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -200,16 +200,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);