summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-07-22 16:54:01 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-07-22 16:54:01 -1000
commit24fe3ee26e30c0f1a8b6f1abd1a0854235594d9a (patch)
tree45e82698526706f45a3528da597a3d21b1819877 /isys
parentc554b6085c955e74737167638aac672f0f1ce466 (diff)
downloadanaconda-24fe3ee26e30c0f1a8b6f1abd1a0854235594d9a.tar.gz
anaconda-24fe3ee26e30c0f1a8b6f1abd1a0854235594d9a.tar.xz
anaconda-24fe3ee26e30c0f1a8b6f1abd1a0854235594d9a.zip
Offer physical NIC identification in stage 1 (#261101)
This has been requested for a while. Some people have wanted the ability to do an 'ethtool -p' from stage 1 so they can figure out what NIC port to use. I can understand arguments for this feature, but I have still tried to make it more or less non-invasive. A new button is on the dev selection screen called Identify. Self-explanatory from there.
Diffstat (limited to 'isys')
-rw-r--r--isys/ethtool.c25
-rw-r--r--isys/net.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/isys/ethtool.c b/isys/ethtool.c
index df6554970..d71f81fd4 100644
--- a/isys/ethtool.c
+++ b/isys/ethtool.c
@@ -92,3 +92,28 @@ int setEthtoolSettings(char * dev, ethtool_speed speed,
return 0;
}
+
+int identifyNIC(char *iface, int seconds) {
+ int sock;
+ struct ethtool_value edata;
+ struct ifreq ifr;
+
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ perror("Unable to create socket");
+ return -1;
+ }
+
+ memset(&ifr, 0, sizeof(ifr));
+ memset(&edata, 0, sizeof(edata));
+
+ strcpy(ifr.ifr_name, iface);
+ edata.cmd = ETHTOOL_PHYS_ID;
+ edata.data = seconds;
+ ifr.ifr_data = (caddr_t) &edata;
+
+ if (ioctl(sock, SIOCETHTOOL, &ifr) < 0) {
+ perror("Unable to identify NIC");
+ }
+
+ return 0;
+}
diff --git a/isys/net.h b/isys/net.h
index 4f7e65ce0..e2f2e3a23 100644
--- a/isys/net.h
+++ b/isys/net.h
@@ -54,5 +54,6 @@ typedef enum ethtool_duplex_t { ETHTOOL_DUPLEX_UNSPEC = -1,
/* set ethtool settings */
int setEthtoolSettings(char * dev, ethtool_speed speed, ethtool_duplex duplex);
+int identifyNIC(char *iface, int seconds);
#endif