Enables setting of bridge as a proxy interface.

Setting of dfault value for mcast interfaces.
This commit is contained in:
Artee Roy 2022-01-04 16:04:43 +05:30 committed by Rahul Thakur
parent d3d4c87f82
commit 9675953bf6

View file

@ -59,9 +59,6 @@ mld_p_up_interfaces=""
mld_p_down_interfaces=""
mld_p_exceptions=""
# Standard parameters need by BCM's multicast daemon
allow_brdevice=0
proxdevs=""
ethwan="$(db -q get hw.board.ethernetWanPort)"
@ -170,6 +167,36 @@ config_mcast_querier_params() {
echo "${protocol}-last-member-query-interval $last_mem_q_int" >> $CONFFILE
}
config_snooping_upstream_interface() {
local snooping_upstream_intf=""
json_load "$(devstatus $1)"
logger -t "mcastconf" "$(devstatus $1)"
itr=1
json_select bridge-members
# loop over the bridge and find the device on wan port
while json_get_var dev $itr; do
case "$dev" in
*.*)
port="$(echo "$dev" | cut -d'.' -f 1)"
if [ $port == $ethwan ]; then
ifconfig $dev | grep RUNNING >/dev/null && $snooping_upstream_intf="$dev" && break
fi
;;
esac
itr=$(($itr + 1))
done
json_select ..
# if none of the bridge members are on wan port, set the wan port itself
if [ -n "$snooping_upstream_intf" ]; then
echo "upstream-interface $snooping_upstream_intf" >>$CONFFILE
else
echo "upstream-interface $ethwan" >>$CONFFILE
fi
}
config_snooping_on_bridge() {
local protocol="$1"
local bcm_mcast_p=1
@ -187,39 +214,6 @@ config_snooping_on_bridge() {
done
}
handle_bridged_proxy_interface() {
local p2="$1"
local p_enable=0
if [ "$p2" == "igmp" ]; then
p_enable=$igmp_p_enable
else
p_enable=$mld_p_enable
fi
if [ $p_enable -eq 1 -a $allow_brdevice -eq 1 ]
then
proxdevs="$proxdevs $2"
echo "upstream-interface $2" >>$CONFFILE
else
json_load "$(devstatus $2)"
itr=1
json_select bridge-members
while json_get_var dev $itr; do
case "$dev" in
*.*)
port="$(echo "$dev" | cut -d'.' -f 1)"
if [ $port == $ethwan ]; then
ifconfig $dev | grep RUNNING >/dev/null && proxdevs="$proxdevs $dev" && break
fi
;;
esac
itr=$(($itr + 1))
done
json_select ..
fi
}
config_mcast_proxy_interface() {
local itr
local p1="$1"
@ -234,7 +228,8 @@ config_mcast_proxy_interface() {
for proxif in $2; do
case "$proxif" in
br-*)
handle_bridged_proxy_interface $p1 $proxif
proxdevs="$proxdevs $proxif"
echo "upstream-interface $proxif" >>$CONFFILE
;;
*)
ifconfig $proxif | grep RUNNING >/dev/null && proxdevs="$proxdevs $proxif"
@ -246,7 +241,12 @@ config_mcast_proxy_interface() {
echo "${p1}-proxy-interfaces $proxdevs" >> $CONFFILE
fi
[ -n "$proxdevs" ] && echo "${p1}-mcast-interfaces $proxdevs" >> $CONFFILE
# if proxdevs is empty set the wan port as mcast-interface
if [ -n "$proxdevs" ]; then
echo "${p1}-mcast-interfaces $proxdevs" >> $CONFFILE
else
echo "${p1}-mcast-interfaces $ethwan" >> $CONFFILE
fi
}
configure_mcpd_snooping() {
@ -259,14 +259,14 @@ configure_mcpd_snooping() {
if [ "$protocol" == "igmp" ]; then
config_snooping_common_params $protocol $igmp_s_version $igmp_s_robustness $igmp_s_mode
config_mcast_querier_params $protocol $igmp_s_query_interval $igmp_s_q_resp_interval $igmp_s_last_mem_q_int
config_mcast_proxy_interface $protocol "$igmp_s_iface"
config_snooping_upstream_interface "$igmp_s_iface"
config_snooping_on_bridge $protocol $igmp_s_iface $igmp_s_mode
exceptions=$igmp_s_exceptions
fast_leave=$igmp_s_fast_leave
elif [ "$protocol" == "mld" ]; then
config_snooping_common_params $protocol $mld_s_version $mld_s_robustness $mld_s_mode
config_mcast_querier_params $protocol $mld_s_query_interval $mld_s_q_resp_interval $mld_s_last_mem_q_int
config_mcast_proxy_interface $protocol "$mld_s_iface"
config_snooping_upstream_interface "$mld_s_iface"
config_snooping_on_bridge $protocol $mld_s_iface $mld_s_mode
exceptions=$mld_s_exceptions
fast_leave=$mld_s_fast_leave