[elliot@xxxxxxxxx: anaconda: Assume there is link on devices that don't support the required ioctls]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Anaconda currently does not detect link for drivers that do not support
the IOCTLs. I found that in QEMU when trying to test iSCSI Anaconda
tried to setup networking even if the network was configured. This patch
assumes that if there is link on devices that don't support the required
ioctls.

Elliot

user:        Elliot Peele <http://issues.rpath.com/>
files:       isys/linkdetect.c

Assume there is link on devices that don't support the required ioctls
(RPL-2301)

diff -r 925b8bd510d7 -r 3e60e4b058e2 isys/linkdetect.c
--- a/isys/linkdetect.c	Mon Mar 10 12:29:50 2008 -0400
+++ b/isys/linkdetect.c	Wed Mar 26 16:02:08 2008 -0400
@@ -73,6 +73,8 @@
     int i, mii_val[32];
 
     if (ioctl(sock, SIOCGMIIPHY, &ifr) < 0) {
+        if (errno == EOPNOTSUPP)
+            return -2;
 	if (errno != ENODEV)
 #ifdef STANDALONE
 	    fprintf(stderr, "SIOCGMIIPHY on '%s' failed: %s\n",
@@ -113,6 +115,9 @@
 #ifdef STANDALONE
         fprintf(stderr, "Cannot get link status (%d): %s\n", errno, strerror(errno));
 #endif
+    } else {
+        // ethtool not supported by driver
+        return -2;
     }
 
     return -1;
@@ -122,6 +127,7 @@
 
 int get_link_status(char * devname) {
     int sock, rc;
+    int link_status_supported = 1;
 
     if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
 #ifdef STANDALONE
@@ -145,13 +151,15 @@
     if (rc == 1) {
         close(sock);
         return 1;
+    } else if (rc == -2) {
+        link_status_supported = 0;
     }
 
     rc = get_mii_link_status(sock);
 #ifdef STANDALONE
     printf("MII link status of %s is: %d\n", devname, rc);
 #endif
-    if (rc == 1) {
+    if (rc == 1 || (rc == -2 && link_status_supported == 0)) {
         close(sock);
         return 1;
     }

-- 
Elliot Peele
rPath, Inc.
elliot@xxxxxxxxx

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux