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:
@@ -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):
|
||||
|
@@ -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():
|
||||
|
Reference in New Issue
Block a user