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
This commit is contained in:
Beniamino Galvani
2016-04-14 18:34:45 +02:00
parent e0c272c153
commit 0589e659ca

View File

@@ -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);