i think i got it
This commit is contained in:
@@ -14,7 +14,6 @@ class TunnelBroker(object):
|
||||
url_ip = 'https://ipv4.clientinfo.square-r00t.net/'
|
||||
params_ip = {'raw': '1'}
|
||||
url_api = 'https://ipv4.tunnelbroker.net/nic/update'
|
||||
def_rt_ip = '::192.88.99.1'
|
||||
|
||||
def __init__(self, conf_xml, tun_id = None, wan_ip = True, update = True, *args, **kwargs):
|
||||
self.conf_file = os.path.abspath(os.path.expanduser(conf_xml))
|
||||
@@ -109,7 +108,7 @@ class TunnelBroker(object):
|
||||
try:
|
||||
ipr.route('add',
|
||||
dst = 'default',
|
||||
# gateway = self.def_rt_ip,
|
||||
gateway = self.tun.server.str,
|
||||
oif = self.iface_idx,
|
||||
family = socket.AF_INET6)
|
||||
logger.debug('Added default route for link {0}.'.format(self.iface_name))
|
||||
@@ -117,28 +116,37 @@ class TunnelBroker(object):
|
||||
logger.error(('Could not add default IPv6 route on link {0}: {1}').format(self.iface_name, e))
|
||||
ipr.close()
|
||||
raise e
|
||||
for alloc in self.tun.allocations:
|
||||
try:
|
||||
ipr.addr('add',
|
||||
index = alloc.iface_idx,
|
||||
address = alloc.ip.str,
|
||||
mask = alloc.ip.prefix,
|
||||
family = socket.AF_INET6)
|
||||
except Exception as e:
|
||||
logger.error(('Could not add address {0} on link {1}: '
|
||||
'{2}').format(str(alloc.ip.str), alloc.iface_idx, e))
|
||||
ipr.close()
|
||||
raise e
|
||||
# Is this necessary?
|
||||
# try:
|
||||
# ipr.route('add',
|
||||
# dst = '::/96',
|
||||
# gateway = '::',
|
||||
# oif = self.iface_idx,
|
||||
# family = socket.AF_INET6)
|
||||
# except Exception as e:
|
||||
# logger.error(('Could not add ::/96 on link {0}: {1}'.format(self.iface_name, e)))
|
||||
for assignment in self.tun.assignments:
|
||||
for a in assignment.iface_addrs:
|
||||
# The interface-specific ":1" addrs.
|
||||
try:
|
||||
ipr.addr('add',
|
||||
index = assignment.iface_idx,
|
||||
address = a.ip.str,
|
||||
mask = a.ip.prefix,
|
||||
family = socket.AF_INET6)
|
||||
except Exception as e:
|
||||
logger.error(('Could not add address {0} on link {1}: '
|
||||
'{2}').format(str(a.ip.str), assignment.iface_idx, e))
|
||||
ipr.close()
|
||||
raise e
|
||||
# The SLAAC prefixes.
|
||||
for b in assignment.iface_blocks:
|
||||
try:
|
||||
ipr.addr('add',
|
||||
index = assignment.iface_idx,
|
||||
address = str(b.ip),
|
||||
mask = b.prefixlen,
|
||||
family = socket.AF_INET6)
|
||||
except Exception as e:
|
||||
logger.error(('Could not add address block {0} on link {1}: '
|
||||
'{2}').format(str(b), assignment.iface_idx, e))
|
||||
ipr.close()
|
||||
raise e
|
||||
ipr.close()
|
||||
if self.tun.enable_radvd:
|
||||
self.tun.radvd.conf.write()
|
||||
self.tun.radvd.svc.restart()
|
||||
return(None)
|
||||
|
||||
def stop(self):
|
||||
@@ -172,6 +180,7 @@ class TunnelBroker(object):
|
||||
ipr.close()
|
||||
raise e
|
||||
ipr.close()
|
||||
self.tun.radvd.svc.stop()
|
||||
return(None)
|
||||
|
||||
def update(self, oneshot = False):
|
||||
|
||||
Reference in New Issue
Block a user