summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-fw
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-07-16 10:08:28 +0000
committerSteven Barth <steven@midlink.org>2008-07-16 10:08:28 +0000
commit429473aed896a8f038d8934c8711a29366a894c5 (patch)
tree958d0b7459f644ee5ffd996acc7f14528292749f /applications/luci-fw
parent9b1ef9e2b1a9e318a2840ee4b846f7ca8d82d3bb (diff)
applications/luci-fw: Added support for luci-mini
modules/admin-mini: Added portforwarding page, and UCI changes, apply and revert pages
Diffstat (limited to 'applications/luci-fw')
-rw-r--r--applications/luci-fw/luasrc/controller/luci_fw/luci_fw.lua12
-rw-r--r--applications/luci-fw/luasrc/i18n/luci-fw.de.lua4
-rw-r--r--applications/luci-fw/luasrc/i18n/luci-fw.en.lua4
-rw-r--r--applications/luci-fw/luasrc/model/cbi/luci_fw/miniportfw.lua37
-rwxr-xr-xapplications/luci-fw/root/etc/init.d/luci_fw2
5 files changed, 52 insertions, 7 deletions
diff --git a/applications/luci-fw/luasrc/controller/luci_fw/luci_fw.lua b/applications/luci-fw/luasrc/controller/luci_fw/luci_fw.lua
index 4efddb6e7..b8c104601 100644
--- a/applications/luci-fw/luasrc/controller/luci_fw/luci_fw.lua
+++ b/applications/luci-fw/luasrc/controller/luci_fw/luci_fw.lua
@@ -4,7 +4,13 @@ function index()
require("luci.i18n").loadc("luci-fw")
local i18n = luci.i18n.translate
- entry({"admin", "network", "portfw"}, cbi("luci_fw/portfw"), i18n("fw_portfw", "Portweiterleitung"), 70).i18n = "luci-fw"
- entry({"admin", "network", "routing"}, cbi("luci_fw/routing"), i18n("fw_routing", "Routing"), 73).i18n = "luci-fw"
- entry({"admin", "network", "firewall"}, cbi("luci_fw/firewall"), i18n("fw_fw", "Firewall"), 76).i18n = "luci-fw"
+ if registered("admin") then
+ entry({"admin", "network", "portfw"}, cbi("luci_fw/portfw"), i18n("fw_portfw", "Portweiterleitung"), 70).i18n = "luci-fw"
+ entry({"admin", "network", "routing"}, cbi("luci_fw/routing"), i18n("fw_routing", "Routing"), 73).i18n = "luci-fw"
+ entry({"admin", "network", "firewall"}, cbi("luci_fw/firewall"), i18n("fw_fw", "Firewall"), 76).i18n = "luci-fw"
+ end
+
+ if registered("mini") then
+ entry({"mini", "network", "portfw"}, cbi("luci_fw/miniportfw"), i18n("fw_portfw", "Portweiterleitung"), 70).i18n = "luci-fw"
+ end
end \ No newline at end of file
diff --git a/applications/luci-fw/luasrc/i18n/luci-fw.de.lua b/applications/luci-fw/luasrc/i18n/luci-fw.de.lua
index ae336da9f..d7adf3600 100644
--- a/applications/luci-fw/luasrc/i18n/luci-fw.de.lua
+++ b/applications/luci-fw/luasrc/i18n/luci-fw.de.lua
@@ -27,9 +27,9 @@ fw_portfw1 = [[Portweiterleitungen ermöglichen es interne
Netzwerkdienste von einem anderen externen Netzwerk aus erreichbar zu machen.]]
lucifw_portfw_iface_desc = "Externe Schnittstelle"
lucifw_portfw_dport = "Externer Port"
-lucifw_portfw_dport_desc = "Port[:Endport]"
+lucifw_portfw_dport_desc = "Einzelner Port oder Erster Port-Letzter Port"
lucifw_portfw_to = "Interne Adresse"
-lucifw_portfw_to_desc = "IP-Adresse[:Zielport[-Zielendport]]"
+lucifw_portfw_to_desc = "IP, IP:Port oder IP:Erster Port-Letzter Port"
fw_routing1 = [[An dieser Stelle wird festlegt, welcher Netzverkehr zwischen einzelnen
Schnittstellen erlaubt werden soll. Es werden jeweils nur neue Verbindungen
diff --git a/applications/luci-fw/luasrc/i18n/luci-fw.en.lua b/applications/luci-fw/luasrc/i18n/luci-fw.en.lua
index b822c8171..7d3a3a032 100644
--- a/applications/luci-fw/luasrc/i18n/luci-fw.en.lua
+++ b/applications/luci-fw/luasrc/i18n/luci-fw.en.lua
@@ -26,9 +26,9 @@ fw_portfw1 = [[Port forwarding allows to provide network services
in the internal network to an external network.]]
lucifw_portfw_iface_desc = "External interface"
lucifw_portfw_dport = "External port"
-lucifw_portfw_dport_desc = "Port[:last port]"
+lucifw_portfw_dport_desc = "single port or first port-last port"
lucifw_portfw_to = "Internal address"
-lucifw_portfw_to_desc = "IP-address[:target port[-last port]]"
+lucifw_portfw_to_desc = "IP, IP:port or IP:first port-last port"
fw_routing1 = [[Here you can specify which network traffic is allowed to flow between network interfaces.
Only new connections will be matched. Packets belonging to already open connections are automatically allowed
diff --git a/applications/luci-fw/luasrc/model/cbi/luci_fw/miniportfw.lua b/applications/luci-fw/luasrc/model/cbi/luci_fw/miniportfw.lua
new file mode 100644
index 000000000..39eefa659
--- /dev/null
+++ b/applications/luci-fw/luasrc/model/cbi/luci_fw/miniportfw.lua
@@ -0,0 +1,37 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
+require("luci.sys")
+m = Map("luci_fw", translate("fw_portfw"), translate("fw_portfw1"))
+
+
+s = m:section(TypedSection, "portfw", "")
+s:depends("iface", "wan")
+s.defaults.iface = "wan"
+
+s.template = "cbi/tblsection"
+s.addremove = true
+s.anonymous = true
+
+name = s:option(Value, "_name", translate("name") .. translate("cbi_optional"))
+
+proto = s:option(ListValue, "proto", translate("protocol"))
+proto:value("tcp", "TCP")
+proto:value("udp", "UDP")
+proto:value("tcpudp", "TCP + UDP")
+
+dport = s:option(Value, "dport")
+
+to = s:option(Value, "to")
+
+return m
diff --git a/applications/luci-fw/root/etc/init.d/luci_fw b/applications/luci-fw/root/etc/init.d/luci_fw
index 5f09b5277..86d8a56a3 100755
--- a/applications/luci-fw/root/etc/init.d/luci_fw
+++ b/applications/luci-fw/root/etc/init.d/luci_fw
@@ -15,6 +15,8 @@ apply_portfw() {
[ -n "$ifname" ] || return 0
[ -n "$to" ] || return 0
+ dport=$(echo $dport | sed -e 's/-/:/')
+
ports=$(echo $to | cut -sd: -f2)
if [ -n "$ports" ]; then
ports="--dport $(echo $ports | sed -e 's/-/:/')"