From c260fb4c618a6caee1594321942f7dd6f3cea555 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Tue, 12 Dec 2023 05:53:42 +0000 Subject: [PATCH] mcastmngr: disable snooping when proxy instance is disabled * snooping on bridge interfaces should be changed to disable when igmp proxy has been disabled. * updated the function __device_is_bridge() that read the device section of network config. "grep name=.*$device" was resulting into matching of ifname option as well that was resulting in a two line output and causing error while using the output in uci command later. --- mcastmngr/files/linux/lib/mcast/linux.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mcastmngr/files/linux/lib/mcast/linux.sh b/mcastmngr/files/linux/lib/mcast/linux.sh index b969ba676..e3722f562 100755 --- a/mcastmngr/files/linux/lib/mcast/linux.sh +++ b/mcastmngr/files/linux/lib/mcast/linux.sh @@ -15,7 +15,7 @@ snooping_bridges= __device_is_bridge() { local device="$2" - local devsec__="$(uci show network | grep name=.*$device | cut -d'.' -f2)" + local devsec__="$(uci show network | grep name=.*$device | grep -v ifname | cut -d'.' -f2)" local sectype="$(uci -q get network.$devsec__)" local devtype="$(uci -q get network.$devsec__.type)" [ "$sectype" != "device" -o "$devtype" != "bridge" ] && return 1 @@ -311,6 +311,16 @@ config_mcproxy_instance() { PROG_PARAMS="${PROG_PARAMS} -f ${CONFFILE}${PROG_PARAMS_SEPARATOR}" } +disable_snooping_iface() { + local iface="$(uci -q get network.$1.name)" + config_sysfs_mcast_snooping "$iface" 0 +} + +disable_snooping() { + config_load network + config_foreach disable_snooping_iface device +} + config_snooping() { local protocol="$1" @@ -383,6 +393,7 @@ config_snooping() { } config_mcproxy() { + disable_snooping if [ "$igmp_p_enable" == "1" ]; then config_mcproxy_instance igmp "$igmp_p_version" elif [ "$igmp_s_enable" == "1" ]; then