From 3e04d552896e3dd0df63c425c00616898aa29bf0 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Mon, 4 May 2015 12:05:53 +0200 Subject: rename_device: allow non-channel nics for s390x machines --- src/rename_device.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') 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; -- cgit v1.2.1