73 lines
2.3 KiB
Diff
73 lines
2.3 KiB
Diff
From 81d78014be4b985c8f86159d7abed6a9f73b128c Mon Sep 17 00:00:00 2001
|
|
From: Gris Ge <fge@redhat.com>
|
|
Date: Thu, 28 Apr 2022 21:20:26 +0800
|
|
Subject: [PATCH] nm bridge: Fix multicast_router option
|
|
|
|
Adding the missing support of multicast_router option of linux bridge
|
|
with these values:
|
|
* 0: disabled
|
|
* 1: auto
|
|
* 2: enabled
|
|
|
|
Integration test case included and marked as tier 1 as oVirt requested
|
|
this.
|
|
|
|
Signed-off-by: Gris Ge <fge@redhat.com>
|
|
---
|
|
libnmstate/nm/bridge.py | 20 ++++++++++++++++++++
|
|
tests/integration/linux_bridge_test.py | 22 ++++++++++++++++++++++
|
|
2 files changed, 42 insertions(+)
|
|
|
|
diff --git a/libnmstate/nm/bridge.py b/libnmstate/nm/bridge.py
|
|
index e7d28e2b..4241c926 100644
|
|
--- a/libnmstate/nm/bridge.py
|
|
+++ b/libnmstate/nm/bridge.py
|
|
@@ -17,6 +17,7 @@
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
#
|
|
|
|
+from libnmstate.error import NmstateNotImplementedError
|
|
from libnmstate.schema import LinuxBridge as LB
|
|
|
|
from .bridge_port_vlan import nmstate_port_vlan_to_nm
|
|
@@ -42,6 +43,12 @@ NM_BRIDGE_OPTIONS_MAP = {
|
|
OPT.MULTICAST_STARTUP_QUERY_INTERVAL: "multicast_startup_query_interval",
|
|
}
|
|
|
|
+NM_BRIDGE_MCAST_ROUTER_VALUE_MAP = {
|
|
+ 0: "disabled",
|
|
+ 1: "auto",
|
|
+ 2: "enabled",
|
|
+}
|
|
+
|
|
|
|
def create_setting(
|
|
bridge_state, base_con_profile, original_desired_iface_state
|
|
@@ -80,6 +87,8 @@ def _set_bridge_properties(bridge_setting, options):
|
|
bridge_setting.props.multicast_snooping = val
|
|
elif key == LB.STP_SUBTREE:
|
|
_set_bridge_stp_properties(bridge_setting, val)
|
|
+ elif key == LB.Options.MULTICAST_ROUTER:
|
|
+ _set_bridge_mcast_router(bridge_setting, val)
|
|
elif key in NM_BRIDGE_OPTIONS_MAP:
|
|
nm_prop_name = NM_BRIDGE_OPTIONS_MAP[key]
|
|
# NM is using the sysfs name
|
|
@@ -138,3 +147,14 @@ def create_port_setting(options, base_con_profile):
|
|
|
|
def get_port(nm_device):
|
|
return nm_device.get_slaves()
|
|
+
|
|
+
|
|
+def _set_bridge_mcast_router(bridge_setting, nmstate_value):
|
|
+ nm_value = NM_BRIDGE_MCAST_ROUTER_VALUE_MAP.get(nmstate_value)
|
|
+ if nm_value:
|
|
+ bridge_setting.props.multicast_router = nm_value
|
|
+ else:
|
|
+ raise NmstateNotImplementedError(
|
|
+ f"Unsupported value {nmstate_value} for "
|
|
+ "multicast_router bridge option"
|
|
+ )
|
|
--
|
|
2.35.3
|
|
|