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

Renamed ipsec-tools to ipsectools to come around a but with the menu-system

git-svn-id: svn://svn.alpinelinux.org/acf/ipsec-tools/trunk@850 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 21e2053e
...@@ -3,10 +3,10 @@ PACKAGE=acf-$(APP_NAME) ...@@ -3,10 +3,10 @@ PACKAGE=acf-$(APP_NAME)
VERSION=0.1 VERSION=0.1
APP_DIST=\ APP_DIST=\
ipsec-tools-controller.lua \ ipsectools-controller.lua \
ipsec-tools-model.lua \ ipsectools-model.lua \
ipsec-tools-status-html.lsp \ ipsectools-status-html.lsp \
ipsec-tools.menu \ ipsectools.menu \
EXTRA_DIST=README Makefile config.mk EXTRA_DIST=README Makefile config.mk
......
...@@ -27,7 +27,7 @@ local function get_version() ...@@ -27,7 +27,7 @@ local function get_version()
end end
local function autostarts() local function autostarts()
local cmd_output_result, cmd_output_error local cmd_output_result
local cmd = "/sbin/rc_status | egrep '^S' | egrep '" .. processname .."' 2>/dev/null" local cmd = "/sbin/rc_status | egrep '^S' | egrep '" .. processname .."' 2>/dev/null"
local f = io.popen( cmd ) local f = io.popen( cmd )
local cmdresult = f:read("*a") local cmdresult = f:read("*a")
...@@ -37,23 +37,26 @@ local function autostarts() ...@@ -37,23 +37,26 @@ local function autostarts()
cmd_output_error = "Not programmed to autostart" cmd_output_error = "Not programmed to autostart"
end end
f:close() f:close()
return cmd_output_result,cmd_output_error return cmd_output_result
end end
local function racoonctl(proto) local function racoonctl()
local cmd_output_result, cmd_output_error local cmd_output_result, cmd_output_error
local cmd = "/usr/sbin/racoonctl show-sa ".. proto .. " 2>/dev/null" local cmd = "/usr/sbin/racoonctl -lll show-sa isakmp 2>/dev/null"
local f = io.popen( cmd ) local f = io.popen( cmd )
local cmdresult = f:read("*a") local cmd_output_result = f:read("*a")
if (cmdresult) and (#cmdresult > 0) then
cmd_output_result = cmdresult
else
cmd_output_error = "Not programmed to autostart"
end
f:close() f:close()
return cmd_output_result,cmd_output_error return cmd_output_result,cmd_output_error
end
local function ip_xfrm(mode)
local cmd_output_result
local cmd = "/bin/ip xfrm " .. mode .. " 2>/dev/null"
local f = io.popen( cmd )
local cmd_output_result = f:read("*a")
f:close()
return cmd_output_result
end end
function process_status_text(procname) function process_status_text(procname)
...@@ -86,25 +89,19 @@ function getstatus() ...@@ -86,25 +89,19 @@ function getstatus()
errtxt=autostart_errtxt, errtxt=autostart_errtxt,
}) })
local racoon_sequense, racoon_errtxt = racoonctl("isakmp")
status.show_isakmp = cfe({ name="show_isakmp", status.show_isakmp = cfe({ name="show_isakmp",
label="racoon show-sa isakmp", label="racoonctl -lll show-sa isakmp",
value=racoon_sequense, value=racoonctl(),
errtxt=racoon_errtxt,
}) })
local racoon_sequense, racoon_errtxt = racoonctl("esp") status.ip_xfrm_state = cfe({ name="show_esp",
status.show_esp = cfe({ name="show_esp", label="ip xfrm state",
label="racoon show-sa esp", value=ip_xfrm("state"),
value=racoon_sequense,
errtxt=racoon_errtxt,
}) })
local racoon_sequense, racoon_errtxt = racoonctl("ah") status.ip_xfrm_policy = cfe({ name="ip_xfrm_policy",
status.show_ah = cfe({ name="show_ah", label="ip xfrm policy",
label="racoon show-sa ah", value=ip_xfrm("policy"),
value=racoon_sequense,
errtxt=racoon_errtxt,
}) })
return status return status
......
...@@ -38,39 +38,16 @@ informationform(myform,tags) ...@@ -38,39 +38,16 @@ informationform(myform,tags)
<DL> <DL>
<? <?
local myform = form.status.show_isakmp local myform = form.status.show_isakmp
io.write("\t<DT") io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
if (#myform.errtxt > 0) then io.write(" class='error'") end io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
io.write(">" .. myform.label .. "</DT>\n")
io.write("\t\t<DD><PRE>" .. myform.value .. "</PRE>\n") local myform = form.status.ip_xfrm_state
if (myform.descr) and (#myform.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end io.write("\t\t<P><B>" .. myform.label .. "</B>\n")
if (#myform.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end io.write("\t\t<PRE>" .. myform.value .. "</PRE></P>\n")
io.write("\t\t</DD>\n")
?>
<?
local myform = form.status.show_esp
io.write("\t<DT")
if (#myform.errtxt > 0) then io.write(" class='error'") end
io.write(">" .. myform.label .. "</DT>\n")
io.write("\t\t<DD><PRE>" .. myform.value .. "</PRE>\n")
if (myform.descr) and (#myform.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end
if (#myform.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end
io.write("\t\t</DD>\n")
?>
<?
local myform = form.status.show_ah
io.write("\t<DT")
if (#myform.errtxt > 0) then io.write(" class='error'") end
io.write(">" .. myform.label .. "</DT>\n")
io.write("\t\t<DD><PRE>" .. myform.value .. "</PRE>\n")
if (myform.descr) and (#myform.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end
if (#myform.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end
io.write("\t\t</DD>\n")
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")
?> ?>
</DL> </DL>
......
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