]> git.proxmox.com Git - mirror_ifupdown2.git/blobdiff - ifupdown2/ifupdownaddons/LinkUtils.py
.gitignore: pycharm remote execution update
[mirror_ifupdown2.git] / ifupdown2 / ifupdownaddons / LinkUtils.py
index 509e827bce86e22eeb5e94bd9bbebf726fb20f44..368441482f1ae851e22e0b5b24dd1579c2456860 100644 (file)
@@ -1311,7 +1311,8 @@ class LinkUtils(utilsBase):
                           remoteips=None,
                           learning='on',
                           ageing=None,
-                          anycastip=None):
+                          anycastip=None,
+                          ttl=None):
         if svcnodeip and remoteips:
             raise Exception("svcnodeip and remoteip is mutually exclusive")
         args = ''
@@ -1321,6 +1322,8 @@ class LinkUtils(utilsBase):
             args += ' ageing %s' % ageing
         if learning == 'off':
             args += ' nolearning'
+        if ttl is not None:
+            args += ' ttl %s' % ttl
 
         if self.link_exists(name):
             cmd = 'link set dev %s type vxlan dstport %d' % (name, LinkUtils.VXLAN_UDP_PORT)
@@ -1370,8 +1373,8 @@ class LinkUtils(utilsBase):
         return False
 
     @staticmethod
-    def link_add_macvlan(ifname, macvlan_ifacename):
-        utils.exec_commandl(['ip', 'link', 'add',  'link', ifname, 'name', macvlan_ifacename, 'type', 'macvlan', 'mode', 'private'])
+    def link_add_macvlan(ifname, macvlan_ifacename, mode):
+        utils.exec_commandl(['ip', 'link', 'add',  'link', ifname, 'name', macvlan_ifacename, 'type', 'macvlan', 'mode', mode])
 
     @staticmethod
     def route_add(route):
@@ -2747,17 +2750,18 @@ class LinkUtils(utilsBase):
             # is to flush our internal address cache
             self.reset_addr_cache(ifname)
 
-        cmd = 'link set dev %s addrgenmode %s' % (ifname, 'none' if addrgen else 'eui64')
+        cmd = 'link set dev %s addrgenmode %s' % (ifname, Link.ifla_inet6_addr_gen_mode_dict.get(addrgen))
 
         is_link_up = self.is_link_up(ifname)
 
         if is_link_up:
             self.link_down(ifname)
 
-        if LinkUtils.ipbatch:
-            self.add_to_batch(cmd)
-        else:
-            utils.exec_command('%s %s' % (utils.ip_cmd, cmd))
+        #if LinkUtils.ipbatch:
+        #    self.add_to_batch(cmd)
+        #else:
+        # because this command might fail on older kernel its better to not batch it
+        utils.exec_command('%s %s' % (utils.ip_cmd, cmd))
 
         if is_link_up:
             self.link_up(ifname)