summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces_ethernet.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-04-07 19:37:22 +0200
committerGitHub <noreply@github.com>2024-04-07 19:37:22 +0200
commit96f7fb69fb6ba34f15e35b4cddbb108eebda6199 (patch)
tree1046cc126729244a7c74472454318c164516a89b /src/conf_mode/interfaces_ethernet.py
parentb286552f1d0f1bfa23eea29ab92426db27efc425 (diff)
parentfbaa707f72ac1a0214ca57c8768fefa4b818738b (diff)
downloadvyos-1x-96f7fb69fb6ba34f15e35b4cddbb108eebda6199.tar.gz
vyos-1x-96f7fb69fb6ba34f15e35b4cddbb108eebda6199.zip
Merge pull request #3276 from vyos/mergify/bp/sagitta/pr-3265
ethernet: T5862: default MTU is not acceptable in some environments (backport #3265)
Diffstat (limited to 'src/conf_mode/interfaces_ethernet.py')
-rwxr-xr-xsrc/conf_mode/interfaces_ethernet.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py
index 41efdb03c..6da7e6a69 100755
--- a/src/conf_mode/interfaces_ethernet.py
+++ b/src/conf_mode/interfaces_ethernet.py
@@ -152,6 +152,19 @@ def get_config(config=None):
base = ['interfaces', 'ethernet']
ifname, ethernet = get_interface_dict(conf, base, with_pki=True)
+ # T5862 - default MTU is not acceptable in some environments
+ # There are cloud environments available where the maximum supported
+ # ethernet MTU is e.g. 1450 bytes, thus we clamp this to the adapters
+ # maximum MTU value or 1500 bytes - whatever is lower
+ if 'mtu' not in ethernet:
+ try:
+ ethernet['mtu'] = '1500'
+ max_mtu = EthernetIf(ifname).get_max_mtu()
+ if max_mtu < int(ethernet['mtu']):
+ ethernet['mtu'] = str(max_mtu)
+ except:
+ pass
+
if 'is_bond_member' in ethernet:
update_bond_options(conf, ethernet)