summaryrefslogtreecommitdiffstats
path: root/network.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2007-10-19 15:23:42 +0000
committerChris Lumens <clumens@redhat.com>2007-10-19 15:23:42 +0000
commit45057203dcccc93d51d76a31d043090f500ba12f (patch)
tree4ae28bb54734488dbea7975fe4f733a34dd608dc /network.py
parent0b7814a745343efbbb64f53775d1594fd5e805c2 (diff)
downloadanaconda-45057203dcccc93d51d76a31d043090f500ba12f.tar.gz
anaconda-45057203dcccc93d51d76a31d043090f500ba12f.tar.xz
anaconda-45057203dcccc93d51d76a31d043090f500ba12f.zip
Filter available network devices by checking their type in sysfs (#338461).
Diffstat (limited to 'network.py')
-rw-r--r--network.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/network.py b/network.py
index 7c1206490..117efb713 100644
--- a/network.py
+++ b/network.py
@@ -279,6 +279,16 @@ class Network:
def getFirstDeviceName(self):
return self.firstnetdevice
+ def _sysfsDeviceIsUsable(self, dev):
+ try:
+ f = open("/sys/class/net/%s/type" % dev)
+ lines = f.readlines()
+ f.close()
+
+ return lines[0].startswith("1")
+ except:
+ return False
+
def available(self):
ksdevice = None
if flags.cmdline.has_key("ksdevice"):
@@ -291,7 +301,7 @@ class Network:
lines = lines[2:]
for line in lines:
dev = string.strip(line[0:6])
- if dev != "lo" and dev[0:3] != "sit" and not self.netdevices.has_key(dev):
+ if dev != "lo" and dev[0:3] != "sit" and not self.netdevices.has_key(dev) and self._sysfsDeviceIsUsable(dev):
if self.firstnetdevice is None:
self.firstnetdevice = dev