diff --git a/glances/core/glances_autodiscover.py b/glances/core/glances_autodiscover.py index 3648e35f..244aa713 100644 --- a/glances/core/glances_autodiscover.py +++ b/glances/core/glances_autodiscover.py @@ -35,7 +35,7 @@ except ImportError: zeroconf_tag = False # Import Glances libs -from glances.core.glances_globals import appname +from glances.core.glances_globals import appname, is_freebsd from glances.core.glances_logging import logger # Zeroconf 0.17 or higher is needed @@ -194,13 +194,16 @@ class GlancesAutoDiscoverClient(object): except socket.error as e: logger.error("Cannot start zeroconf: {0}".format(e)) - try: - # -B @ overwrite the dynamic IPv4 choice - if zeroconf_bind_address == '0.0.0.0': - zeroconf_bind_address = self.find_active_ip_address() - except KeyError: - # Issue #528 (no network interface available) - pass + # XXX FreeBSD: Segmentation fault (core dumped) + # -- https://bitbucket.org/al45tair/netifaces/issues/15 + if not is_freebsd: + try: + # -B @ overwrite the dynamic IPv4 choice + if zeroconf_bind_address == '0.0.0.0': + zeroconf_bind_address = self.find_active_ip_address() + except KeyError: + # Issue #528 (no network interface available) + pass print("Announce the Glances server on the LAN (using {0} IP address)".format(zeroconf_bind_address)) self.info = ServiceInfo( diff --git a/glances/core/glances_globals.py b/glances/core/glances_globals.py index 4d150e62..5aee9904 100644 --- a/glances/core/glances_globals.py +++ b/glances/core/glances_globals.py @@ -33,6 +33,7 @@ is_py3 = sys.version_info >= (3, 3) # Operating system flag # Note: Somes libs depends of OS is_bsd = sys.platform.find('bsd') != -1 +is_freebsd = sys.platform.startswith('freebsd') is_linux = sys.platform.startswith('linux') is_mac = sys.platform.startswith('darwin') is_windows = sys.platform.startswith('win') diff --git a/glances/plugins/glances_ip.py b/glances/plugins/glances_ip.py index 81df092c..1190a2dd 100644 --- a/glances/plugins/glances_ip.py +++ b/glances/plugins/glances_ip.py @@ -19,17 +19,22 @@ """IP plugin.""" -# Import system libs -try: - import netifaces - netifaces_tag = True -except ImportError: - netifaces_tag = False - # Import Glances libs +from glances.core.glances_globals import is_freebsd from glances.core.glances_logging import logger from glances.plugins.glances_plugin import GlancesPlugin +# XXX FreeBSD: Segmentation fault (core dumped) +# -- https://bitbucket.org/al45tair/netifaces/issues/15 +if not is_freebsd: + try: + import netifaces + netifaces_tag = True + except ImportError: + netifaces_tag = False +else: + netifaces_tag = False + class Plugin(GlancesPlugin):