From 31e86c9665e9f3b1d2a812978f6412623cb1e5dc Mon Sep 17 00:00:00 2001 From: "Matthias P. Walther" Date: Sun, 2 Jun 2019 15:34:38 +0200 Subject: [PATCH] Tunneldigger Watchdog: Switch from debugfs to batctl o to check for mesh-vpn connectivity. Minor refractoring. --- .../files/usr/bin/tunneldigger-watchdog | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package/gluon-mesh-vpn-tunneldigger/files/usr/bin/tunneldigger-watchdog b/package/gluon-mesh-vpn-tunneldigger/files/usr/bin/tunneldigger-watchdog index dccfcf98..45107331 100755 --- a/package/gluon-mesh-vpn-tunneldigger/files/usr/bin/tunneldigger-watchdog +++ b/package/gluon-mesh-vpn-tunneldigger/files/usr/bin/tunneldigger-watchdog @@ -16,20 +16,21 @@ function readPidFile() end function getNeighbourCount() - local list = io.lines("/sys/kernel/debug/batman_adv/bat0/originators") - if list~=nil then - for line in list do + local handleBatctl = io.popen("batctl o", 'r') + if handleBatctl~=nil then + for line in handleBatctl:lines() do if line:find('mesh%-vpn') then + handleBatctl.close() return 1 end end end + handleBatctl.close() return nil end local uci = require('simple-uci').cursor() -local tunneldiggerEnabled = uci:get_bool('tunneldigger', 'mesh_vpn', 'enabled') -if tunneldiggerEnabled then +if uci:get_bool('tunneldigger', 'mesh_vpn', 'enabled') then if io.popen("pgrep tunneldigger"):read("*l") ~= readPidFile() then io.popen('logger -t tunneldigger-watchdog "Process-Pid does not match with pid-File."') restartTunneldigger()