From 4dece6bc10cfff87ed99ce6643aeaff4b2c05e59 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 25 Aug 2014 19:21:34 +0200 Subject: [PATCH] freebsd network support --- oml/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oml/utils.py b/oml/utils.py index c643573..cdd769b 100644 --- a/oml/utils.py +++ b/oml/utils.py @@ -132,7 +132,7 @@ def get_public_ipv6(): def get_interface(): interface = '' - if sys.platform == 'darwin': + if sys.platform == 'darwin' or sys.platform.startswith('freebsd'): #cmd = ['/usr/sbin/netstat', '-rn'] cmd = ['/sbin/route', '-n', 'get', 'default'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True) @@ -146,7 +146,7 @@ def get_interface(): def get_local_ipv4(): ip = None - if sys.platform == 'darwin': + if sys.platform == 'darwin' or sys.platform.startswith('freebsd'): cmd = ['/sbin/route', '-n', 'get', 'default'] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True) stdout, stderr = p.communicate()