From 0da2b87535adeac9eb102da74c5343f597be21f9 Mon Sep 17 00:00:00 2001 From: ramon Date: Wed, 5 Oct 2016 16:24:47 +0000 Subject: [PATCH] #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 --- src/opengnsys/windows/operations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/opengnsys/windows/operations.py b/src/opengnsys/windows/operations.py index 7cfea99..18cf1ad 100644 --- a/src/opengnsys/windows/operations.py +++ b/src/opengnsys/windows/operations.py @@ -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