#718: OGAgent para Windows solo detecta interfaces de red con router definido para ignorar los virtuales.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@5029 a21b9725-9963-47de-94b9-378ad31fedc9remotes/github/oglive
parent
44e1e4c038
commit
0da2b87535
|
@ -66,12 +66,14 @@ def getNetworkInfo():
|
||||||
adapters = wmobj.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IpEnabled=True")
|
adapters = wmobj.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IpEnabled=True")
|
||||||
try:
|
try:
|
||||||
for obj in adapters:
|
for obj in adapters:
|
||||||
|
if obj.DefaultIPGateway == "None": # Skip adapters without default router
|
||||||
|
continue
|
||||||
for ip in obj.IPAddress:
|
for ip in obj.IPAddress:
|
||||||
if ':' in ip: # Is IPV6, skip this
|
if ':' in ip: # Is IPV6, skip this
|
||||||
continue
|
continue
|
||||||
if ip is None or ip == '' or ip.startswith('169.254') or ip.startswith('0.'): # If single link ip, or no ip
|
if ip is None or ip == '' or ip.startswith('169.254') or ip.startswith('0.'): # If single link ip, or no ip
|
||||||
continue
|
continue
|
||||||
# logger.debug('Net config found: {}=({}, {})'.format(obj.Caption, obj.MACAddress, ip))
|
logger.debug('Net config found: {}=({}, {})'.format(obj.Caption, obj.MACAddress, ip))
|
||||||
yield utils.Bunch(name=obj.Caption, mac=obj.MACAddress, ip=ip)
|
yield utils.Bunch(name=obj.Caption, mac=obj.MACAddress, ip=ip)
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue