mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Update luci-base and luci-mod-admin-full to latest version, disable nginx default script
This commit is contained in:
parent
7ba8d8d610
commit
139393bc8f
65 changed files with 7053 additions and 5523 deletions
|
@ -16,6 +16,7 @@ local has_firewall = fs.access("/etc/config/firewall")
|
|||
m = Map("network", translate("Interfaces") .. " - " .. arg[1]:upper(), translate("On this page you can configure the network interfaces. You can bridge several interfaces by ticking the \"bridge interfaces\" field and enter the names of several network interfaces separated by spaces. You can also use <abbr title=\"Virtual Local Area Network\">VLAN</abbr> notation <samp>INTERFACE.VLANNR</samp> (<abbr title=\"for example\">e.g.</abbr>: <samp>eth0.1</samp>)."))
|
||||
m.redirect = luci.dispatcher.build_url("admin", "network", "network")
|
||||
m:chain("wireless")
|
||||
m:chain("luci")
|
||||
|
||||
if has_firewall then
|
||||
m:chain("firewall")
|
||||
|
@ -27,18 +28,52 @@ fw.init(m.uci)
|
|||
|
||||
local net = nw:get_network(arg[1])
|
||||
|
||||
local function set_ifstate(name, option, value)
|
||||
local found = false
|
||||
|
||||
m.uci:foreach("luci", "ifstate", function (s)
|
||||
if s.interface == name then
|
||||
m.uci:set("luci", s[".name"], option, value)
|
||||
found = true
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
||||
if not found then
|
||||
local sid = m.uci:add("luci", "ifstate")
|
||||
m.uci:set("luci", sid, "interface", name)
|
||||
m.uci:set("luci", sid, option, value)
|
||||
end
|
||||
|
||||
m.uci:save("luci")
|
||||
end
|
||||
|
||||
local function get_ifstate(name, option)
|
||||
local val
|
||||
|
||||
m.uci:foreach("luci", "ifstate", function (s)
|
||||
if s.interface == name then
|
||||
val = m.uci:get("luci", s[".name"], option)
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
||||
return val
|
||||
end
|
||||
|
||||
local function backup_ifnames(is_bridge)
|
||||
if not net:is_floating() and not m:get(net:name(), "_orig_ifname") then
|
||||
if not net:is_floating() and not get_ifstate(net:name(), "ifname") then
|
||||
local ifcs = net:get_interfaces() or { net:get_interface() }
|
||||
if ifcs then
|
||||
local _, ifn
|
||||
local ifns = { }
|
||||
for _, ifn in ipairs(ifcs) do
|
||||
ifns[#ifns+1] = ifn:name()
|
||||
local wif = ifn:get_wifinet()
|
||||
ifns[#ifns+1] = wif and wif:id() or ifn:name()
|
||||
end
|
||||
if #ifns > 0 then
|
||||
m:set(net:name(), "_orig_ifname", table.concat(ifns, " "))
|
||||
m:set(net:name(), "_orig_bridge", tostring(net:is_bridge()))
|
||||
set_ifstate(net:name(), "ifname", table.concat(ifns, " "))
|
||||
set_ifstate(net:name(), "bridge", tostring(net:is_bridge()))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -84,10 +119,10 @@ if m:formvalue("cbid.network.%s._switch" % net:name()) then
|
|||
elseif net:is_floating() and not proto:is_floating() then
|
||||
-- if we have backup data, then re-add all orphaned interfaces
|
||||
-- from it and restore the bridge choice
|
||||
local br = (m:get(net:name(), "_orig_bridge") == "true")
|
||||
local br = (get_ifstate(net:name(), "bridge") == "true")
|
||||
local ifn
|
||||
local ifns = { }
|
||||
for ifn in ut.imatch(m:get(net:name(), "_orig_ifname")) do
|
||||
for ifn in ut.imatch(get_ifstate(net:name(), "ifname")) do
|
||||
ifn = nw:get_interface(ifn)
|
||||
if ifn and not ifn:get_network() then
|
||||
proto:add_interface(ifn)
|
||||
|
@ -114,9 +149,7 @@ if m:formvalue("cbid.network.%s._switch" % net:name()) then
|
|||
for k, v in pairs(m:get(net:name())) do
|
||||
if k:sub(1,1) ~= "." and
|
||||
k ~= "type" and
|
||||
k ~= "ifname" and
|
||||
k ~= "_orig_ifname" and
|
||||
k ~= "_orig_bridge"
|
||||
k ~= "ifname"
|
||||
then
|
||||
m:del(net:name(), k)
|
||||
end
|
||||
|
@ -160,6 +193,7 @@ if has_firewall then
|
|||
s:tab("firewall", translate("Firewall Settings"))
|
||||
end
|
||||
|
||||
|
||||
st = s:taboption("general", DummyValue, "__status", translate("Status"))
|
||||
|
||||
local function set_status()
|
||||
|
@ -236,6 +270,12 @@ end
|
|||
delegate = s:taboption("advanced", Flag, "delegate", translate("Use builtin IPv6-management"))
|
||||
delegate.default = delegate.enabled
|
||||
|
||||
force_link = s:taboption("advanced", Flag, "force_link",
|
||||
translate("Force link"),
|
||||
translate("Set interface properties regardless of the link carrier (If set, carrier sense events do not invoke hotplug handlers)."))
|
||||
|
||||
force_link.default = (net:proto() == "static") and force_link.enabled or force_link.disabled
|
||||
|
||||
|
||||
if not net:is_virtual() then
|
||||
--br = s:taboption("physical", Flag, "type", translate("Bridge interfaces"), translate("creates a bridge over specified interface(s)"))
|
||||
|
@ -363,6 +403,7 @@ if has_firewall then
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
function p.write() end
|
||||
function p.remove() end
|
||||
function p.validate(self, value, section)
|
||||
|
@ -371,6 +412,7 @@ function p.validate(self, value, section)
|
|||
local ifn = ((br and (br:formvalue(section) == "bridge"))
|
||||
and ifname_multi:formvalue(section)
|
||||
or ifname_single:formvalue(section))
|
||||
|
||||
for ifn in ut.imatch(ifn) do
|
||||
return value
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue