AP configuration
[project/luci.git] / modules / niu / luasrc / model / cbi / niu / network / lan.lua
index b5d97d2..45f2381 100644 (file)
@@ -1,10 +1,12 @@
-local cursor = require "luci.model.uci".cursor()
+local uci = require "luci.model.uci"
+local cursor = uci.cursor()
 local d = Delegator()
 d.allow_finish = true
 d.allow_back = true
 d.allow_cancel = true
 
 d:add("lan1", load("niu/network/lan1"))
+d:set("warnip", {Template("niu/network/warn_ip_change")})
 
 function d.on_cancel()
        cursor:revert("network")
@@ -12,6 +14,13 @@ function d.on_cancel()
 end
 
 function d.on_done()
+       if uci.inst_state:get("network", "lan", "ipaddr") ~= cursor:get("network", "lan", "ipaddr") then
+               local cs = uci.cursor_state()
+               cs:set("network", "lan", "_ipchanged", "1")
+               cs:save("network")
+       end
+
+       cursor:set("network", "lan", "type", "bridge")
        cursor:commit("network")
        cursor:commit("dhcp")
 end