Browse Source

Discard interfaces which hasn't device.(lo,virtual).

develop
Mike Hiretsky 11 years ago
parent
commit
f14eacb037
  1. 7
      pym/utils/ip.py

7
pym/utils/ip.py

@ -179,6 +179,7 @@ def getRouteTable(onlyIface=[]):
yield (network,dict(zip(routeParams[0::2],routeParams[1::2])))
def getInterfaces():
"""Get available interfaces"""
return filter(lambda x:x != "lo",
listDirectory('/sys/class/net'))
"""Get available interfaces (discard which hasn't device)"""
sysNet = "/sys/class/net"
return filter(lambda x:path.exists(path.join(sysNet,x,"device")),
listDirectory(sysNet))
Loading…
Cancel
Save