From 0b07050ce43b1907d272b8c7a62cccbf3dbdbedd Mon Sep 17 00:00:00 2001 From: brent s Date: Sun, 10 May 2020 17:22:29 -0400 Subject: [PATCH] more tweaking --- utils/he_ipv6.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/he_ipv6.py b/utils/he_ipv6.py index c3a45f5..0990239 100755 --- a/utils/he_ipv6.py +++ b/utils/he_ipv6.py @@ -107,7 +107,9 @@ class TunnelBroker(object): logger.debug('Set server IP to {0}.'.format(str(self.server))) self.allocations = [ipaddress.ip_network(ip.strip()) for ip in self.cfg['allocations'].split(',')] logger.debug('Using address allocations: {0}'.format(', '.join([str(ip) for ip in self.allocations]))) - self.addr = ipaddress.ip_network(self.cfg['address'].strip()) + _net = ipaddress.ip_network(self.cfg['address'].strip(), strict = False) + self.addr = ipaddress.ip_address(self.cfg['address'].strip().split('/')[0]) + self.network = ipaddress.ip_network(self.cfg['address'].strip(), strict = False) for k in ('user', 'update_key'): setattr(self, k, self.cfg[k]) # Don't log creds, even in debug. @@ -170,10 +172,12 @@ class TunnelBroker(object): try: self.ipr.addr('add', index = self.iface_idx, - address = str(self.addr.network_address), - mask = self.addr.prefixlen, + address = str(self.addr), + mask = self.network.prefixlen, family = socket.AF_INET6) - logger.debug('Added address {0} to link {1}.'.format(str(self.addr), self.iface_name)) + logger.debug('Added address {0} to link {1} with prefix {2}.'.format(str(self.addr), + self.iface_name, + self.network.prefixlen)) except Exception as e: logger.error(('Could not add address {0} on link {1}: ' '{2}').format(str(self.addr), self.iface_name, e))