Fix MTU of NetworkManager bridge VLAN interfaces
We are seeing an issue on Rocky Linux 9 where VLAN interfaces on bridges
have their MTU set to MTU-1 after rebooting. This is likely related to
how MTU is set by NetworkManager for bridges: it first sets the MTU to
MTU-1 before setting it to the correct value [1].
We can work around this issue by not explicitly setting the MTU
configuration on the VLAN interface if it is the same as the parent
bridge. It will be automatically inherited from the parent.
[1] 864872e9a8
Closes-Bug: #2039947
Change-Id: I23366f4de7842e7c2fe40e431fac76f26e9892de
This commit is contained in:
parent
4e2a0d2e8d
commit
ee63b3253d
@ -12,7 +12,7 @@
|
|||||||
interfaces_ether_interfaces: >
|
interfaces_ether_interfaces: >
|
||||||
{{ network_interfaces |
|
{{ network_interfaces |
|
||||||
net_select_ethers |
|
net_select_ethers |
|
||||||
map('net_interface_obj') |
|
map('net_interface_obj', names=network_interfaces) |
|
||||||
list }}
|
list }}
|
||||||
interfaces_bridge_interfaces: >
|
interfaces_bridge_interfaces: >
|
||||||
{{ network_interfaces |
|
{{ network_interfaces |
|
||||||
|
@ -374,7 +374,7 @@ def _validate_rules(rules):
|
|||||||
|
|
||||||
|
|
||||||
@jinja2.pass_context
|
@jinja2.pass_context
|
||||||
def net_interface_obj(context, name, inventory_hostname=None):
|
def net_interface_obj(context, name, inventory_hostname=None, names=None):
|
||||||
"""Return a dict representation of a network interface.
|
"""Return a dict representation of a network interface.
|
||||||
|
|
||||||
The returned dict is compatible with the interfaces_ether_interfaces
|
The returned dict is compatible with the interfaces_ether_interfaces
|
||||||
@ -394,6 +394,27 @@ def net_interface_obj(context, name, inventory_hostname=None):
|
|||||||
netmask = None
|
netmask = None
|
||||||
vlan = net_vlan(context, name, inventory_hostname)
|
vlan = net_vlan(context, name, inventory_hostname)
|
||||||
mtu = net_mtu(context, name, inventory_hostname)
|
mtu = net_mtu(context, name, inventory_hostname)
|
||||||
|
|
||||||
|
# NOTE(priteau): do not pass MTU for VLAN interfaces on bridges when it is
|
||||||
|
# identical to the parent bridge, to work around a NetworkManager bug.
|
||||||
|
if names is not None and net_is_vlan_interface(context, name,
|
||||||
|
inventory_hostname):
|
||||||
|
# Make a mapping of bridge interfaces and their MTUs
|
||||||
|
bridge_mtus = {}
|
||||||
|
for bridge in net_select_bridges(context, names, inventory_hostname):
|
||||||
|
bridge_interface = net_interface(context, bridge,
|
||||||
|
inventory_hostname)
|
||||||
|
bridge_mtus[bridge_interface] = net_mtu(context, bridge,
|
||||||
|
inventory_hostname)
|
||||||
|
|
||||||
|
# Get parent and check for its MTU if it is a bridge
|
||||||
|
parent_or_device = get_vlan_parent(
|
||||||
|
context, name, device, vlan, inventory_hostname)
|
||||||
|
if parent_or_device in bridge_mtus:
|
||||||
|
parent_mtu = bridge_mtus[parent_or_device]
|
||||||
|
if mtu == parent_mtu:
|
||||||
|
mtu = None
|
||||||
|
|
||||||
routes = net_routes(context, name, inventory_hostname)
|
routes = net_routes(context, name, inventory_hostname)
|
||||||
if routes:
|
if routes:
|
||||||
routes = [_route_obj(route) for route in routes]
|
routes = [_route_obj(route) for route in routes]
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Adds a workaround to avoid NetworkManager setting the MTU of bridge VLAN
|
||||||
|
interfaces to an incorrect value.
|
||||||
|
`LP#2039947 <https://bugs.launchpad.net/kayobe/+bug/2039947>`__
|
Loading…
Reference in New Issue
Block a user