diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-09-25 20:48:15 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-09-25 20:48:15 +0200 |
commit | 818a75c024e4b4c0403ccfe782fb55517f390bef (patch) | |
tree | c4e91ddc0429694d5c294c3651f7a647a432ef43 | |
parent | 49a79954373eb3f70eddb444e855ed744a322e58 (diff) | |
download | vyos-1x-818a75c024e4b4c0403ccfe782fb55517f390bef.tar.gz vyos-1x-818a75c024e4b4c0403ccfe782fb55517f390bef.zip |
ifconfig: T2653: get_mtu() should return int() for easier comparison
-rw-r--r-- | python/vyos/ifconfig/interface.py | 2 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-macsec.py | 4 | ||||
-rwxr-xr-x | src/conf_mode/interfaces-vxlan.py | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index c8ba05edd..a0f0ffe04 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -321,7 +321,7 @@ class Interface(Control): >>> Interface('eth0').get_mtu() '1500' """ - return self.get_interface('mtu') + return int(self.get_interface('mtu')) def set_mtu(self, mtu): """ diff --git a/src/conf_mode/interfaces-macsec.py b/src/conf_mode/interfaces-macsec.py index abf8b05c3..a224c540e 100755 --- a/src/conf_mode/interfaces-macsec.py +++ b/src/conf_mode/interfaces-macsec.py @@ -92,8 +92,8 @@ def verify(macsec): # MACsec adds a 40 byte overhead (32 byte MACsec + 8 bytes VLAN 802.1ad # and 802.1q) - we need to check the underlaying MTU if our configured # MTU is at least 40 bytes less then the MTU of our physical interface. - underlay_mtu = int(Interface(macsec['source_interface']).get_mtu()) - if underlay_mtu < (int(macsec['mtu']) + 40): + lower_mtu = Interface(macsec['source_interface']).get_mtu() + if lower_mtu < (int(macsec['mtu']) + 40): raise ConfigError('MACsec overhead does not fit into underlaying device MTU,\n' \ f'{underlay_mtu} bytes is too small!') diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py index a00c58608..850ea28d7 100755 --- a/src/conf_mode/interfaces-vxlan.py +++ b/src/conf_mode/interfaces-vxlan.py @@ -72,8 +72,8 @@ def verify(vxlan): if 'source_interface' in vxlan: # VXLAN adds a 50 byte overhead - we need to check the underlaying MTU # if our configured MTU is at least 50 bytes less - underlay_mtu = int(Interface(vxlan['source_interface']).get_mtu()) - if underlay_mtu < (int(vxlan['mtu']) + 50): + lower_mtu = Interface(vxlan['source_interface']).get_mtu() + if lower_mtu < (int(vxlan['mtu']) + 50): raise ConfigError('VXLAN has a 50 byte overhead, underlaying device ' \ f'MTU is to small ({underlay_mtu} bytes)') |