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

LinkUtils: addrgen: move disable_ipv6 check before MTU check

if disable_ipv6 is on there's no need to check for the MTU

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2018-08-10 11:37:41 +02:00
parent 7114342b25
commit d4019ee902

View 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