diff --git a/pnp/open-pnp.py b/pnp/open-pnp.py index 28e4c6dc5f199ed4abcd6e7cd15cd55d26d8cf09..634ce2fe15d18893691daababb44f87b8e4780d3 100755 --- a/pnp/open-pnp.py +++ b/pnp/open-pnp.py @@ -590,9 +590,17 @@ def get_local_ip_addresses() -> List[str]: _addresses = [] adapters = get_adapters() for adapter in adapters: - if adapter.nice_name not in ['lo']: - for ip in adapter.ips: - _addresses.append(ip.ip) + for ip in adapter.ips: + drop_ip = False + if ip.is_IPv4: + ip_addr= ip.ip + elif ip.is_IPv6: + ip_addr = ip.ip[0] + for entry in ['127.', 'fe80::', '::1']: + if str(ip_addr).lower().startswith(entry): + drop_ip = True + if not drop_ip: + _addresses.append(ip_addr) return _addresses