* 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 0699d2820a0fe9761395c0d1732c41b4717f5e35..72a801cd308a088d4752b0de15b9c07e643ff328 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 e6b39f8a060f2da37cd2d832eb54111e94ddd7c7..8bd04dd8045ab3a024e273e639f41098b21b901e 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