Browse Source

mwan3: add locking debug possibility

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
lilik-openwrt-22.03
Florian Eckert 6 years ago
parent
commit
2ff9c8ecb7
5 changed files with 13 additions and 11 deletions
  1. +4
    -4
      net/mwan3/files/etc/hotplug.d/iface/15-mwan3
  2. +2
    -2
      net/mwan3/files/etc/hotplug.d/iface/16-mwan3
  3. +2
    -0
      net/mwan3/files/lib/mwan3/mwan3.sh
  4. +2
    -2
      net/mwan3/files/usr/sbin/mwan3
  5. +3
    -3
      net/mwan3/files/usr/sbin/mwan3rtmon

+ 4
- 4
net/mwan3/files/etc/hotplug.d/iface/15-mwan3 View File

@ -16,11 +16,11 @@ config_load mwan3
config_get_bool enabled globals 'enabled' '0'
[ ${enabled} -gt 0 ] || exit 0
mwan3_lock
mwan3_lock "$ACTION" "$INTERFACE"
mwan3_init
mwan3_set_connected_iptables
mwan3_set_custom_ipset
mwan3_unlock
mwan3_unlock "$ACTION" "$INTERFACE"
config_get enabled $INTERFACE enabled 0
config_get initial_state $INTERFACE initial_state "online"
@ -58,7 +58,7 @@ else
running=1
fi
mwan3_lock
mwan3_lock "$ACTION" "$INTERFACE"
$LOG notice "Execute "$ACTION" event on interface $INTERFACE (${DEVICE:-unknown})"
case "$ACTION" in
@ -91,6 +91,6 @@ case "$ACTION" in
;;
esac
mwan3_unlock
mwan3_unlock "$ACTION" "$INTERFACE"
exit 0

+ 2
- 2
net/mwan3/files/etc/hotplug.d/iface/16-mwan3 View File

@ -9,9 +9,9 @@ config_get_bool enabled globals 'enabled' '0'
[ ${enabled} -gt 0 ] || exit 0
if [ "$ACTION" == "ifup" ]; then
mwan3_lock
mwan3_lock "$ACTION" "mwan3rtmon"
mwan3_rtmon
mwan3_unlock
mwan3_unlock "$ACTION" "mwan3rtmon"
fi
exit 0

+ 2
- 0
net/mwan3/files/lib/mwan3/mwan3.sh View File

@ -163,9 +163,11 @@ mwan3_init()
mwan3_lock() {
lock /var/run/mwan3.lock
# $LOG debug "$1 $2 (lock)"
}
mwan3_unlock() {
# $LOG debug "$1 $2 (unlock)"
lock -u /var/run/mwan3.lock
}


+ 2
- 2
net/mwan3/files/usr/sbin/mwan3 View File

@ -136,7 +136,7 @@ stop()
{
local ipset route rule table IP IPT pid
mwan3_lock
mwan3_lock "command" "mwan3"
for pid in $(pgrep -f "mwan3rtmon"); do
kill -TERM "$pid" > /dev/null 2>&1
@ -186,7 +186,7 @@ stop()
$IPS -q destroy $ipset
done
mwan3_unlock
mwan3_unlock "command" "mwan3"
mwan3_lock_clean
rm -rf $MWAN3_STATUS_DIR $MWAN3TRACK_STATUS_DIR


+ 3
- 3
net/mwan3/files/usr/sbin/mwan3rtmon View File

@ -24,15 +24,15 @@ main() {
sleep 3
while true; do
mwan3_lock
mwan3_lock "service" "mwan3rtmon"
[ mwan3_remon_ipv4 = "1" ] || \
[ mwan3_rtmon_ipv6 = "1" ] && break
mwan3_unlock
mwan3_unlock "service" "mwan3rtmon"
[ "$rtmon_interval" = "0" ] && break
sleep "$rtmon_interval" &
wait
done
mwan3_unlock
mwan3_unlock "service" "mwan3rtmon"
}
main "$@"

Loading…
Cancel
Save