aboutsummaryrefslogtreecommitdiffstats
path: root/src/rename_device.c
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2015-05-04 12:05:53 +0200
committerLukas Nykryn <lnykryn@redhat.com>2015-05-04 12:05:53 +0200
commit6f860ee8e85cc154c224ba6351da8317c4ff2943 (patch)
tree7561078b730f7d00aecb3457eba9ec39d55525d5 /src/rename_device.c
parent9698de338c4ae26c38d79ed009cc38bdc6326322 (diff)
downloadinitscripts-6f860ee8e85cc154c224ba6351da8317c4ff2943.tar
initscripts-6f860ee8e85cc154c224ba6351da8317c4ff2943.tar.gz
initscripts-6f860ee8e85cc154c224ba6351da8317c4ff2943.tar.bz2
initscripts-6f860ee8e85cc154c224ba6351da8317c4ff2943.tar.xz
initscripts-6f860ee8e85cc154c224ba6351da8317c4ff2943.zip
rename_device: allow non-channel nics for s390x machines
Diffstat (limited to 'src/rename_device.c')
-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;