mcastmngr: fixed mcproxy crash

Fixed mcproxy crash during bootup for non broadcom platforms
This commit is contained in:
Ratish 2023-05-22 12:06:56 +05:30
parent d04f1930d1
commit c0495af6e1
2 changed files with 46 additions and 2 deletions

View file

@ -20,7 +20,12 @@ compare_mcast_proxy_upstream() {
for dev in $upstream; do
if [ "$l3device" == "$dev" ]; then
running=$(ubus call service list '{"name": "mcast"}' | jsonfilter -e '@.mcast.instances')
if [ -z "${running}" ];then
/etc/init.d/mcast start
else
ubus call uci commit '{"config":"mcast"}'
fi
exit
fi
done

View file

@ -1,6 +1,7 @@
#!/bin/sh
. /lib/mcast/common.sh
. /lib/functions/network.sh
include /lib/network
@ -95,6 +96,7 @@ config_mcproxy_instance() {
local exceptions=
local upstreams=
local downstreams=
local intf_has_ip=
CONFFILE=/var/etc/mcproxy_"$protocol".conf
rm -f $CONFFILE
@ -157,7 +159,40 @@ config_mcproxy_instance() {
[ -n "$upstreams" ] && [ -n "$downstreams" ] &&
config_mcproxy_interfaces "$upstreams" "$downstreams" "$exceptions"
# In case on proxy, upstreams is a list. Iterating and running the mcproxy
# for each valid upstream interface
for upstream_device in $upstreams;
do
# Read the upstream interface for the upstream device
# upstream device can have multiple logical interfaces like wan and wan6
# but same l3 device
local upstream_ifaces=$(get_network_of $upstream_device)
for iface in $upstream_ifaces;
do
if [ "$protocol" == "igmp" ]; then
network_get_ipaddr upstream_ip $iface
if [ ! -z "${upstream_ip}" ]; then
intf_has_ip=1
break
fi
fi
if [ "$protocol" == "mld" ]; then
network_get_ipaddr6 upstream_ip $iface
if [ ! -z "${upstream_ip}" ]; then
intf_has_ip=1
break
fi
fi
done
if [ -z "${intf_has_ip}" ]; then
continue
fi
PROG_PARAMS="${PROG_PARAMS} -f ${CONFFILE}${PROG_PARAMS_SEPARATOR}"
done
}
config_mcproxy() {
@ -203,4 +238,8 @@ configure_mcast() {
read_mcast_snooping_params
read_mcast_proxy_params
config_mcproxy
if [ -z "${PROG_PARAMS}" ]; then
exit 0
fi
}