diff --git a/bundles/pppd/files/restart-pppoe-if-no-public-ip b/bundles/pppd/files/restart-pppoe-if-no-public-ip index fcd1864..65893e6 100644 --- a/bundles/pppd/files/restart-pppoe-if-no-public-ip +++ b/bundles/pppd/files/restart-pppoe-if-no-public-ip @@ -26,13 +26,18 @@ for i in netifaces.interfaces(): system_has_public_ip = False for iface in ifaces: for type in [netifaces.AF_INET, netifaces.AF_INET6]: - for ip in netifaces.ifaddresses(iface)[type]: + try: + ips = netifaces.ifaddresses(iface)[type] + except KeyError: + continue + + for ip in ips try: addr = ip_address(ip['addr']) if not addr.is_private and not addr.is_loopback: system_has_public_ip = True - except: + except Exception: # Apparently not an ip pass