diff --git a/utils/he_ipv6/tunnel.py b/utils/he_ipv6/tunnel.py index 8f00154..2526ab8 100644 --- a/utils/he_ipv6/tunnel.py +++ b/utils/he_ipv6/tunnel.py @@ -1,4 +1,5 @@ import ipaddress +import logging import socket ## import netaddr @@ -8,6 +9,10 @@ from . import ra from . import utils +# TODO: more logging +logger = logging.getLogger() + + class IP(object): type = None version = None @@ -88,12 +93,15 @@ class Assignment(object): _iface_txt = self.xml.attrib['iface'].strip() self.iface = _iface_txt.strip() ipr = IPRoute() + logger.debug('Looking for iface {0}'.format(self.iface)) self.iface_idx = ipr.link_lookup(ifname = self.iface)[0] + logger.debug('Found iface {0} at idx {1}'.format(self.iface, self.iface_idx)) # Link-Local address ll = ipr.get_addr(index = self.iface_idx, family = socket.AF_INET6, scope = 253)[0]['attrs'] addrs = dict(ll)['IFA_ADDRESS'] + logger.debug('Link-Local address for {0}: {1}'.format(addrs)) if isinstance(addrs, (list, tuple)): addr = addrs[0] else: