summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-31 22:24:32 +0000
committerSteven Barth <steven@midlink.org>2008-03-31 22:24:32 +0000
commit184f13334f470141420a189220dd3b951aac4480 (patch)
treea110745e118b4970362599e8b45272506f67f9ba /src/ffluci
parent746fdf6b472e72cb01b0c3510cc3eb04be1237b7 (diff)
* Fixed haserl-lua Makefile
* Fixed a bug in CBI that occured when target UCI is empty * Added frontend for port forwarding / firewall pages
Diffstat (limited to 'src/ffluci')
-rw-r--r--src/ffluci/cbi.lua3
-rw-r--r--src/ffluci/model/cbi/admin_network/firewall.lua37
-rw-r--r--src/ffluci/model/cbi/admin_network/portfw.lua18
-rw-r--r--src/ffluci/model/menu/00main.lua2
-rw-r--r--src/ffluci/model/uci.lua4
5 files changed, 62 insertions, 2 deletions
diff --git a/src/ffluci/cbi.lua b/src/ffluci/cbi.lua
index d89405516..5bc40499c 100644
--- a/src/ffluci/cbi.lua
+++ b/src/ffluci/cbi.lua
@@ -111,6 +111,9 @@ function Map.__init__(self, config, ...)
if not self.ucidata then
error("Unable to read UCI data: " .. self.config)
else
+ if not self.ucidata[self.config] then
+ self.ucidata[self.config] = {}
+ end
self.ucidata = self.ucidata[self.config]
end
end
diff --git a/src/ffluci/model/cbi/admin_network/firewall.lua b/src/ffluci/model/cbi/admin_network/firewall.lua
new file mode 100644
index 000000000..fc7bea61b
--- /dev/null
+++ b/src/ffluci/model/cbi/admin_network/firewall.lua
@@ -0,0 +1,37 @@
+-- ToDo: Translate, Add descriptions and help texts
+m = Map("luci_fw", "Firewall")
+
+s = m:section(TypedSection, "rule")
+s.addremove = true
+
+chain = s:option(ListValue, "chain", "Kette")
+chain:value("forward", "Forward")
+chain:value("input", "Input")
+chain:value("output", "Output")
+chain:value("prerouting", "Prerouting")
+chain:value("postrouting", "Postrouting")
+
+s:option(Value, "iface", "Eingangsschnittstelle").optional = true
+s:option(Value, "oface", "Ausgangsschnittstelle").optional = true
+s:option(Value, "proto", "Protokoll").optional = true
+s:option(Value, "source", "Quelladresse").optional = true
+s:option(Value, "destination", "Zieladresse").optional = true
+s:option(Value, "sport", "Quellports").optional = true
+s:option(Value, "dport", "Zielports").optional = true
+s:option(Value, "to", "Neues Ziel").optional = true
+
+state = s:option(MultiValue, "state", "Status")
+state.optional = true
+state.delimiter = ","
+state:value("NEW", "neu")
+state:value("ESTABLISHED", "etabliert")
+state:value("RELATED", "zugehörig")
+state:value("INVALID", "ungültig")
+
+s:option(Value, "jump", "Aktion", "ACCEPT, REJECT, DROP, MASQUERADE, DNAT, SNAT, ...").optional = true
+
+
+add = s:option(Value, "command", "Befehl")
+add.size = 50
+
+return m \ No newline at end of file
diff --git a/src/ffluci/model/cbi/admin_network/portfw.lua b/src/ffluci/model/cbi/admin_network/portfw.lua
new file mode 100644
index 000000000..6f8822a89
--- /dev/null
+++ b/src/ffluci/model/cbi/admin_network/portfw.lua
@@ -0,0 +1,18 @@
+-- ToDo: Translate, Add descriptions and help texts
+m = Map("luci_fw", "Portweiterleitung")
+
+s = m:section(TypedSection, "portfw")
+s.addremove = true
+s.anonymous = true
+
+iface = s:option(Value, "in_interface", "Externes Interface")
+
+proto = s:option(ListValue, "proto", "Protokoll")
+proto:value("tcp", "TCP")
+proto:value("udp", "UDP")
+
+dport = s:option(Value, "dport", "Externer Port", "Port[:Endport]")
+
+to = s:option(Value, "to", "Interne Adresse", "IP-Adresse[:Zielport[-Zielendport]]")
+
+return m \ No newline at end of file
diff --git a/src/ffluci/model/menu/00main.lua b/src/ffluci/model/menu/00main.lua
index 64fc36462..966c4228c 100644
--- a/src/ffluci/model/menu/00main.lua
+++ b/src/ffluci/model/menu/00main.lua
@@ -17,6 +17,8 @@ act("vlan", "Switch")
act("ifaces", "Schnittstellen")
act("ptp", "PPPoE / PPTP")
act("routes", "Statische Routen")
+act("portfw", "Portweiterleitung")
+act("firewall", "Firewall")
add("admin", "wifi", "Drahtlos", 40)
act("devices", "Geräte")
diff --git a/src/ffluci/model/uci.lua b/src/ffluci/model/uci.lua
index 94a385c7e..828659780 100644
--- a/src/ffluci/model/uci.lua
+++ b/src/ffluci/model/uci.lua
@@ -157,12 +157,12 @@ end
function Session._uci3(self, cmd)
local res = ffluci.sys.execl(self.ucicmd .. " 2>&1 " .. cmd)
- if res[1]:sub(1, ucicmd:len() + 1) == ucicmd .. ":" then
+ if res[1] and res[1]:sub(1, self.ucicmd:len()+1) == self.ucicmd..":" then
return nil, res[1]
end
table = {}
-
+
for k,line in pairs(res) do
c, s, t = line:match("^([^.]-)%.([^.]-)=(.-)$")
if c then