diff options
author | Steven Barth <steven@midlink.org> | 2008-04-01 21:36:09 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-04-01 21:36:09 +0000 |
commit | 799de8987c5c70ce70429700014fd3768b41f3a0 (patch) | |
tree | bed0f49b4ece72390306d1d8156c5973449f1242 /src/ffluci/model | |
parent | 9e5ab8f3396e7c765d99a8aec9e42c201ada48c4 (diff) |
* Added backend for firewall / portforwarding
Diffstat (limited to 'src/ffluci/model')
-rw-r--r-- | src/ffluci/model/cbi/admin_network/firewall.lua | 46 | ||||
-rw-r--r-- | src/ffluci/model/cbi/admin_network/portfw.lua | 10 |
2 files changed, 47 insertions, 9 deletions
diff --git a/src/ffluci/model/cbi/admin_network/firewall.lua b/src/ffluci/model/cbi/admin_network/firewall.lua index fc7bea61bc..a30bac7106 100644 --- a/src/ffluci/model/cbi/admin_network/firewall.lua +++ b/src/ffluci/model/cbi/admin_network/firewall.lua @@ -13,12 +13,34 @@ 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 + +proto = s:option(ListValue, "proto", "Protokoll") +proto.optional = true +proto:value("") +proto:value("tcp", "TCP") +proto:value("udp", "UDP") + 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 + +sport = s:option(Value, "sport", "Quellport") +sport.optional = true +sport:depends("proto", "tcp") +sport:depends("proto", "udp") + +dport = s:option(Value, "dport", "Zielport") +dport.optional = true +dport:depends("proto", "tcp") +dport:depends("proto", "udp") + +tosrc = s:option(Value, "tosrc", "Neue Quelladresse [SNAT]") +tosrc.optional = true +tosrc:depends("jump", "SNAT") + +tosrc = s:option(Value, "todest", "Neue Zieladresse [DNAT]") +tosrc.optional = true +tosrc:depends("jump", "DNAT") + state = s:option(MultiValue, "state", "Status") state.optional = true @@ -28,10 +50,20 @@ 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 +jump = s:option(ListValue, "jump", "Aktion") +jump.rmempty = true +jump:value("", "") +jump:value("ACCEPT", "annehmen (ACCEPT)") +jump:value("REJECT", "zurückweisen (REJECT)") +jump:value("DROP", "verwerfen (DROP)") +jump:value("LOG", "protokollieren (LOG)") +jump:value("DNAT", "Ziel umschreiben (DNAT) [nur Prerouting]") +jump:value("MASQUERADE", "maskieren (MASQUERADE) [nur Postrouting]") +jump:value("SNAT", "Quelle umschreiben (SNAT) [nur Postrouting]") -add = s:option(Value, "command", "Befehl") +add = s:option(Value, "command", "Eigener Befehl") add.size = 50 +add.rmempty = true -return m
\ No newline at end of file +return m diff --git a/src/ffluci/model/cbi/admin_network/portfw.lua b/src/ffluci/model/cbi/admin_network/portfw.lua index 6f8822a89a..70a174907f 100644 --- a/src/ffluci/model/cbi/admin_network/portfw.lua +++ b/src/ffluci/model/cbi/admin_network/portfw.lua @@ -1,18 +1,24 @@ -- ToDo: Translate, Add descriptions and help texts +require("ffluci.sys") m = Map("luci_fw", "Portweiterleitung") s = m:section(TypedSection, "portfw") s.addremove = true s.anonymous = true -iface = s:option(Value, "in_interface", "Externes Interface") +iface = s:option(ListValue, "iface", "Externes Interface") +iface:value("") +for k,v in pairs(ffluci.sys.net.devices()) do + iface:value(v) +end proto = s:option(ListValue, "proto", "Protokoll") proto:value("tcp", "TCP") proto:value("udp", "UDP") +proto:value("tcpudp", "TCP+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 +return m |