From d0c9f4554c7707bb579d813279b4ed4ddd52922d Mon Sep 17 00:00:00 2001 From: Marcel Schilling Date: Fri, 29 May 2020 12:41:06 +0200 Subject: [PATCH 1/3] Rename package: vpn_slice -> vpn-slice All documentation and the executable use a dash, so does the what-vpn package name. Just vpn-slice uses it's module name (vpn_slice) for the package as well. This is confusing and makes packaging more difficult. Fixes #51. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 01b9fac..86f2a68 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ ######################################## -setup(name="vpn_slice", +setup(name="vpn-slice", version=version_pep, description=("vpnc-script replacement for easy split-tunnel VPN setup"), long_description=open('description.rst').read(), From ea8235d123c5044b2e4749559c848919f6049d19 Mon Sep 17 00:00:00 2001 From: George Macon Date: Wed, 10 Jun 2020 13:06:47 -0400 Subject: [PATCH 2/3] Handle IPv6Interface objects in DNSProvider --- vpn_slice/dnspython.py | 2 +- vpn_slice/provider.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vpn_slice/dnspython.py b/vpn_slice/dnspython.py index 707abcd..c96962b 100644 --- a/vpn_slice/dnspython.py +++ b/vpn_slice/dnspython.py @@ -1,4 +1,4 @@ -from ipaddress import ip_address +from ipaddress import ip_address, ip_interface from dns.resolver import Resolver, NXDOMAIN, NoAnswer from dns.name import root, from_text diff --git a/vpn_slice/provider.py b/vpn_slice/provider.py index 6ccaf56..77e8c46 100644 --- a/vpn_slice/provider.py +++ b/vpn_slice/provider.py @@ -1,4 +1,5 @@ from abc import ABCMeta, abstractmethod +from ipaddress import ip_interface class ProcessProvider(metaclass=ABCMeta): @@ -102,7 +103,7 @@ class DNSProvider(metaclass=ABCMeta): def configure(self, dns_servers, *, bind_addresses=None, search_domains=()): """Configure provider to use the specified DNS servers, bind addresses, and search domains.""" self.dns_servers = dns_servers - self.bind_addresses = bind_addresses + self.bind_addresses = [ip_interface(a).ip for a in bind_addresses] self.search_domains = search_domains @abstractmethod From e03de6a9027349297d1f281c8ab5c04825221665 Mon Sep 17 00:00:00 2001 From: George Macon Date: Wed, 10 Jun 2020 13:07:17 -0400 Subject: [PATCH 3/3] Follow vpnc-script's route call more closely --- vpn_slice/mac.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vpn_slice/mac.py b/vpn_slice/mac.py index d89aa34..86bff1a 100644 --- a/vpn_slice/mac.py +++ b/vpn_slice/mac.py @@ -1,7 +1,7 @@ import os import re import subprocess -from ipaddress import ip_network +from ipaddress import ip_network, ip_interface from .posix import PosixProcessProvider from .provider import RouteProvider @@ -102,8 +102,8 @@ def set_link_info(self, device, state, mtu=None): self._ifconfig(*args) def add_address(self, device, address): + address = ip_interface(address) if address.version == 6: - family = 'inet6' + self._ifconfig(device, 'inet6', address) else: - family = 'inet' - self._ifconfig(device, family, ip_network(address), address) + self._ifconfig(device, 'inet', address.ip, address.ip, 'netmask', '255.255.255.255')