]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
LinkUtils: addrgen: move disable_ipv6 check before MTU check
authorJulien Fortin <julien@cumulusnetworks.com>
Fri, 10 Aug 2018 09:37:41 +0000 (11:37 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Thu, 13 Dec 2018 22:43:57 +0000 (14:43 -0800)
if disable_ipv6 is on there's no need to check for the MTU

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdown2/ifupdownaddons/LinkUtils.py

index c1133fe3661f3f815845ebf6d3146f4375a098e9..a0c7c63efa222cb0579ad5b4b70e8af9a2db37e0 100644 (file)
@@ -2662,16 +2662,15 @@ class LinkUtils(utilsBase):
                 self.logger.debug('%s: ipv6 addrgen already %s' % (ifname, 'off' if addrgen else 'on'))
                 return
 
-            if int(self._link_cache_get([ifname, 'mtu'])) < 1280:
-                self.logger.info('%s: ipv6 addrgen is disabled on device with MTU '
-                                 'lower than 1280: cannot set addrgen %s' % (ifname, 'off' if addrgen else 'on'))
-                return
-
             disabled_ipv6 = self.read_file_oneline('/proc/sys/net/ipv6/conf/%s/disable_ipv6' % ifname)
             if not disabled_ipv6 or int(disabled_ipv6) == 1:
                 self.logger.info('%s: cannot set addrgen: ipv6 is disabled on this device' % ifname)
                 return
 
+            if int(self._link_cache_get([ifname, 'mtu'])) < 1280:
+                self.logger.info('%s: ipv6 addrgen is disabled on device with MTU '
+                                 'lower than 1280: cannot set addrgen %s' % (ifname, 'off' if addrgen else 'on'))
+                return
         except (KeyError, TypeError):
             self.logger.debug('%s: ipv6 addrgen probably not supported or disabled on this device' % ifname)
             return