diff --git a/mcastmngr/files/common/etc/uci-defaults/61-mcast_config_generate b/mcastmngr/files/common/etc/uci-defaults/61-mcast_config_generate index 92531c288..5b7e13dcb 100644 --- a/mcastmngr/files/common/etc/uci-defaults/61-mcast_config_generate +++ b/mcastmngr/files/common/etc/uci-defaults/61-mcast_config_generate @@ -77,31 +77,32 @@ generate_mcast_config(){ uci commit mcast } -check_if_upstream_untagged(){ +interfaces_ok(){ local section_name=$1 - local up_interf=$(uci -q get ${section_name}.upstream_interface) + local up_interf=$(uci -q get ${section_name}.upstream_interface) + [ -z "$up_interf" ] && return 1 + + local down_interf=$(uci -q get ${section_name}.downstream_interface) + [ -z "$down_interf" ] && return 1 + + # check if upstream untagged IFS=" " for itf in $up_interf; do # check if there exist a device section for this upstream interface, if yes the # do nothing, if no then split the it at . and use the native interface as # upstream interface - dev_section=$(ubus call uci get '{"config":"network", "type":"device", "match":{"name":"$itf"}}' | jsonfilter -e @.values | jq keys[]) + dev_section=$(ubus call uci get '{"config":"network", "type":"device", "match":{"name":"'"$itf"'"}}' | jsonfilter -e @.values | jq keys[]) - if [ ! -z "$dev_section" ]; then - continue - fi # mcast config is outdated, simply generate as per new logic - return + [ -z "$dev_section" ] && return 1 done - - return 1 } if [ -s "/etc/config/mcast" ]; then if uci -q get mcast.@proxy[0] >/dev/null; then - check_if_upstream_untagged "mcast.@proxy[0]" || exit + interfaces_ok "mcast.@proxy[0]" && exit elif uci -q get mcast.@snooping[0] >/dev/null; then # return if there is any valid content exit