summaryrefslogtreecommitdiffstats
path: root/shorewall-controller.lua
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-03-05 13:11:31 +0000
committerMika Havela <mika.havela@gmail.com>2008-03-05 13:11:31 +0000
commit192e7f7d10e67e03ae36141e4522155a3debe086 (patch)
tree5159550ef097e0cde9f1be8c1ccf48c67e7136ec /shorewall-controller.lua
parent63f7071f40482ce89b22ceed21129684dd892973 (diff)
downloadacf-shorewall-192e7f7d10e67e03ae36141e4522155a3debe086.tar.bz2
acf-shorewall-192e7f7d10e67e03ae36141e4522155a3debe086.tar.xz
Added another button (got it working)
git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@818 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'shorewall-controller.lua')
-rw-r--r--shorewall-controller.lua133
1 files changed, 125 insertions, 8 deletions
diff --git a/shorewall-controller.lua b/shorewall-controller.lua
index 761500d..9f0f83d 100644
--- a/shorewall-controller.lua
+++ b/shorewall-controller.lua
@@ -102,9 +102,22 @@ function edit_records(self,types,record)
option={},
debug=interfaceslist,
})
+ table.insert(edit[fieldnum]["option"], "-")
for k,v in pairs(config.zones_list.option or {}) do
table.insert(edit[fieldnum]["option"], string.match(v, "^%s*(%S*)"))
end
+ -- IF the value is not one of the existing options, then warn and add this option.
+ for k,v in pairs(edit[fieldnum]["option"]) do
+ edit[fieldnum]["errtxt"] = "'" .. edit[fieldnum]["value"] .. "' is not a valid option!"
+ if (tostring(v) == tostring(edit[fieldnum]["value"])) then
+ edit[fieldnum]["errtxt"] = ""
+ break
+ end
+ end
+ -- Now add this option to the list (just to show what it was)
+ if (#edit[fieldnum]["errtxt"] > 0) then
+ table.insert(edit[fieldnum]["option"], edit[fieldnum]["value"])
+ end
-- Create a cfe-table of the existing records
local fieldnum = 2
@@ -112,12 +125,8 @@ function edit_records(self,types,record)
label="Interfaces",
name="field".. fieldnum,
value=recordtable[fieldnum],
- type="select",
- option={},
+-- descr="Available interfaces are: ",
})
--- for k,v in pairs(config.interfaces_list.option or {}) do
--- table.insert(edit[fieldnum]["option"], string.match(v, "^%s*(%S*)"))
--- end
-- Create a cfe-table of the existing records
local fieldnum = 3
@@ -298,6 +307,115 @@ function edit_records(self,types,record)
})
end
+ if (types == "rules") then
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 1
+ edit[fieldnum] = cfe({
+ label="Action",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ type="select",
+ option={
+ "ACCEPT", "ACCEPT+", "ACCEPT!",
+ "NONAT",
+ "DROP", "DROP!",
+ "REJECT", "REJECT!",
+ "DNAT", "DNAT-",
+ "REDIRECT", "REDIRECT-",
+ "CONTINUE", "CONTINUE!",
+ "LOG",
+ "QUEUE", "QUEUE!",
+ "COMMENT",
+ },
+ })
+ -- IF the value is not one of the existing options, then warn and add this option.
+ for k,v in pairs(edit[fieldnum]["option"]) do
+ edit[fieldnum]["errtxt"] = "Attention! '" .. edit[fieldnum]["value"] .. "' could be a invalid option (or is a action defined in 'actions')."
+ if (tostring(v) == tostring(edit[fieldnum]["value"])) then
+ edit[fieldnum]["errtxt"] = ""
+ break
+ end
+ end
+ -- Now add this option to the list (just to show what it was)
+ if (#edit[fieldnum]["errtxt"] > 0) then
+ table.insert(edit[fieldnum]["option"], edit[fieldnum]["value"])
+ end
+
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 2
+ edit[fieldnum] = cfe({
+ label="Source",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 3
+ edit[fieldnum] = cfe({
+ label="Destination",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 4
+ edit[fieldnum] = cfe({
+ label="Proto",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 5
+ edit[fieldnum] = cfe({
+ label="Destination port",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 6
+ edit[fieldnum] = cfe({
+ label="Source port(s)",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 7
+ edit[fieldnum] = cfe({
+ label="Original destination",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 8
+ edit[fieldnum] = cfe({
+ label="Rate:Limit",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 9
+ edit[fieldnum] = cfe({
+ label="User/Group",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ -- Create a cfe-table of the existing records
+ local fieldnum = 9
+ edit[fieldnum] = cfe({
+ label="Mark",
+ name="field".. fieldnum,
+ value=recordtable[fieldnum],
+ })
+
+ end
return {
edit=edit,
cmdsave=cmdsave,
@@ -349,7 +467,6 @@ function config(self)
return edit_records(self,"rules", self.clientdata.rules_list)
end
-
-- Add a [New] record to the options
table.insert(config.interfaces_list.option, newrecordtxt)
table.insert(config.zones_list.option, newrecordtxt)
@@ -403,8 +520,8 @@ function config(self)
label="Edit above record",
value="Edit",
type="submit",
- disabled="yes",
- errtxt="This button is not yet programmed!",
+-- disabled="yes",
+-- errtxt="This button is not yet programmed!",
})
config.rules_list_cmd.descr="Mark a item in above list before pressing [" .. config.rules_list_cmd.value .. "]"