#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-378ad31fedc9
remotes/github/oglive
ramon 2016-10-05 16:24:47 +00:00
parent 44e1e4c038
commit 0da2b87535
1 changed files with 3 additions and 1 deletions

View File

@ -66,12 +66,14 @@ def getNetworkInfo():
adapters = wmobj.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IpEnabled=True")
try:
for obj in adapters:
if obj.DefaultIPGateway == "None": # Skip adapters without default router
continue
for ip in obj.IPAddress:
if ':' in ip: # Is IPV6, skip this
continue
if ip is None or ip == '' or ip.startswith('169.254') or ip.startswith('0.'): # If single link ip, or no ip
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)
except Exception:
return