summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-02-18 11:06:07 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2023-02-20 11:20:03 +0000
commit06d9c549c7b32f9108ec97b16aa01a43cbb9a6e9 (patch)
tree352b4b2414001996ff6a571c2e03c53ad6912248 /python
parent1f7d9af565a892ee533ed34f1458d966bbdc1cb5 (diff)
downloadvyos-1x-06d9c549c7b32f9108ec97b16aa01a43cbb9a6e9.tar.gz
vyos-1x-06d9c549c7b32f9108ec97b16aa01a43cbb9a6e9.zip
T5011: Set default values for min_mtu max_mtu
Some interface drivers don't support/provide min_mtu and max_mtu values For example VyOS in docker container with 'veth' driver on some platforms As a workarund add default values for min/max MTU for calculations and pass function "verify_mtu(config)" (cherry picked from commit 87fb9be4cab3a261406c69c723add7467e4ef1fa)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configverify.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 0085ad5e4..6afb1c596 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -36,8 +36,14 @@ def verify_mtu(config):
mtu = int(config['mtu'])
tmp = Interface(config['ifname'])
- min_mtu = tmp.get_min_mtu()
- max_mtu = tmp.get_max_mtu()
+ # Not all interfaces support min/max MTU
+ # https://vyos.dev/T5011
+ try:
+ min_mtu = tmp.get_min_mtu()
+ max_mtu = tmp.get_max_mtu()
+ except: # Fallback to defaults
+ min_mtu = 68
+ max_mtu = 9000
if mtu < min_mtu:
raise ConfigError(f'Interface MTU too low, ' \