net/mwan3: move mwan3track clean up to mwan3 cmd

This is usefull to see the last state of the interface with ubus.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert
2017-07-24 10:20:46 +02:00
parent 96760e66dd
commit 5e123852bc
3 changed files with 22 additions and 7 deletions
+16
View File
@@ -8,6 +8,8 @@ IPT6="ip6tables -t mangle -w"
LOG="logger -t mwan3[$$] -p"
CONNTRACK_FILE="/proc/net/nf_conntrack"
MWAN3_STATUS_DIR="/var/run/mwan3track"
# mwan3's MARKing mask (at least 3 bits should be set)
MMX_MASK=0xff00
@@ -65,6 +67,10 @@ mwan3_unlock() {
lock -u /var/run/mwan3.lock
}
mwan3_lock_clean() {
rm -rf /var/run/mwan3.lock
}
mwan3_get_iface_id()
{
local _tmp _iface _iface_count
@@ -919,3 +925,13 @@ mwan3_flush_conntrack()
$LOG warning "connection tracking not enabled"
fi
}
mwan3_track_clean()
{
rm -rf "$MWAN3_STATUS_DIR/${1}" &> /dev/null
[ -d "$MWAN3_STATUS_DIR" ] && {
if [ -z "$(ls -A "$MWAN3_STATUS_DIR")" ]; then
rm -rf "$MWAN3_STATUS_DIR"
fi
}
}