- if not m.uci:get("network", value) then
- -- avoid "value not defined in enum" because network is not known yet
- s.override_scheme = true
-
- m:chain("network")
- m.uci:set("network", value, "interface")
- Value.write(self, section, value)
- else
- if m.uci:get("network", value) == "interface" then
- Value.write(self, section, value)
+ local i = nw:get_interface(section)
+ if i then
+ if value == '-' then
+ value = m:formvalue(self:cbid(section) .. ".newnet")
+ if value and #value > 0 then
+ local n = nw:add_network(value, {type="bridge", proto="none"})
+ if n then n:add_interface(i) end
+ else
+ local n = i:get_network()
+ if n then n:del_interface(i) end
+ end
+ else
+ local n = nw:get_network(value)
+ if n then
+ n:type("bridge")
+ n:add_interface(i)
+ end