mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
mcastmngr: Fix L2 snooping hotplug events.
This commit is contained in:
parent
161cd68c3c
commit
5a2b76c37f
2 changed files with 31 additions and 13 deletions
24
mcastmngr/files/common/etc/hotplug.d/ethernet/mcast.hotplug
Executable file
24
mcastmngr/files/common/etc/hotplug.d/ethernet/mcast.hotplug
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ "$LINK" = "up" -a -n "$PORT" ] || exit 0
|
||||||
|
|
||||||
|
compare_mcast_snooping_interface() {
|
||||||
|
local interface dev running
|
||||||
|
|
||||||
|
config_get interface "$1" interface
|
||||||
|
|
||||||
|
for dev in $interface; do
|
||||||
|
if [ "$PORT" = "$dev" ]; then
|
||||||
|
running=$(ubus call service list '{"name": "mcast"}' | jsonfilter -e '@.mcast.instances')
|
||||||
|
if [ -z "${running}" ]; then
|
||||||
|
/etc/init.d/mcast start
|
||||||
|
else
|
||||||
|
ubus call uci commit '{"config":"mcast"}'
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
config_load mcast
|
||||||
|
config_foreach compare_mcast_snooping_interface "snooping"
|
||||||
20
mcastmngr/files/common/etc/hotplug.d/iface/mcast.hotplug
Normal file → Executable file
20
mcastmngr/files/common/etc/hotplug.d/iface/mcast.hotplug
Normal file → Executable file
|
|
@ -1,27 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
[ "$ACTION" = ifup ] || exit 0
|
[ "$ACTION" = "ifup" -a -n "$INTERFACE" ] || exit 0
|
||||||
|
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
network_get_device l3device $INTERFACE
|
network_get_device l3device "$INTERFACE"
|
||||||
|
|
||||||
[ -n "$l3device" ] || exit 0
|
[ -n "$l3device" ] || exit 0
|
||||||
|
|
||||||
compare_mcast_proxy_upstream() {
|
compare_mcast_proxy_upstream() {
|
||||||
local upstream
|
local upstream dev running
|
||||||
local mode="$2"
|
|
||||||
|
|
||||||
if [ "$mode" == "proxy" ]; then
|
config_get upstream "$1" upstream_interface
|
||||||
config_get upstream $1 upstream_interface
|
|
||||||
else
|
|
||||||
config_get upstream $1 interface
|
|
||||||
fi
|
|
||||||
|
|
||||||
for dev in $upstream; do
|
for dev in $upstream; do
|
||||||
if [ "$l3device" == "$dev" ]; then
|
if [ "$l3device" = "$dev" ]; then
|
||||||
running=$(ubus call service list '{"name": "mcast"}' | jsonfilter -e '@.mcast.instances')
|
running=$(ubus call service list '{"name": "mcast"}' | jsonfilter -e '@.mcast.instances')
|
||||||
if [ -z "${running}" ];then
|
if [ -z "${running}" ]; then
|
||||||
/etc/init.d/mcast start
|
/etc/init.d/mcast start
|
||||||
else
|
else
|
||||||
ubus call uci commit '{"config":"mcast"}'
|
ubus call uci commit '{"config":"mcast"}'
|
||||||
|
|
@ -32,5 +27,4 @@ compare_mcast_proxy_upstream() {
|
||||||
}
|
}
|
||||||
|
|
||||||
config_load mcast
|
config_load mcast
|
||||||
config_foreach compare_mcast_proxy_upstream "proxy" "proxy"
|
config_foreach compare_mcast_proxy_upstream "proxy"
|
||||||
config_foreach compare_mcast_proxy_upstream "snooping" "snooping"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue