Newer kernels provide the 'net' link as a directory, instead of the
'net:XX' link with previous kernels. The sysfs scanning code has
enablement to work with this, but the directory lookup doesn't
work properly.

References: bnc#561596

Signed-off-by: Hannes Reinecke <h...@suse.de>
---
 utils/fwparam_ibft/fwparam_ibft_sysfs.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c 
b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
index 9185c85..486deec 100644
--- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
@@ -84,7 +84,7 @@ static int find_sysfs_dirs(const char *fpath, const struct 
stat *sb,
 static int get_iface_from_device(char *id, struct boot_context *context)
 {
        char dev_dir[FILENAMESZ];
-       int rc = ENODEV;
+       int rc = EOPNOTSUPP;
        DIR *dirfd;
        struct dirent *dent;
 
@@ -99,8 +99,7 @@ static int get_iface_from_device(char *id, struct 
boot_context *context)
                return errno;
 
        while ((dent = readdir(dirfd))) {
-               if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") ||
-                   strncmp(dent->d_name, "net:", 4))
+               if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
                        continue;
 
                if (!strncmp(dent->d_name, "net:", 4)) {
@@ -116,17 +115,19 @@ static int get_iface_from_device(char *id, struct 
boot_context *context)
                                rc = EINVAL;
                        rc = 0;
                        break;
-               } else {
-                       printf("Could not read ethernet to net link.\n");
-                       rc = EOPNOTSUPP;
+               }
+               if (!strcmp(dent->d_name, "net")) {
+                       rc = ENODEV;
                        break;
                }
        }
 
        closedir(dirfd);
 
-       if (rc != ENODEV)
+       if (rc != ENODEV) {
+               printf("Could not read ethernet to net link\n.");
                return rc;
+       }
 
        /* If not found try again with newer kernel networkdev sysfs layout */
        strlcat(dev_dir, "/net", FILENAMESZ);
-- 
1.7.3.4

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.

Reply via email to