Browse Source

mwan3: use MWAN3TRACK_STATUS_DIR variable throughout

Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
lilik-openwrt-22.03
Aaron Goodman 4 years ago
parent
commit
27492f64f8
3 changed files with 13 additions and 13 deletions
  1. +1
    -0
      net/mwan3/files/lib/mwan3/common.sh
  2. +0
    -1
      net/mwan3/files/lib/mwan3/mwan3.sh
  3. +12
    -12
      net/mwan3/files/usr/sbin/mwan3track

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

@ -6,6 +6,7 @@ get_uptime() {
}
SCRIPTNAME="$(basename "$0")"
MWAN3TRACK_STATUS_DIR="/var/run/mwan3track"
LOG()
{
local facility=$1; shift


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

@ -24,7 +24,6 @@ IPv6_REGEX="${IPv6_REGEX}::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-
IPv6_REGEX="${IPv6_REGEX}([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])"
MWAN3_STATUS_DIR="/var/run/mwan3"
MWAN3TRACK_STATUS_DIR="/var/run/mwan3track"
MWAN3_INTERFACE_MAX=""
DEFAULT_LOWEST_METRIC=256
MMX_MASK=""


+ 12
- 12
net/mwan3/files/usr/sbin/mwan3track View File

@ -73,9 +73,9 @@ disconnected() {
}
connected() {
echo "online" > /var/run/mwan3track/$INTERFACE/STATUS
echo "0" > /var/run/mwan3track/$INTERFACE/OFFLINE
get_uptime > /var/run/mwan3track/$INTERFACE/ONLINE
echo "online" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
echo "0" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/OFFLINE
get_uptime > $MWAN3TRACK_STATUS_DIR/$INTERFACE/ONLINE
host_up_count=0
lost=0
turn=0
@ -96,10 +96,10 @@ firstconnect() {
update_status() {
local track_ip=$1
echo "$2" > /var/run/mwan3track/$INTERFACE/TRACK_${track_ip}
echo "$2" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/TRACK_${track_ip}
[ -z "$3" ] && return
echo "$3" > /var/run/mwan3track/$INTERFACE/LATENCY_${track_ip}
echo "$4" > /var/run/mwan3track/$INTERFACE/LOSS_${track_ip}
echo "$3" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/LATENCY_${track_ip}
echo "$4" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/LOSS_${track_ip}
}
main() {
@ -280,7 +280,7 @@ main() {
lost=0
if [ $score -gt $up ]; then
echo "online" > /var/run/mwan3track/$INTERFACE/STATUS
echo "online" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/STATUS
score=$((down+up))
elif [ $score -le $up ]; then
sleep_time=$recovery_interval
@ -292,11 +292,11 @@ main() {
fi
let turn++
mkdir -p "/var/run/mwan3track/${1}"
echo "${lost}" > /var/run/mwan3track/$INTERFACE/LOST
echo "${score}" > /var/run/mwan3track/$INTERFACE/SCORE
echo "${turn}" > /var/run/mwan3track/$INTERFACE/TURN
get_uptime > /var/run/mwan3track/$INTERFACE/TIME
mkdir -p "$MWAN3TRACK_STATUS_DIR/${1}"
echo "${lost}" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/LOST
echo "${score}" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/SCORE
echo "${turn}" > $MWAN3TRACK_STATUS_DIR/$INTERFACE/TURN
get_uptime > $MWAN3TRACK_STATUS_DIR/$INTERFACE/TIME
host_up_count=0
sleep "${sleep_time}" &


Loading…
Cancel
Save