summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2026-03-24 15:26:26 +0000
committerGitHub <noreply@github.com>2026-03-24 15:26:26 +0000
commita9a75eb7dce077bceee1ae13dc943b05d8759925 (patch)
treedafec312330120450ba0de57b3f4ca51343178d1 /src
parentcb1b97548ce0cb51ee4445c2b1cdc375cd9b6121 (diff)
parent1b7b7a468cab0fd23fdeef0d0b76d9812d80980a (diff)
downloadvyos-1x-a9a75eb7dce077bceee1ae13dc943b05d8759925.tar.gz
vyos-1x-a9a75eb7dce077bceee1ae13dc943b05d8759925.zip
Merge pull request #5039 from natali-rs1985/T8355
vpp: T8355: Set MTU for vpp interfaces
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces_vxlan.py6
-rw-r--r--src/conf_mode/vpp_interfaces_bonding.py17
-rw-r--r--src/conf_mode/vpp_interfaces_gre.py3
-rw-r--r--src/conf_mode/vpp_interfaces_ipip.py3
-rw-r--r--src/conf_mode/vpp_interfaces_vxlan.py28
5 files changed, 55 insertions, 2 deletions
diff --git a/src/conf_mode/interfaces_vxlan.py b/src/conf_mode/interfaces_vxlan.py
index 5e23654e1..968214354 100755
--- a/src/conf_mode/interfaces_vxlan.py
+++ b/src/conf_mode/interfaces_vxlan.py
@@ -159,8 +159,10 @@ def verify(vxlan):
lower_mtu = Interface(vxlan['source_interface']).get_mtu()
if lower_mtu < (int(vxlan['mtu']) + vxlan_overhead):
- raise ConfigError(f'Underlaying device MTU is to small ({lower_mtu} '\
- f'bytes) for VXLAN overhead ({vxlan_overhead} bytes!)')
+ Warning(
+ f'Underlying device MTU is too small ({lower_mtu} '
+ f'bytes) for VXLAN overhead ({vxlan_overhead} bytes!)'
+ )
# Check for mixed IPv4 and IPv6 addresses
protocol = None
diff --git a/src/conf_mode/vpp_interfaces_bonding.py b/src/conf_mode/vpp_interfaces_bonding.py
index fa49f2da5..46252c635 100644
--- a/src/conf_mode/vpp_interfaces_bonding.py
+++ b/src/conf_mode/vpp_interfaces_bonding.py
@@ -19,10 +19,12 @@
from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.configdep import set_dependents, call_dependents
+from vyos.configverify import verify_mtu_ipv6
from vyos import ConfigError
from vyos.utils.assertion import assert_mac
from vyos.utils.process import is_systemd_service_active
+from vyos.ifconfig import Interface
from vyos.ifconfig.vpp import VPPBondInterface
from vyos.vpp.config_deps import deps_bond_dict
from vyos.vpp.config_deps import deps_bridge_dict
@@ -174,6 +176,19 @@ def verify(config):
f'it already belongs to bridge interface: {", ".join(bridge_members)}.'
)
+ if mtu := config.get('mtu'):
+ mtu = int(mtu)
+ max_mtu = Interface(iface).get_max_mtu()
+ min_mtu = Interface(iface).get_min_mtu()
+ if mtu > max_mtu:
+ raise ConfigError(
+ f'Configured MTU is greater than member interface "{iface}" maximum of {max_mtu}!'
+ )
+ if mtu < min_mtu:
+ raise ConfigError(
+ f'Configured MTU is less than member interface "{iface}" minimum of {min_mtu}!'
+ )
+
if 'mac' in config:
mac = config['mac']
try:
@@ -190,6 +205,8 @@ def verify(config):
f'Cannot remove interface {vif_iface}: it is still in use by the PPPoE server'
)
+ verify_mtu_ipv6(config)
+
def generate(config):
pass
diff --git a/src/conf_mode/vpp_interfaces_gre.py b/src/conf_mode/vpp_interfaces_gre.py
index 1258f906c..3756449a2 100644
--- a/src/conf_mode/vpp_interfaces_gre.py
+++ b/src/conf_mode/vpp_interfaces_gre.py
@@ -21,6 +21,7 @@ from vyos import ConfigError
from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.configdep import set_dependents, call_dependents
+from vyos.configverify import verify_mtu_ipv6
from vyos.utils.process import is_systemd_service_active
from vyos.ifconfig.vpp import VPPGREInterface
@@ -128,6 +129,8 @@ def verify(config):
if config.get('source_address') == config.get('remote'):
raise ConfigError('Remote address must not be the same as source address')
+ verify_mtu_ipv6(config)
+
# Disable checks as point-to-multipoint mode does not work without 'teib' feature that is not implemented yet
# # check multipoint mode
# if config.get('mode') == 'point-to-multipoint':
diff --git a/src/conf_mode/vpp_interfaces_ipip.py b/src/conf_mode/vpp_interfaces_ipip.py
index d029f3619..dd4a19e36 100644
--- a/src/conf_mode/vpp_interfaces_ipip.py
+++ b/src/conf_mode/vpp_interfaces_ipip.py
@@ -21,6 +21,7 @@ from vyos import ConfigError
from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.configdep import set_dependents, call_dependents
+from vyos.configverify import verify_mtu_ipv6
from vyos.utils.process import is_systemd_service_active
from vyos.ifconfig.vpp import VPPIPIPInterface
@@ -102,6 +103,8 @@ def verify(config):
if config.get('source_address') == config.get('remote'):
raise ConfigError('Remote address must not be the same as source address')
+ verify_mtu_ipv6(config)
+
def generate(config):
pass
diff --git a/src/conf_mode/vpp_interfaces_vxlan.py b/src/conf_mode/vpp_interfaces_vxlan.py
index 38349cb4c..ac9a9517b 100644
--- a/src/conf_mode/vpp_interfaces_vxlan.py
+++ b/src/conf_mode/vpp_interfaces_vxlan.py
@@ -18,9 +18,14 @@
from vyos import ConfigError
+from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.configdep import set_dependents, call_dependents
+from vyos.configverify import verify_mtu_ipv6
+from vyos.ifconfig import Interface
+from vyos.template import is_ipv6
+from vyos.utils.network import get_interfaces_by_ip
from vyos.utils.process import is_systemd_service_active
from vyos.ifconfig.vpp import VPPVXLANInterface
@@ -117,6 +122,29 @@ def verify(config):
if config.get('source_address') == config.get('remote'):
raise ConfigError('Remote address must not be the same as source address')
+ # VXLAN adds at least an overhead of 50 bytes - we need to check the
+ # underlying device if our VXLAN package is not going to be fragmented!
+ source_address = config['source_address']
+ vxlan_overhead = 50
+ if is_ipv6(source_address):
+ # IPv6 adds an extra 20 bytes overhead because the IPv6 header is 20
+ # bytes larger than the IPv4 header - assuming no extra options are
+ # in use.
+ vxlan_overhead += 20
+
+ ifaces_with_ip = get_interfaces_by_ip(source_address)
+ vpp_ifaces = config['vpp_ether_vif_ifaces']
+ matching_iface = next((iface for iface in ifaces_with_ip if iface in vpp_ifaces))
+
+ lower_mtu = Interface(matching_iface).get_mtu()
+ if lower_mtu < (int(config['mtu']) + vxlan_overhead):
+ Warning(
+ f'Underlying device MTU is too small ({lower_mtu} bytes) '
+ f'for VXLAN overhead ({vxlan_overhead} bytes!)'
+ )
+
+ verify_mtu_ipv6(config)
+
def generate(config):
pass