diff --git a/glances/plugins/glances_ports.py b/glances/plugins/glances_ports.py index 93f939e0..67c392e1 100644 --- a/glances/plugins/glances_ports.py +++ b/glances/plugins/glances_ports.py @@ -118,7 +118,9 @@ class Plugin(GlancesPlugin): # Build the string message for p in self.stats: - if p['status'] is None: + if p['host'] is None: + status = 'None' + elif p['status'] is None: status = 'Scanning' elif isinstance(p['status'], bool_type) and p['status'] is True: status = 'Open' diff --git a/glances/ports_list.py b/glances/ports_list.py index 77f7ec87..a97f8a30 100644 --- a/glances/ports_list.py +++ b/glances/ports_list.py @@ -68,7 +68,10 @@ class GlancesPortsList(object): default_gateway = config.get_value(self._section, 'port_default_gateway', default='False') if default_gateway.lower().startswith('true') and netifaces_tag: new_port = {} - new_port['host'] = netifaces.gateways()['default'][netifaces.AF_INET][0] + try: + new_port['host'] = netifaces.gateways()['default'][netifaces.AF_INET][0] + except KeyError: + new_port['host'] = None # ICMP new_port['port'] = 0 new_port['description'] = 'DefaultGateway'