The original report from the forum.
Some interface drivers don't support/provide min_mtu and max_mtu values so verify_mtu(config) check should be skipped or pass this test
I guess the same with def verify_mtu_ipv6(config):
For example, VyOS in docker with network driver veth
driver: veth
version: 1.0
firmware-version:
expansion-rom-version:
bus-info:
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
vyos@vyos:~$ sudo ip -d link show dev eth0
34: eth0@if35: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
link/ether 02:42:0a:08:08:8a brd ff:ff:ff:ff:ff:ff link-netnsid 0 promiscuity 0
veth addrgenmode none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
vyos@vyos:~$ sudo python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from vyos.ifconfig import Interface
>>> Interface('eth0').get_min_mtu()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 406, in get_min_mtu
return int(self.get_interface('min_mtu'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
>>> Interface('eth0').get_mtu()
1500
>>> Interface('eth0').get_max_mtu()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 417, in get_max_mtu
return int(self.get_interface('max_mtu'))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
>>> quit()One of the suggestions is to check if we have all min_mtu, max_mtu and mtu:
And only then calculate the values:
if all([bool(min_mtu), bool(max_mtu), bool(mtu)]):
if mtu < min_mtu:
raise ConfigError(f'Interface MTU too low, ' \
f'minimum supported MTU is {min_mtu}!')
if mtu > max_mtu:
raise ConfigError(f'Interface MTU too high, ' \
f'maximum supported MTU is {max_mtu}!')