1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

fix tunnel v4 to v6 change

This commit is contained in:
Sven Auhagen
2018-04-04 20:53:32 +02:00
parent 887e55019e
commit e452c2cf53
2 changed files with 19 additions and 6 deletions

View File

@@ -87,12 +87,20 @@ class tunnel (moduleBase):
if attr_val != None:
attrs[iproute_attr] = attr_val
if not self.ipcmd.link_exists(ifaceobj.name):
self.ipcmd.tunnel_create (ifaceobj.name, mode, attrs)
else:
attrs['mode'] = mode
self._check_settings(ifaceobj, attrs)
current_attrs = self.ipcmd.link_get_linkinfo_attrs(ifaceobj.name)
try:
if not self.ipcmd.link_exists(ifaceobj.name):
self.ipcmd.tunnel_create (ifaceobj.name, mode, attrs)
elif current_attrs and current_attrs['mode'] != mode and ( ('6' in mode and '6' not in current_attrs['mode']) or ('6' not in mode and '6' in current_attrs['mode']) ):
# Mode changes between ipv4 and ipv6 are not possible without recreating the interface
self.ipcmd.link_delete (ifaceobj.name)
self.ipcmd.tunnel_create (ifaceobj.name, mode, attrs)
else:
attrs['mode'] = mode
self._check_settings(ifaceobj, attrs)
except Exception, e:
self.log_warn (str (e))
def _down (self, ifaceobj):
if not ifupdownflags.flags.PERFMODE and not self.ipcmd.link_exists (ifaceobj.name):

View File

@@ -761,7 +761,12 @@ class iproute2(utilsBase):
""" generic link_create function """
if self.link_exists(tunnelname):
return
cmd = 'tunnel add'
cmd = ''
if '6' in mode:
cmd = ' -6 '
cmd += 'tunnel add'
cmd += ' %s mode %s' %(tunnelname, mode)
if attrs:
for k, v in attrs.iteritems():