Commit fdaecbf0 authored by Mika Havela's avatar Mika Havela
Browse files

Changed the looks into a table so it doesn't flood the screen

git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@866 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent a8b03832
......@@ -50,6 +50,64 @@ local function racoonctl()
return cmd_output_result,cmd_output_error
end
local function racoonctl_table()
local value = racoonctl()
local output = {}
for k,v in pairs(format.string_to_table(value,"\n")) do
if not (string.find(v,"^Source")) then
output[k]={}
local variable=format.string_to_table(v,"%s+")
output[k]['Source']=cfe({
name="Source",
label="Source",
value=variable[1],
})
output[k]['Destination']=cfe({
name="Destination",
label="Destination",
value=variable[2],
})
output[k]['Cookies']=cfe({
name="Cookies",
label="Cookies",
value=variable[3],
})
output[k]['St']=cfe({
name="St",
label="Variable St",
value=variable[4],
})
output[k]['S']=cfe({
name="S",
label="Variable S",
value=variable[5],
})
output[k]['V']=cfe({
name="V",
label="Variable V",
value=variable[6],
})
output[k]['E']=cfe({
name="E",
label="Variable E",
value=variable[7],
})
output[k]['Created']=cfe({
name="Created",
label="Created",
value=(variable[8] or "") .. " " .. (variable[9] or ""),
})
output[k]['Phase2']=cfe({
name="Phase2",
label="Phase2",
value=variable[10],
})
end
end
return output
end
local function ip_xfrm(mode)
local cmd_output_result
local cmd = "/bin/ip xfrm " .. mode .. " 2>/dev/null"
......@@ -89,6 +147,11 @@ function getstatus()
errtxt=autostart_errtxt,
})
status.show_isakmp2 = cfe({ name="show_isakmp2",
label="Tunnels",
value=racoonctl_table(),
})
status.show_isakmp = cfe({ name="show_isakmp",
label="racoonctl -lll show-sa isakmp",
value=racoonctl(),
......
......@@ -35,18 +35,44 @@ informationform(myform,tags)
</DL>
<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
<H3>Phase1</H3>
<DL>
<TABLE>
<TR><TD CLASS='header'>Source</TD><TD CLASS='header'>Destination</TD><TD CLASS='header'>Cookies</TD><TD CLASS='header'>St</TD><TD CLASS='header'>S</TD><TD CLASS='header'>V</TD><TD CLASS='header'>E</TD><TD CLASS='header'>Created</TD><TD CLASS='header'>Phase2</TD></TR>
<?
local myform = form.status.show_isakmp2.value
for k,v in pairs(myform) do
io.write("\t<TR>\n")
io.write("\t \t<TD>" .. (v['Source']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['Destination']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['Cookies']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['St']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['S']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['V']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['E']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['Created']['value'] or "") .. "</TD>\n")
io.write("\t \t<TD>" .. (v['Phase2']['value'] or "") .. "</TD>\n")
io.write("\t</TR>\n")
end
?>
</TABLE>
</DL>
<H3>Phase2</H3>
<DL>
<?
local myform = form.status.show_isakmp
io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
local myform = form.status.ip_xfrm_state
io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
?>
</DL>
<H3>Policy</H3>
<DL>
<?
local myform = form.status.ip_xfrm_policy
io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
?>
......
Supports Markdown
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