summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-03-31 21:38:17 +0200
committerChristian Poessinger <christian@poessinger.com>2022-03-31 21:40:39 +0200
commit8ab73ce0f84e10ae3c4f6bdb341b7b6b11db66b4 (patch)
tree531f3df1abdc2e932e503a3e821a385fbc93e64b
parentb99043b645eba05667909cfb573a3ad532659308 (diff)
downloadvyos-1x-8ab73ce0f84e10ae3c4f6bdb341b7b6b11db66b4.tar.gz
vyos-1x-8ab73ce0f84e10ae3c4f6bdb341b7b6b11db66b4.zip
vyos.ifconfig: T4330: bugfix changing MTU when IPv6 is disabled
Commit f8b3d8999c ("ipv6: T4319: do not configure IPv6 related settings if it's disabled") moved the MTU configuration part under the code path which is only run if IPv6 is enabled on the system. This prevented MTU changes on IPv6 disabled systems. (cherry picked from commit 53e20097d227ebf4bdb4dc6c85427ec9c5ec3982)
-rw-r--r--python/vyos/ifconfig/interface.py8
-rwxr-xr-xsmoketest/scripts/cli/test_system_ipv6.py12
2 files changed, 16 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index b06fd1294..e8278b103 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -1386,10 +1386,6 @@ class Interface(Control):
value = tmp if (tmp != None) else '1'
self.set_ipv6_dad_messages(value)
- # MTU - Maximum Transfer Unit
- if 'mtu' in config:
- self.set_mtu(config.get('mtu'))
-
# Delete old IPv6 EUI64 addresses before changing MAC
for addr in (dict_search('ipv6.address.eui64_old', config) or []):
self.del_ipv6_eui64_address(addr)
@@ -1406,6 +1402,10 @@ class Interface(Control):
for addr in tmp:
self.add_ipv6_eui64_address(addr)
+ # MTU - Maximum Transfer Unit
+ if 'mtu' in config:
+ self.set_mtu(config.get('mtu'))
+
# re-add ourselves to any bridge we might have fallen out of
if 'is_bridge_member' in config:
bridge_dict = config.get('is_bridge_member')
diff --git a/smoketest/scripts/cli/test_system_ipv6.py b/smoketest/scripts/cli/test_system_ipv6.py
index 6fe58701b..837d1dc12 100755
--- a/smoketest/scripts/cli/test_system_ipv6.py
+++ b/smoketest/scripts/cli/test_system_ipv6.py
@@ -21,6 +21,7 @@ from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.template import is_ipv4
from vyos.util import read_file
from vyos.util import is_ipv6_enabled
+from vyos.util import get_interface_config
from vyos.validate import is_intf_addr_assigned
base_path = ['system', 'ipv6']
@@ -69,6 +70,17 @@ class TestSystemIPv6(VyOSUnitTestSHIM.TestCase):
else:
self.assertFalse(is_intf_addr_assigned('lo', addr))
+ # T4330: Verify MTU can be changed with IPv6 disabled
+ mtu = '1600'
+ eth_if = 'eth0'
+ self.cli_set(['interfaces', 'ethernet', eth_if, 'mtu', mtu])
+ self.cli_commit()
+
+ tmp = get_interface_config(eth_if)
+ self.assertEqual(tmp['mtu'], int(mtu))
+
+ self.cli_delete(['interfaces', 'ethernet', eth_if, 'mtu'])
+
def test_system_ipv6_strict_dad(self):
# This defaults to 1
self.assertEqual(read_file(file_dad), '1')