* Fixed haserl-lua Makefile
authorSteven Barth <steven@midlink.org>
Mon, 31 Mar 2008 22:24:32 +0000 (22:24 +0000)
committerSteven Barth <steven@midlink.org>
Mon, 31 Mar 2008 22:24:32 +0000 (22:24 +0000)
* Fixed a bug in CBI that occured when target UCI is empty
* Added frontend for port forwarding / firewall pages

contrib/ffluci.uci [deleted file]
contrib/package/ffluci/Makefile
contrib/package/ffluci/ipkg/conffiles
contrib/package/haserl-lua/Makefile
contrib/uci/luci [new file with mode: 0644]
contrib/uci/luci_fw [new file with mode: 0644]
src/ffluci/cbi.lua
src/ffluci/model/cbi/admin_network/firewall.lua [new file with mode: 0644]
src/ffluci/model/cbi/admin_network/portfw.lua [new file with mode: 0644]
src/ffluci/model/menu/00main.lua
src/ffluci/model/uci.lua

diff --git a/contrib/ffluci.uci b/contrib/ffluci.uci
deleted file mode 100644 (file)
index 640faf1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-config core main
-        option lang de
-        option mediaurlbase /ffluci/media
-        
-config core category_privileges
-               option public nobody:nogroup
-
-config public contact
-               option nickname
-               option name
-               option mail
-               option phone
-               option location
-               option geo
-               option note
-
-
-config event uci_oncommit
-        option network "/etc/init.d/network restart"
-        option wireless        "/etc/init.d/network restart"
-        option olsrd   "/etc/init.d/olsrd restart"
-        option dhcp            "/etc/init.d/dhcp restart"
\ No newline at end of file
index 3bf9eb5..753fe88 100644 (file)
@@ -44,7 +44,8 @@ define Package/ffluci/install
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/ffluci $(1)/www/cgi-bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/index.cgi $(1)/www/cgi-bin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/index.html $(1)/www
-       $(CP) $(PKG_BUILD_DIR)/contrib/ffluci.uci $(1)/etc/config/luci
+       $(CP) $(PKG_BUILD_DIR)/contrib/uci/luci $(1)/etc/config/luci
+       $(CP) $(PKG_BUILD_DIR)/contrib/uci/luci_fw $(1)/etc/config/luci_fw
        $(CP) -a ./ipkg/ffluci.postinst $(1)/CONTROL/postinst
        $(CP) -a ./ipkg/conffiles $(1)/CONTROL/conffiles
 endef
index 5258af4..098dbf9 100644 (file)
@@ -1 +1,2 @@
-/etc/config/luci
\ No newline at end of file
+/etc/config/luci
+/etc/config/luci_fw
\ No newline at end of file
index b214633..c531d33 100644 (file)
@@ -8,7 +8,7 @@
 
 include $(TOPDIR)/rules.mk
 
-PKG_NAME:=haserl-lua
+PKG_NAME:=haserl
 PKG_VERSION:=0.9.23
 PKG_RELEASE:=1
 
diff --git a/contrib/uci/luci b/contrib/uci/luci
new file mode 100644 (file)
index 0000000..640faf1
--- /dev/null
@@ -0,0 +1,22 @@
+config core main
+        option lang de
+        option mediaurlbase /ffluci/media
+        
+config core category_privileges
+               option public nobody:nogroup
+
+config public contact
+               option nickname
+               option name
+               option mail
+               option phone
+               option location
+               option geo
+               option note
+
+
+config event uci_oncommit
+        option network "/etc/init.d/network restart"
+        option wireless        "/etc/init.d/network restart"
+        option olsrd   "/etc/init.d/olsrd restart"
+        option dhcp            "/etc/init.d/dhcp restart"
\ No newline at end of file
diff --git a/contrib/uci/luci_fw b/contrib/uci/luci_fw
new file mode 100644 (file)
index 0000000..c7dec7f
--- /dev/null
@@ -0,0 +1,2 @@
+
\ No newline at end of file
index d894055..5bc4049 100644 (file)
@@ -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 (file)
index 0000000..fc7bea6
--- /dev/null
@@ -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 (file)
index 0000000..6f8822a
--- /dev/null
@@ -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
index 64fc364..966c422 100644 (file)
@@ -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")
index 94a385c..8286597 100644 (file)
@@ -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