* Fixed Freifunk wizard
authorSteven Barth <steven@midlink.org>
Sun, 27 Apr 2008 22:26:05 +0000 (22:26 +0000)
committerSteven Barth <steven@midlink.org>
Sun, 27 Apr 2008 22:26:05 +0000 (22:26 +0000)
contrib/package/ffluci-splash/src/luci-splash.lua
module/admin-core/src/controller/admin/index.lua

index 0699d28..72a801c 100644 (file)
@@ -7,7 +7,7 @@ require("ffluci.sys")
 require("ffluci.model.uci")
 
 -- Init state session
-uci = ffluci.model.uci.Session("/var/state")
+uci = ffluci.model.uci.StateSession()
 
 
 function main(argv)
index e6b39f8..8bd04dd 100644 (file)
@@ -55,6 +55,23 @@ function configure_freifunk()
                uci:set("network", "ffdhcp", "ipaddr", dhcpip)
                uci:set("network", "ffdhcp", "netmask", uci:get("freifunk", "community", "dhcpmask"))
                
+               local dhcp = uci:show("dhcp")
+               if dhcp then
+                       for k, v in pairs(dhcp.dhcp) do
+                               if v[".type"] == "dhcp" and v.interface == "ffdhcp" then
+                                       uci:del("dhcp", k)
+                               end
+                       end             
+                       
+                       local dhcpbeg = 48 + tonumber(ip:match("[0-9]+$")) * 4
+                       
+                       local sk = uci:add("dhcp", "dhcp")
+                       uci:set("dhcp", sk, "interface", "ffdhcp")
+                       uci:set("dhcp", sk, "start", dhcpbeg)
+                       uci:set("dhcp", sk, "limit", (dhcpbeg < 252) and 3 or 2)
+                       uci:set("dhcp", sk, "leasetime", "30m")
+               end 
+               
                local splash = uci:show("luci_splash")
                if splash then
                        for k, v in pairs(splash.luci_splash) do