From 17b357af81fef5f946c1df6e8966dc4158d4bdbc Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sun, 27 Apr 2008 22:26:05 +0000 Subject: [PATCH] * Fixed Freifunk wizard --- .../package/ffluci-splash/src/luci-splash.lua | 2 +- .../admin-core/src/controller/admin/index.lua | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/contrib/package/ffluci-splash/src/luci-splash.lua b/contrib/package/ffluci-splash/src/luci-splash.lua index 0699d2820a..72a801cd30 100644 --- a/contrib/package/ffluci-splash/src/luci-splash.lua +++ b/contrib/package/ffluci-splash/src/luci-splash.lua @@ -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) diff --git a/module/admin-core/src/controller/admin/index.lua b/module/admin-core/src/controller/admin/index.lua index e6b39f8a06..8bd04dd804 100644 --- a/module/admin-core/src/controller/admin/index.lua +++ b/module/admin-core/src/controller/admin/index.lua @@ -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 -- 2.30.2