summaryrefslogtreecommitdiffstats
path: root/ipsectools-model.lua
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-03-31 15:37:00 +0000
committerMika Havela <mika.havela@gmail.com>2008-03-31 15:37:00 +0000
commitfdaecbf0715a1f68252d400585811d06998b56fc (patch)
tree4629c828859ba8a96301ae5ec87af7b10ca4693d /ipsectools-model.lua
parenta8b03832913061456afd218987402fed23ad076d (diff)
downloadacf-ipsec-tools-fdaecbf0715a1f68252d400585811d06998b56fc.tar.bz2
acf-ipsec-tools-fdaecbf0715a1f68252d400585811d06998b56fc.tar.xz
Changed the looks into a table so it doesn't flood the screenv0.1
git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@866 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'ipsectools-model.lua')
-rw-r--r--ipsectools-model.lua63
1 files changed, 63 insertions, 0 deletions
diff --git a/ipsectools-model.lua b/ipsectools-model.lua
index 5545c78..26d9ffc 100644
--- a/ipsectools-model.lua
+++ b/ipsectools-model.lua
@@ -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(),