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.
This commit is contained in:
Amit Kumar 2023-12-12 05:53:42 +00:00 committed by Rahul Thakur
parent 4b279a83a9
commit c260fb4c61

View file

@ -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