summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-common/files/usr/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/package/freifunk-common/files/usr/sbin')
-rwxr-xr-xcontrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog b/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog
index 069f4c3217..8ac803d309 100755
--- a/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog
+++ b/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog
@@ -23,6 +23,15 @@ if fs.access("/var/run/olsrd.pid") or fs.access("/var/run/olsrd4.pid") then
if not wdgtime or ( systime - wdgtime ) > ( intv * 2 ) then
os.execute("logger -t 'OLSR watchdog' 'Process died - restarting!'")
+ local tnls = io.popen("ip tunnel show | cut -d : -f 1")
+ while true do
+ tnl = tnls:read("*line")
+ if tnl == nil then break end
+ if string.find(tnl, "tnl_") == 1 then
+ os.execute(string.format("logger -t 'OLSR watchdog' 'Deleting stale tunnel %s'", tnl))
+ os.execute(string.format("ip link del %s", tnl))
+ end
+ end
os.execute("/etc/init.d/olsrd restart")
end
end