mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
mcastmngr: update proxy config
- generate proxy config by default - resolve bug in processing multiple upstream or downstream interfaces - add hotplug script for mcast - add default values for query interval, response interval and last query response interval
This commit is contained in:
parent
64e0a86b77
commit
c8a8cda534
3 changed files with 57 additions and 26 deletions
25
mcastmngr/files/etc/hotplug.d/iface/mcast.hotplug
Normal file
25
mcastmngr/files/etc/hotplug.d/iface/mcast.hotplug
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
network_get_device l3device $INTERFACE
|
||||
|
||||
[ -n "$l3device" ] || exit 0
|
||||
|
||||
compare_mcast_proxy_upstream() {
|
||||
local upstream
|
||||
|
||||
config_get upstream $1 upstream_interface
|
||||
|
||||
for dev in $upstream; do
|
||||
if [ "$l3device" == "$dev" ]; then
|
||||
ubus call uci commit '{"config":"mcast"}'
|
||||
exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
config_load mcast
|
||||
config_foreach compare_mcast_proxy_upstream "proxy"
|
||||
|
|
@ -21,26 +21,33 @@ generate_igmp_global_params(){
|
|||
}
|
||||
|
||||
generate_mcast_config(){
|
||||
section="$1"
|
||||
|
||||
config_get type "$section" "type"
|
||||
if [ "$type" != "bridge" ]; then
|
||||
return
|
||||
fi
|
||||
up_itf="$(uci -q get network.wan.ifname)"
|
||||
|
||||
uci add mcast snooping
|
||||
uci rename mcast.@snooping[-1]="igmp_snoop_1"
|
||||
uci set mcast.@snooping[-1].enable="0"
|
||||
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].aggregation="0"
|
||||
uci set mcast.@snooping[-1].interface="br-$section"
|
||||
uci add mcast proxy
|
||||
uci rename mcast.@proxy[-1]="igmp_proxy_1"
|
||||
uci set mcast.@proxy[-1].enable="1"
|
||||
uci set mcast.@proxy[-1].proto="igmp"
|
||||
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 up_itf; do
|
||||
uci add_list mcast.@proxy[-1].upstream_interface="$itf"
|
||||
done
|
||||
|
||||
uci add_list mcast.@proxy[-1].filter="239.255.255.250"
|
||||
uci commit mcast
|
||||
}
|
||||
|
||||
if [ -s "/etc/config/mcast" ]; then
|
||||
if uci -q get mcast.@snooping[0] >/dev/null; then
|
||||
if uci -q get mcast.@proxy[0] >/dev/null; then
|
||||
# return if there is any valid content
|
||||
exit
|
||||
else
|
||||
|
|
@ -51,5 +58,4 @@ touch /etc/config/mcast
|
|||
|
||||
generate_igmp_global_params
|
||||
|
||||
config_load network
|
||||
config_foreach generate_mcast_config interface
|
||||
generate_mcast_config
|
||||
|
|
|
|||
|
|
@ -110,9 +110,9 @@ read_proxy() {
|
|||
if [ "$proto" == "igmp" ]; then
|
||||
igmp_p_enable=$sec_enable
|
||||
config_get igmp_p_version "$config" version 2
|
||||
config_get igmp_query_interval "$config" query_interval
|
||||
config_get igmp_q_resp_interval "$config" query_response_interval
|
||||
config_get igmp_last_mem_q_int "$config" last_member_query_interval
|
||||
config_get igmp_query_interval "$config" query_interval 125
|
||||
config_get igmp_q_resp_interval "$config" query_response_interval 100
|
||||
config_get igmp_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get igmp_fast_leave "$config" fast_leave 1
|
||||
config_get igmp_p_robustness "$config" robustness 2
|
||||
config_get igmp_p_mode "$config" snooping_mode 0
|
||||
|
|
@ -125,9 +125,9 @@ read_proxy() {
|
|||
if [ "$proto" == "mld" ]; then
|
||||
mld_p_enable=$sec_enable
|
||||
config_get mld_p_version "$config" version 2
|
||||
config_get mld_query_interval "$config" query_interval
|
||||
config_get mld_q_resp_interval "$config" query_response_interval
|
||||
config_get mld_last_mem_q_int "$config" last_member_query_interval
|
||||
config_get mld_query_interval "$config" query_interval 125
|
||||
config_get mld_q_resp_interval "$config" query_response_interval 100
|
||||
config_get mld_last_mem_q_int "$config" last_member_query_interval 10
|
||||
config_get mld_fast_leave "$config" fast_leave 1
|
||||
config_get mld_p_robustness "$config" robustness 2
|
||||
config_get mld_p_mode "$config" snooping_mode 0
|
||||
|
|
@ -249,13 +249,13 @@ configure_mcpd_snooping() {
|
|||
if [ "$protocol" == "igmp" ]; then
|
||||
config_snooping_common_params $protocol $igmp_p_version $igmp_p_robustness $igmp_s_mode
|
||||
config_mcast_querier_params $protocol $igmp_query_interval $igmp_q_resp_interval $igmp_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol $igmp_s_iface
|
||||
config_mcast_proxy_interface $protocol "$igmp_s_iface"
|
||||
config_snooping_on_bridge $protocol $igmp_s_iface $igmp_s_mode
|
||||
exceptions=$igmp_s_exceptions
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_p_version $mld_p_robustness $mld_s_mode
|
||||
config_mcast_querier_params $protocol $mld_query_interval $mld_q_resp_interval $mld_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol $mld_s_iface
|
||||
config_mcast_proxy_interface $protocol "$mld_s_iface"
|
||||
config_snooping_on_bridge $protocol $mld_s_iface $mld_s_mode
|
||||
exceptions=$mld_s_exceptions
|
||||
fi
|
||||
|
|
@ -273,14 +273,14 @@ configure_mcpd_proxy() {
|
|||
if [ "$protocol" == "igmp" ]; then
|
||||
config_snooping_common_params $protocol $igmp_p_version $igmp_p_robustness $igmp_p_mode
|
||||
config_mcast_querier_params $protocol $igmp_query_interval $igmp_q_resp_interval $igmp_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol $igmp_p_up_interfaces
|
||||
config_mcast_proxy_interface $protocol "$igmp_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $igmp_p_down_interfaces $igmp_p_mode
|
||||
fast_leave=$igmp_fast_leave
|
||||
exceptions=$igmp_p_exceptions
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
config_snooping_common_params $protocol $mld_p_version $mld_p_robustness $mld_p_mode
|
||||
config_mcast_querier_params $protocol $mld_query_interval $mld_q_resp_interval $mld_last_mem_q_int
|
||||
config_mcast_proxy_interface $protocol $mld_p_up_interfaces
|
||||
config_mcast_proxy_interface $protocol "$mld_p_up_interfaces"
|
||||
config_snooping_on_bridge $protocol $mld_p_down_interfaces $mld_p_mode
|
||||
fast_leave=$mld_fast_leave
|
||||
exceptions=$mld_p_exceptions
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue