summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-06-29 13:47:27 +0200
committerGitHub <noreply@github.com>2022-06-29 13:47:27 +0200
commitfba14cd5f49802f70bcfaf93aaa25d4440e2f836 (patch)
tree65fbd004e418200df0af41db5cdc66572edca4e0
parent2e8fdce2a94768f82758487336f6a46ab5b20ad6 (diff)
parent313dfa6b8a12c4eb6d72275b34b2e43b029caf90 (diff)
downloadvyos-1x-fba14cd5f49802f70bcfaf93aaa25d4440e2f836.tar.gz
vyos-1x-fba14cd5f49802f70bcfaf93aaa25d4440e2f836.zip
Merge pull request #1378 from vfreex/add-igmp-snooping-option
bridge: T4498: add option to enable/disable IGMP/MLD snooping
-rw-r--r--interface-definitions/interfaces-bridge.xml.in10
-rw-r--r--python/vyos/ifconfig/bridge.py21
2 files changed, 29 insertions, 2 deletions
diff --git a/interface-definitions/interfaces-bridge.xml.in b/interface-definitions/interfaces-bridge.xml.in
index 60edf3ce2..48ee1efbc 100644
--- a/interface-definitions/interfaces-bridge.xml.in
+++ b/interface-definitions/interfaces-bridge.xml.in
@@ -73,12 +73,18 @@
</leafNode>
<node name="igmp">
<properties>
- <help>Internet Group Management Protocol (IGMP) settings</help>
+ <help>Internet Group Management Protocol (IGMP) and Multicast Listener Discovery (MLD) settings</help>
</properties>
<children>
<leafNode name="querier">
<properties>
- <help>Enable IGMP querier</help>
+ <help>Enable IGMP/MLD querier</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="snooping">
+ <properties>
+ <help>Enable IGMP/MLD snooping</help>
<valueless/>
</properties>
</leafNode>
diff --git a/python/vyos/ifconfig/bridge.py b/python/vyos/ifconfig/bridge.py
index ffd9c590f..e4db69c1f 100644
--- a/python/vyos/ifconfig/bridge.py
+++ b/python/vyos/ifconfig/bridge.py
@@ -90,6 +90,10 @@ class BridgeIf(Interface):
'validate': assert_boolean,
'location': '/sys/class/net/{ifname}/bridge/multicast_querier',
},
+ 'multicast_snooping': {
+ 'validate': assert_boolean,
+ 'location': '/sys/class/net/{ifname}/bridge/multicast_snooping',
+ },
}}
_command_set = {**Interface._command_set, **{
@@ -198,6 +202,18 @@ class BridgeIf(Interface):
"""
self.set_interface('multicast_querier', enable)
+ def set_multicast_snooping(self, enable):
+ """
+ Enable or disable multicast snooping on the bridge.
+
+ Use enable=1 to enable or enable=0 to disable
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> BridgeIf('br0').set_multicast_snooping(1)
+ """
+ self.set_interface('multicast_snooping', enable)
+
def add_port(self, interface):
"""
Add physical interface to bridge (member port)
@@ -257,6 +273,11 @@ class BridgeIf(Interface):
value = '1' if 'stp' in config else '0'
self.set_stp(value)
+ # enable or disable multicast snooping
+ tmp = dict_search('igmp.snooping', config)
+ value = '1' if (tmp != None) else '0'
+ self.set_multicast_snooping(value)
+
# enable or disable IGMP querier
tmp = dict_search('igmp.querier', config)
value = '1' if (tmp != None) else '0'