add originatoer file for netmon

This commit is contained in:
Jan-Tarek 2014-07-22 01:24:30 +02:00
parent 9500d6dbc4
commit 9844e185f9
1 changed files with 20 additions and 6 deletions

View File

@ -1,8 +1,22 @@
local orig =util.exec([[awk '/O/ {next} /B/ {next} {gsub("(\\))|(\\()|(\]:)|(\\[)","",$0)} $5 ~ /wlan[0-9\-]*/ {print "" $1 "," $3 ""}' /sys/kernel/debug/batman_adv/bat0/originators]])
local originators = {}
for _, line in ipairs(util.split(orig)) do
if( line ~= nil and line ~= '') then
table.insert(originators, util.split(line,","))
local originators = io.lines ('/sys/kernel/debug/batman_adv/bat0/originators')
local orig = {}
local arr = {}
local direct_vpn=false
for o in originators do
if o:find('%[%s*mesh%-vpn%]:') then
direct_vpn=true
else
table.insert (arr, o)
end
end
return originators
for i=3,#arr do
local t={}
for a in arr[i]:gmatch("%S+") do
table.insert(t,a)
end
if (direct_vpn==true and t[6]:find('wlan[0-9%-]*')~=nil) or (direct_vpn==false and t[1]==t[4]) then
table.insert(orig,{t[1],t[3]:match("%d+")})
end
end
return orig