mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-03-14 21:10:11 +01:00
mcastmngr: implement snoop mode for linux targets
This commit is contained in:
parent
a3d9850ae4
commit
3a2674270b
1 changed files with 38 additions and 1 deletions
|
|
@ -11,7 +11,40 @@ PROG_PARAMS=
|
|||
PROG_PARAMS_SEPARATOR=:
|
||||
|
||||
setup_mcast_mode() {
|
||||
unused(){ :;}
|
||||
local snooped_interface=$1
|
||||
local mcast_mode=$2
|
||||
|
||||
local mcast_flood=
|
||||
local devsec=
|
||||
local sectype=
|
||||
local devtype=
|
||||
local ports=
|
||||
if [ -z "$snooped_interface" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $mcast_mode == "2" ]; then # disable mcast flood
|
||||
mcast_flood=0
|
||||
else
|
||||
mcast_flood=1
|
||||
fi
|
||||
|
||||
for intf in $snooped_interface;
|
||||
do
|
||||
devsec="$(uci show network | grep name=.*$intf | cut -d'.' -f2)"
|
||||
sectype="$(uci -q get network.$devsec)"
|
||||
devtype="$(uci -q get network.$devsec.type)"
|
||||
if [ "$sectype" == "device" -a "$devtype" == "bridge" ]; then
|
||||
ports="$(uci get network.$devsec.ports)"
|
||||
for prt in $ports; do
|
||||
echo $mcast_flood > /sys/class/net/$prt/brport/multicast_flood
|
||||
done
|
||||
else
|
||||
if [ -f /sys/class/net/$intf/brport/multicast_flood ]; then
|
||||
echo $mcast_flood > /sys/class/net/$intf/brport/multicast_flood
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
config_mcproxy_interfaces() {
|
||||
|
|
@ -97,6 +130,7 @@ config_mcproxy_instance() {
|
|||
local upstreams=
|
||||
local downstreams=
|
||||
local intf_has_ip=
|
||||
local mcast_mode=2 # default value 2 is for blocking mode
|
||||
|
||||
CONFFILE=/var/etc/mcproxy_"$protocol".conf
|
||||
rm -f $CONFFILE
|
||||
|
|
@ -121,6 +155,7 @@ config_mcproxy_instance() {
|
|||
|
||||
upstreams=$igmp_p_up_interfaces
|
||||
downstreams=$igmp_p_down_interfaces
|
||||
mcast_mode=$igmp_p_mode
|
||||
elif [ "$protocol" == "mld" ]; then
|
||||
case "$version" in
|
||||
[1-2])
|
||||
|
|
@ -140,6 +175,7 @@ config_mcproxy_instance() {
|
|||
|
||||
upstreams=$mld_p_up_interfaces
|
||||
downstreams=$mld_p_down_interfaces
|
||||
mcast_mode=$mld_p_mode
|
||||
fi
|
||||
|
||||
# for snooping to work we should enable it on the bridge, doing it from
|
||||
|
|
@ -156,6 +192,7 @@ config_mcproxy_instance() {
|
|||
config_sysfs_mcast_fastleave $fast_leave
|
||||
fi
|
||||
|
||||
setup_mcast_mode $downstreams $mcast_mode
|
||||
[ -n "$upstreams" ] && [ -n "$downstreams" ] &&
|
||||
config_mcproxy_interfaces "$upstreams" "$downstreams" "$exceptions"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue