aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2015-05-04 12:05:53 +0200
committerLukas Nykryn <lnykryn@redhat.com>2015-05-06 13:51:35 +0200
commit3e04d552896e3dd0df63c425c00616898aa29bf0 (patch)
tree391dccb098c4dd0e04aaedfce4fa6267d0ecc0bb /src
parentbc80dbf1ab23037fb37a7c750c4be7b9e99b7b69 (diff)
downloadinitscripts-3e04d552896e3dd0df63c425c00616898aa29bf0.tar
initscripts-3e04d552896e3dd0df63c425c00616898aa29bf0.tar.gz
initscripts-3e04d552896e3dd0df63c425c00616898aa29bf0.tar.bz2
initscripts-3e04d552896e3dd0df63c425c00616898aa29bf0.tar.xz
initscripts-3e04d552896e3dd0df63c425c00616898aa29bf0.zip
rename_device: allow non-channel nics for s390x machines
Diffstat (limited to 'src')
-rw-r--r--src/rename_device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rename_device.c b/src/rename_device.c
index f45e996c..d49205ed 100644
--- a/src/rename_device.c
+++ b/src/rename_device.c
@@ -186,6 +186,8 @@ struct netdev *get_configs() {
#if defined(__s390__) || defined(__s390x__)
if (g_str_has_prefix(lines[i],"SUBCHANNELS=")) {
hwaddr = dequote(lines[i] + 12, NULL);
+ } else if (g_str_has_prefix(lines[i],"HWADDR=")) {
+ hwaddr = dequote(lines[i] + 7, NULL);
}
#else
if (g_str_has_prefix(lines[i],"HWADDR=")) {
@@ -222,6 +224,13 @@ char *get_hwaddr(char *device) {
if (asprintf(&path, "/sys/class/net/%s/device/.", device) == -1)
return NULL;
contents = read_subchannels(path);
+
+ if (contents == NULL) {
+ if (asprintf(&path, "/sys/class/net/%s/address", device) == -1)
+ return NULL;
+ g_file_get_contents(path, &contents, NULL, NULL);
+ }
+
#else
if (asprintf(&path, "/sys/class/net/%s/address", device) == -1)
return NULL;