mirror of
https://github.com/openwrt/routing.git
synced 2025-12-22 01:44:32 +04:00
naywatch: introduce kick-count
Check multiple rounds if neighbors are available before kicking. This should reduce unneeded reboots. Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
@@ -14,6 +14,8 @@ shift
|
|||||||
INTERFACES="$*"
|
INTERFACES="$*"
|
||||||
|
|
||||||
ACTIVE=0
|
ACTIVE=0
|
||||||
|
NO_NEIGHBORS_COUNT=0
|
||||||
|
MIN_KICK=5
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
@@ -67,6 +69,8 @@ reboot_now() {
|
|||||||
no_neighbors() {
|
no_neighbors() {
|
||||||
log "No Neighbors Available!"
|
log "No Neighbors Available!"
|
||||||
|
|
||||||
|
NO_NEIGHBORS_COUNT=$(($NO_NEIGHBORS_COUNT+1))
|
||||||
|
|
||||||
if [ $ACTIVE -eq 0 ]; then
|
if [ $ACTIVE -eq 0 ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -76,7 +80,7 @@ no_neighbors() {
|
|||||||
write_logs
|
write_logs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $USE_WATCHDOG -eq 0 ]; then
|
if [ $USE_WATCHDOG -eq 0 ] && [ $NO_NEIGHBORS_COUNT -gt $MIN_KICK ]; then
|
||||||
reboot_now
|
reboot_now
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -85,6 +89,7 @@ log "Naywatch Started!"
|
|||||||
|
|
||||||
neighbors() {
|
neighbors() {
|
||||||
ACTIVE=1
|
ACTIVE=1
|
||||||
|
NO_NEIGHBORS_COUNT=0
|
||||||
if [ $USE_WATCHDOG -eq 1 ]; then
|
if [ $USE_WATCHDOG -eq 1 ]; then
|
||||||
echo 1 >&3
|
echo 1 >&3
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user