Commit bafb292e authored by Ted Trask's avatar Ted Trask

Clean up changes for phase2details

parent ddb5e9ba
......@@ -33,23 +33,9 @@ local descr = {
-- ################################################################################
-- LOCAL FUNCTIONS
local function phase2details(dst)
local output = {}
dst = string.match(dst,"^(.*)%.") -- Removes the portnumber
local value = modelfunctions.run_executable({"ip", "xfrm", "state", "list", "src", dst})
-- Get rid of all lines that don't start with "src"
table.insert(output, {label="Outgoing", value=string.gsub(value, "\n[^s][^\n]*", "")})
value = modelfunctions.run_executable({"ip", "xfrm", "state", "list", "dst", dst})
-- Get rid of all lines that don't start with "src"
table.insert(output, {label="Incoming", value=string.gsub(value, "\n[^s][^\n]*", "")})
return output
end
local function racoonctl_table()
local output = {}
local value = modelfunctions.run_executable({"ip", "xfrm", "state", "list", "src", dst})
local value = modelfunctions.run_executable({"ip", "xfrm", "state"})
-- Get rid of all lines that don't start with "src"
local phase2details = string.gsub(value, "\n[^s][^\n]*", "")
......@@ -95,16 +81,15 @@ local function racoonctl_table()
})
local dst = string.match(variable[2],"^(.*)%.") -- Removes the portnumber
local input = {}
local output = {}
for l in string.gmatch(phase2details, "src [^n]* "..dst.."\n") do
input[#input+1] = l
local incoming = {}
local outgoing = {}
for l in string.gmatch(phase2details, "src [^\n]* "..dst.."\n") do
outgoing[#outgoing+1] = l
end
for l in string.gmatch(phase2details, "src "..dst.." [^\n]*\n") do
output[#output+1] = l
incoming[#incoming+1] = l
end
local phase2s = {{label="Outgoing", value=table.concat(output)}, {label="Incoming", value=table.concat(input)}}
--local phase2s = phase2details(variable[2])
local phase2s = {{label="Outgoing", value=table.concat(outgoing)}, {label="Incoming", value=table.concat(incoming)}}
entry['Phase2']=cfe({
label="Phase2",
value=variable[10],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment