mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
mcastmngr: Add L2 snooping UCI generation.
If the WAN device is a bridge then generate a default configuration using snooping instead of proxying.
This commit is contained in:
parent
bb603cb492
commit
2703db3f2e
1 changed files with 60 additions and 3 deletions
|
|
@ -65,12 +65,69 @@ generate_igmp_proxy_config(){
|
||||||
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
|
uci add_list mcast.@proxy[-1].filter="239.0.0.0/8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_mld_snooping_config(){
|
||||||
|
local u_itf="$1"
|
||||||
|
|
||||||
|
uci add mcast snooping
|
||||||
|
uci rename mcast.@snooping[-1]="mc_snooping_MLD"
|
||||||
|
uci set mcast.@snooping[-1].enable="1"
|
||||||
|
uci set mcast.@snooping[-1].proto="mld"
|
||||||
|
uci set mcast.@snooping[-1].version="2"
|
||||||
|
uci set mcast.@snooping[-1].robustness="2"
|
||||||
|
uci set mcast.@snooping[-1].query_interval="125"
|
||||||
|
uci set mcast.@snooping[-1].query_response_interval="100"
|
||||||
|
uci set mcast.@snooping[-1].last_member_query_interval="10"
|
||||||
|
uci set mcast.@snooping[-1].fast_leave="1"
|
||||||
|
uci set mcast.@snooping[-1].snooping_mode="2"
|
||||||
|
uci set mcast.@snooping[-1].interface="$u_itf"
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_igmp_snooping_config(){
|
||||||
|
local u_itf="$1"
|
||||||
|
|
||||||
|
uci add mcast snooping
|
||||||
|
uci rename mcast.@snooping[-1]="igmp_snooping_1"
|
||||||
|
uci set mcast.@snooping[-1].enable="1"
|
||||||
|
uci set mcast.@snooping[-1].proto="igmp"
|
||||||
|
uci set mcast.@snooping[-1].version="2"
|
||||||
|
uci set mcast.@snooping[-1].robustness="2"
|
||||||
|
uci set mcast.@snooping[-1].query_interval="125"
|
||||||
|
uci set mcast.@snooping[-1].query_response_interval="100"
|
||||||
|
uci set mcast.@snooping[-1].last_member_query_interval="10"
|
||||||
|
uci set mcast.@snooping[-1].fast_leave="1"
|
||||||
|
uci set mcast.@snooping[-1].snooping_mode="2"
|
||||||
|
uci set mcast.@snooping[-1].interface="$u_itf"
|
||||||
|
|
||||||
|
uci add_list mcast.@snooping[-1].filter="239.0.0.0/8"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_wan_bridge() {
|
||||||
|
local config="$1"
|
||||||
|
local wan_device="$2"
|
||||||
|
local name type
|
||||||
|
|
||||||
|
[ $((is_wan_bridge)) -ne 0 ] && return
|
||||||
|
|
||||||
|
config_get type "$config" type
|
||||||
|
config_get name "$config" name
|
||||||
|
|
||||||
|
[ "$type" = "bridge" -a "$wan_device" = "$name" ] && is_wan_bridge=1
|
||||||
|
}
|
||||||
|
|
||||||
generate_mcast_config(){
|
generate_mcast_config(){
|
||||||
|
local up_itf="$(uci -q get network.wan.device)"
|
||||||
|
local is_wan_bridge=0
|
||||||
|
|
||||||
up_itf="$(uci -q get network.wan.device)"
|
config_load network
|
||||||
|
config_foreach check_wan_bridge device "$up_itf"
|
||||||
|
|
||||||
|
if [ $((is_wan_bridge)) -eq 0 ]; then
|
||||||
generate_igmp_proxy_config "$up_itf"
|
generate_igmp_proxy_config "$up_itf"
|
||||||
generate_mld_proxy_config "$up_itf"
|
generate_mld_proxy_config "$up_itf"
|
||||||
|
else
|
||||||
|
generate_igmp_snooping_config "$up_itf"
|
||||||
|
generate_mld_snooping_config "$up_itf"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
interfaces_ok(){
|
interfaces_ok(){
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue