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:
@@ -2662,16 +2662,15 @@ class LinkUtils(utilsBase):
|
|||||||
self.logger.debug('%s: ipv6 addrgen already %s' % (ifname, 'off' if addrgen else 'on'))
|
self.logger.debug('%s: ipv6 addrgen already %s' % (ifname, 'off' if addrgen else 'on'))
|
||||||
return
|
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)
|
disabled_ipv6 = self.read_file_oneline('/proc/sys/net/ipv6/conf/%s/disable_ipv6' % ifname)
|
||||||
if not disabled_ipv6 or int(disabled_ipv6) == 1:
|
if not disabled_ipv6 or int(disabled_ipv6) == 1:
|
||||||
self.logger.info('%s: cannot set addrgen: ipv6 is disabled on this device' % ifname)
|
self.logger.info('%s: cannot set addrgen: ipv6 is disabled on this device' % ifname)
|
||||||
return
|
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):
|
except (KeyError, TypeError):
|
||||||
self.logger.debug('%s: ipv6 addrgen probably not supported or disabled on this device' % ifname)
|
self.logger.debug('%s: ipv6 addrgen probably not supported or disabled on this device' % ifname)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user