diff --git a/vpn_slice/__main__.py b/vpn_slice/__main__.py index 7b90072..a38bec1 100755 --- a/vpn_slice/__main__.py +++ b/vpn_slice/__main__.py @@ -41,19 +41,21 @@ def get_default_providers(): prep = CheckTunDevProvider, ) elif platform.startswith('darwin'): - from distutils.version import LooseVersion from platform import release from .dnspython import DNSPythonProvider from .mac import BSDRouteProvider, MacSplitDNSProvider, PfFirewallProvider, PsProvider from .posix import PosixHostsFileProvider + parsed_release = tuple(int(d) if d.isdigit() else 0 for d in release().split(".")) return dict( process=PsProvider, route=BSDRouteProvider, dns=DNSPythonProvider or DigProvider, hosts=PosixHostsFileProvider, domain_vpn_dns=MacSplitDNSProvider, - firewall = PfFirewallProvider if release() >= LooseVersion('10.6') else None, + # PF firewall was released with MacOS 10.6 Snow Leopard (= Darwin kernel 10.0) + # https://en.wikipedia.org/wiki/Mac_OS_X_Snow_Leopard#Release_history + firewall = PfFirewallProvider if parsed_release >= (10, 0) else None, ) elif platform.startswith('freebsd'): from .dnspython import DNSPythonProvider