mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
mcastmngr: update uci default script
This commit is contained in:
parent
f4a33e75bd
commit
a92372c236
1 changed files with 55 additions and 24 deletions
|
|
@ -20,9 +20,31 @@ generate_igmp_global_params(){
|
|||
uci commit mcast
|
||||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
generate_mld_proxy_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
up_itf="$(uci -q get network.wan.device)"
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="mc_proxy_MLD"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="mld"
|
||||
uci set mcast.@proxy[-1].version="2"
|
||||
uci set mcast.@proxy[-1].robustness="2"
|
||||
uci set mcast.@proxy[-1].query_interval="125"
|
||||
uci set mcast.@proxy[-1].query_response_interval="100"
|
||||
uci set mcast.@proxy[-1].last_member_query_interval="10"
|
||||
uci set mcast.@proxy[-1].fast_leave="1"
|
||||
uci set mcast.@proxy[-1].snooping_mode="2"
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $u_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
generate_igmp_proxy_config(){
|
||||
local u_itf="$1"
|
||||
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="igmp_proxy_1"
|
||||
|
|
@ -38,46 +60,55 @@ generate_mcast_config(){
|
|||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $up_itf; do
|
||||
for itf in $u_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
|
||||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="mc_proxy_MLD"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="mld"
|
||||
uci set mcast.@proxy[-1].version="1"
|
||||
uci set mcast.@proxy[-1].robustness="2"
|
||||
uci set mcast.@proxy[-1].query_interval="125"
|
||||
uci set mcast.@proxy[-1].query_response_interval="100"
|
||||
uci set mcast.@proxy[-1].last_member_query_interval="10"
|
||||
uci set mcast.@proxy[-1].fast_leave="1"
|
||||
uci set mcast.@proxy[-1].snooping_mode="2"
|
||||
uci add_list mcast.@proxy[-1].downstream_interface="br-lan"
|
||||
|
||||
IFS=" "
|
||||
for itf in $up_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
up_itf="$(uci -q get network.wan.device)"
|
||||
|
||||
generate_igmp_proxy_config "$up_itf"
|
||||
generate_mld_proxy_config "$up_itf"
|
||||
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
check_if_upstream_untagged(){
|
||||
local section_name=$1
|
||||
local up_interf=$(uci -q get ${section_name}.upstream_interface)
|
||||
|
||||
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[])
|
||||
|
||||
if [ ! -z "$dev_section" ]; then
|
||||
continue
|
||||
fi
|
||||
# mcast config is outdated, simply generate as per new logic
|
||||
return
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
if [ -s "/etc/config/mcast" ]; then
|
||||
if uci -q get mcast.@proxy[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
check_if_upstream_untagged "mcast.@proxy[0]" || exit
|
||||
elif uci -q get mcast.@snooping[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
else
|
||||
rm -f /etc/config/mcast
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f /etc/config/mcast
|
||||
touch /etc/config/mcast
|
||||
|
||||
generate_igmp_global_params
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue