1
0
Fork 0
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:
Ycarus 2018-03-15 15:27:42 +01:00
parent 7ba8d8d610
commit 139393bc8f
65 changed files with 7053 additions and 5523 deletions

View file

@ -270,7 +270,6 @@ function iface_status(ifaces)
type = device:type(),
ifname = device:name(),
macaddr = device:mac(),
macaddr = device:mac(),
is_up = device:is_up(),
rx_bytes = device:rx_bytes(),
tx_bytes = device:tx_bytes(),

View file

@ -139,14 +139,12 @@ function action_connections()
end
function action_nameinfo(...)
local i
local rv = { }
for i = 1, select('#', ...) do
local addr = select(i, ...)
local fqdn = nixio.getnameinfo(addr)
rv[addr] = fqdn or (addr:match(":") and "[%s]" % addr or addr)
end
local util = require "luci.util"
luci.http.prepare_content("application/json")
luci.http.write_json(rv)
luci.http.write_json(util.ubus("network.rrdns", "lookup", {
addrs = { ... },
timeout = 5000,
limit = 1000
}) or { })
end

View file

@ -2,6 +2,7 @@
-- Licensed to the public under the Apache License 2.0.
local ipc = require "luci.ip"
local sys = require "luci.sys"
local o
require "luci.util"
@ -68,9 +69,10 @@ se = s:taboption("advanced", Flag, "sequential_ip",
translate("Allocate IP addresses sequentially, starting from the lowest available address"))
se.optional = true
s:taboption("advanced", Flag, "boguspriv",
bp = s:taboption("advanced", Flag, "boguspriv",
translate("Filter private"),
translate("Do not forward reverse lookups for local networks"))
bp.default = bp.enabled
s:taboption("advanced", Flag, "filterwin2k",
translate("Filter useless"),
@ -310,10 +312,10 @@ end
hostid = s:option(Value, "hostid", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Suffix (hex)"))
ipc.neighbors({ family = 4 }, function(n)
if n.mac and n.dest then
ip:value(n.dest:string())
mac:value(n.mac, "%s (%s)" %{ n.mac, n.dest:string() })
sys.net.host_hints(function(m, v4, v6, name)
if m and v4 then
ip:value(v4)
mac:value(m, "%s (%s)" %{ m, name or v4 })
end
end)

View file

@ -3,6 +3,7 @@
-- Licensed to the public under the Apache License 2.0.
local ipc = require "luci.ip"
local sys = require "luci.sys"
m = Map("dhcp", translate("Hostnames"))
@ -19,9 +20,11 @@ ip = s:option(Value, "ip", translate("IP address"))
ip.datatype = "ipaddr"
ip.rmempty = true
ipc.neighbors({ }, function(n)
if n.mac and n.dest and not n.dest:is6linklocal() then
ip:value(n.dest:string(), "%s (%s)" %{ n.dest:string(), n.mac })
sys.net.host_hints(function(mac, v4, v6, name)
v6 = v6 and ipc.IPv6(v6)
if v4 or (v6 and not v6:is6linklocal()) then
ip:value(tostring(v4 or v6), "%s (%s)" %{ tostring(v4 or v6), name or mac })
end
end)

View file

@ -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

View file

@ -0,0 +1,548 @@
-- Copyright 2008 Steven Barth <steven@midlink.org>
-- Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
local fs = require "nixio.fs"
local ut = require "luci.util"
local pt = require "luci.tools.proto"
local nw = require "luci.model.network"
local fw = require "luci.model.firewall"
arg[1] = arg[1] or ""
local has_dnsmasq = fs.access("/etc/config/dhcp")
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")
end
nw.init(m.uci)
fw.init(m.uci)
local net = nw:get_network(arg[1])
local function backup_ifnames(is_bridge)
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
local wif = ifn:get_wifinet()
ifns[#ifns+1] = wif and wif:id() or ifn:name()
end
if #ifns > 0 then
set_ifstate(net:name(), "ifname", table.concat(ifns, " "))
set_ifstate(net:name(), "bridge", tostring(net:is_bridge()))
end
end
end
end
-- redirect to overview page if network does not exist anymore (e.g. after a revert)
if not net then
luci.http.redirect(luci.dispatcher.build_url("admin/network/network"))
return
end
-- protocol switch was requested, rebuild interface config and reload page
if m:formvalue("cbid.network.%s._switch" % net:name()) then
-- get new protocol
local ptype = m:formvalue("cbid.network.%s.proto" % net:name()) or "-"
local proto = nw:get_protocol(ptype, net:name())
if proto then
-- backup default
backup_ifnames()
-- if current proto is not floating and target proto is not floating,
-- then attempt to retain the ifnames
--error(net:proto() .. " > " .. proto:proto())
if not net:is_floating() and not proto:is_floating() then
-- if old proto is a bridge and new proto not, then clip the
-- interface list to the first ifname only
if net:is_bridge() and proto:is_virtual() then
local _, ifn
local first = true
for _, ifn in ipairs(net:get_interfaces() or { net:get_interface() }) do
if first then
first = false
else
net:del_interface(ifn)
end
end
m:del(net:name(), "type")
end
-- if the current proto is floating, the target proto not floating,
-- then attempt to restore ifnames from backup
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 = (get_ifstate(net:name(), "bridge") == "true")
local ifn
local ifns = { }
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)
if not br then
break
end
end
end
if br then
m:set(net:name(), "type", "bridge")
end
-- in all other cases clear the ifnames
else
local _, ifc
for _, ifc in ipairs(net:get_interfaces() or { net:get_interface() }) do
net:del_interface(ifc)
end
m:del(net:name(), "type")
end
-- clear options
local k, v
for k, v in pairs(m:get(net:name())) do
if k:sub(1,1) ~= "." and
k ~= "type" and
k ~= "ifname"
then
m:del(net:name(), k)
end
end
-- set proto
m:set(net:name(), "proto", proto:proto())
m.uci:save("network")
m.uci:save("wireless")
-- reload page
luci.http.redirect(luci.dispatcher.build_url("admin/network/network", arg[1]))
return
end
end
-- dhcp setup was requested, create section and reload page
if m:formvalue("cbid.dhcp._enable._enable") then
m.uci:section("dhcp", "dhcp", arg[1], {
interface = arg[1],
start = "100",
limit = "150",
leasetime = "12h"
})
m.uci:save("dhcp")
luci.http.redirect(luci.dispatcher.build_url("admin/network/network", arg[1]))
return
end
local ifc = net:get_interface()
s = m:section(NamedSection, arg[1], "interface", translate("Common Configuration"))
s.addremove = false
s:tab("general", translate("General Setup"))
s:tab("advanced", translate("Advanced Settings"))
s:tab("physical", translate("Physical Settings"))
if has_firewall then
s:tab("firewall", translate("Firewall Settings"))
end
st = s:taboption("general", DummyValue, "__status", translate("Status"))
local function set_status()
-- if current network is empty, print a warning
if not net:is_floating() and net:is_empty() then
st.template = "cbi/dvalue"
st.network = nil
st.value = translate("There is no device assigned yet, please attach a network device in the \"Physical Settings\" tab")
else
st.template = "admin_network/iface_status"
st.network = arg[1]
st.value = nil
end
end
m.on_init = set_status
m.on_after_save = set_status
l = s:taboption("general", Value, "label", translate("Label"))
l.rmempty = true
l:depends("multipath", "on")
l:depends("multipath", "master")
l:depends("multipath", "backup")
l:depends("multipath", "handover")
p = s:taboption("general", ListValue, "proto", translate("Protocol"))
p.default = net:proto()
if not net:is_installed() then
p_install = s:taboption("general", Button, "_install")
p_install.title = translate("Protocol support is not installed")
p_install.inputtitle = translate("Install package %q" % net:opkg_package())
p_install.inputstyle = "apply"
p_install:depends("proto", net:proto())
function p_install.write()
return luci.http.redirect(
luci.dispatcher.build_url("admin/system/packages") ..
"?submit=1&install=%s" % net:opkg_package()
)
end
end
p_switch = s:taboption("general", Button, "_switch")
p_switch.title = translate("Really switch protocol?")
p_switch.inputtitle = translate("Switch protocol")
p_switch.inputstyle = "apply"
local _, pr
for _, pr in ipairs(nw:get_protocols()) do
p:value(pr:proto(), pr:get_i18n())
if pr:proto() ~= net:proto() then
p_switch:depends("proto", pr:proto())
end
end
auto = s:taboption("advanced", Flag, "auto", translate("Bring up on boot"))
auto.default = (net:proto() == "none") and auto.disabled or auto.enabled
-- Add MPTCP
if fs.access("/proc/sys/net/mptcp") then
mptcp = s:taboption("advanced", ListValue, "multipath", translate("Multipath TCP"), translate("One interface must be set as master"))
mptcp:value("on", translate("enabled"))
mptcp:value("off", translate("disabled"))
mptcp:value("master", translate("master"))
mptcp:value("backup", translate("backup"))
mptcp:value("handover", translate("handover"))
mptcp.default = "off"
end
delegate = s:taboption("advanced", Flag, "delegate", translate("Use builtin IPv6-management"))
delegate.default = delegate.enabled
if not net:is_virtual() then
--br = s:taboption("physical", Flag, "type", translate("Bridge interfaces"), translate("creates a bridge over specified interface(s)"))
--br.enabled = "bridge"
--br.rmempty = true
--br:depends("proto", "static")
--br:depends("proto", "dhcp")
--br:depends("proto", "none")
iftype = s:taboption("physical", ListValue, "type", translate("Type of the interface"))
iftype:value("", translate("Default"))
iftype:value("macvlan", translate("Create a macvlan sub interface"))
iftype:value("bridge", translate("Create a bridge over multiple interfaces"))
iftype:depends("proto", "static")
iftype:depends("proto", "dhcp")
iftype:depends("proto", "none")
stp = s:taboption("physical", Flag, "stp", translate("Enable <abbr title=\"Spanning Tree Protocol\">STP</abbr>"),
translate("Enables the Spanning Tree Protocol on this bridge"))
stp:depends("type", "bridge")
stp.rmempty = true
-- macsource = s:taboption("physical", DynamicList, "vlanmacs", translate("Add MACs address to enable source mode"))
-- macsource:depends("type", "macvlan")
-- macsource.rmempty = true
end
macvlanmaster = s:taboption("physical", Value, "interface", translate("Master interface"))
macvlanmaster.default = "eth0"
macvlanmaster:depends("type", "macvlan")
if not net:is_floating() then
ifname_single = s:taboption("physical", Value, "ifname_single", translate("Interface"))
ifname_single.template = "cbi/network_ifacelist"
ifname_single.widget = "radio"
ifname_single.nobridges = true
ifname_single.rmempty = false
ifname_single.network = arg[1]
ifname_single:depends("type", "")
function ifname_single.cfgvalue(self, s)
-- let the template figure out the related ifaces through the network model
return nil
end
function ifname_single.write(self, s, val)
local i
local new_ifs = { }
local old_ifs = { }
for _, i in ipairs(net:get_interfaces() or { net:get_interface() }) do
old_ifs[#old_ifs+1] = i:name()
end
for i in ut.imatch(val) do
new_ifs[#new_ifs+1] = i
-- if this is not a bridge, only assign first interface
if self.option == "ifname_single" then
break
end
end
table.sort(old_ifs)
table.sort(new_ifs)
for i = 1, math.max(#old_ifs, #new_ifs) do
if old_ifs[i] ~= new_ifs[i] then
backup_ifnames()
for i = 1, #old_ifs do
net:del_interface(old_ifs[i])
end
for i = 1, #new_ifs do
net:add_interface(new_ifs[i])
end
break
end
end
end
end
if not net:is_virtual() then
ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface"))
ifname_multi.template = "cbi/network_ifacelist"
ifname_multi.nobridges = true
ifname_multi.rmempty = false
ifname_multi.network = arg[1]
ifname_multi.widget = "checkbox"
ifname_multi:depends("type", "bridge")
ifname_multi.cfgvalue = ifname_single.cfgvalue
ifname_multi.write = ifname_single.write
end
if has_firewall then
fwzone = s:taboption("firewall", Value, "_fwzone",
translate("Create / Assign firewall-zone"),
translate("Choose the firewall zone you want to assign to this interface. Select <em>unspecified</em> to remove the interface from the associated zone or fill out the <em>create</em> field to define a new zone and attach the interface to it."))
fwzone.template = "cbi/firewall_zonelist"
fwzone.network = arg[1]
fwzone.rmempty = false
function fwzone.cfgvalue(self, section)
self.iface = section
local z = fw:get_zone_by_network(section)
return z and z:name()
end
function fwzone.write(self, section, value)
local zone = fw:get_zone(value)
if not zone and value == '-' then
value = m:formvalue(self:cbid(section) .. ".newzone")
if value and #value > 0 then
zone = fw:add_zone(value)
else
fw:del_network(section)
end
end
if zone then
fw:del_network(section)
zone:add_network(section)
end
end
end
function p.write() end
function p.remove() end
function p.validate(self, value, section)
if value == net:proto() then
if not net:is_floating() and net:is_empty() then
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
return nil, translate("The selected protocol needs a device assigned")
end
end
return value
end
local form, ferr = loadfile(
ut.libpath() .. "/model/cbi/admin_network/proto_%s.lua" % net:proto()
)
if not form then
s:taboption("general", DummyValue, "_error",
translate("Missing protocol extension for proto %q" % net:proto())
).value = ferr
else
setfenv(form, getfenv(1))(m, s, net)
end
local _, field
for _, field in ipairs(s.children) do
if field ~= st and field ~= p and field ~= p_install and field ~= p_switch then
if next(field.deps) then
local _, dep
for _, dep in ipairs(field.deps) do
dep.proto = net:proto()
end
else
field:depends("proto", net:proto())
end
end
end
--
-- Display DNS settings if dnsmasq is available
--
if has_dnsmasq and net:proto() == "static" then
m2 = Map("dhcp", "", "")
local has_section = false
m2.uci:foreach("dhcp", "dhcp", function(s)
if s.interface == arg[1] then
has_section = true
return false
end
end)
if not has_section and has_dnsmasq then
s = m2:section(TypedSection, "dhcp", translate("DHCP Server"))
s.anonymous = true
s.cfgsections = function() return { "_enable" } end
x = s:option(Button, "_enable")
x.title = translate("No DHCP Server configured for this interface")
x.inputtitle = translate("Setup DHCP Server")
x.inputstyle = "apply"
elseif has_section then
s = m2:section(TypedSection, "dhcp", translate("DHCP Server"))
s.addremove = false
s.anonymous = true
s:tab("general", translate("General Setup"))
s:tab("advanced", translate("Advanced Settings"))
s:tab("ipv6", translate("IPv6 Settings"))
function s.filter(self, section)
return m2.uci:get("dhcp", section, "interface") == arg[1]
end
local ignore = s:taboption("general", Flag, "ignore",
translate("Ignore interface"),
translate("Disable <abbr title=\"Dynamic Host Configuration Protocol\">DHCP</abbr> for " ..
"this interface."))
local start = s:taboption("general", Value, "start", translate("Start"),
translate("Lowest leased address as offset from the network address."))
start.optional = true
start.datatype = "or(uinteger,ip4addr)"
start.default = "100"
local limit = s:taboption("general", Value, "limit", translate("Limit"),
translate("Maximum number of leased addresses."))
limit.optional = true
limit.datatype = "uinteger"
limit.default = "150"
local ltime = s:taboption("general", Value, "leasetime", translate("Lease time"),
translate("Expiry time of leased addresses, minimum is 2 minutes (<code>2m</code>)."))
ltime.rmempty = true
ltime.default = "12h"
local dd = s:taboption("advanced", Flag, "dynamicdhcp",
translate("Dynamic <abbr title=\"Dynamic Host Configuration Protocol\">DHCP</abbr>"),
translate("Dynamically allocate DHCP addresses for clients. If disabled, only " ..
"clients having static leases will be served."))
dd.default = dd.enabled
s:taboption("advanced", Flag, "force", translate("Force"),
translate("Force DHCP on this network even if another server is detected."))
-- XXX: is this actually useful?
--s:taboption("advanced", Value, "name", translate("Name"),
-- translate("Define a name for this network."))
mask = s:taboption("advanced", Value, "netmask",
translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"),
translate("Override the netmask sent to clients. Normally it is calculated " ..
"from the subnet that is served."))
mask.optional = true
mask.datatype = "ip4addr"
s:taboption("advanced", DynamicList, "dhcp_option", translate("DHCP-Options"),
translate("Define additional DHCP options, for example \"<code>6,192.168.2.1," ..
"192.168.2.2</code>\" which advertises different DNS servers to clients."))
for i, n in ipairs(s.children) do
if n ~= ignore then
n:depends("ignore", "")
end
end
o = s:taboption("ipv6", ListValue, "ra", translate("Router Advertisement-Service"))
o:value("", translate("disabled"))
o:value("server", translate("server mode"))
o:value("relay", translate("relay mode"))
o:value("hybrid", translate("hybrid mode"))
o = s:taboption("ipv6", ListValue, "dhcpv6", translate("DHCPv6-Service"))
o:value("", translate("disabled"))
o:value("server", translate("server mode"))
o:value("relay", translate("relay mode"))
o:value("hybrid", translate("hybrid mode"))
o = s:taboption("ipv6", ListValue, "ndp", translate("NDP-Proxy"))
o:value("", translate("disabled"))
o:value("relay", translate("relay mode"))
o:value("hybrid", translate("hybrid mode"))
o = s:taboption("ipv6", ListValue, "ra_management", translate("DHCPv6-Mode"),
translate("Default is stateless + stateful"))
o:value("0", translate("stateless"))
o:value("1", translate("stateless + stateful"))
o:value("2", translate("stateful-only"))
o:depends("dhcpv6", "server")
o:depends("dhcpv6", "hybrid")
o.default = "1"
o = s:taboption("ipv6", Flag, "ra_default", translate("Always announce default router"),
translate("Announce as default router even if no public prefix is available."))
o:depends("ra", "server")
o:depends("ra", "hybrid")
s:taboption("ipv6", DynamicList, "dns", translate("Announced DNS servers"))
s:taboption("ipv6", DynamicList, "domain", translate("Announced DNS domains"))
else
m2 = nil
end
end
return m, m2

View file

@ -3,6 +3,7 @@
-- Licensed to the public under the Apache License 2.0.
local fs = require "nixio.fs"
local json = require "luci.jsonc"
local sys = require "luci.sys"
m = Map("network", translate("Interfaces"))
@ -10,8 +11,14 @@ m.pageaction = false
m:section(SimpleSection).template = "admin_network/iface_overview"
if fs.access("/etc/init.d/dsl_control") then
dsl = m:section(TypedSection, "dsl", translate("DSL"))
local ok, boarddata = pcall(json.parse, fs.readfile("/etc/board.json"))
local modemtype = (ok == true)
and (type(boarddata) == "table")
and (type(boarddata.dsl) == "table")
and (type(boarddata.dsl.modem) == "table")
and boarddata.dsl.modem.type
dsl = m:section(TypedSection, "dsl", translate("DSL"))
dsl.anonymous = true
annex = dsl:option(ListValue, "annex", translate("Annex"))
@ -38,14 +45,23 @@ if fs.access("/etc/init.d/dsl_control") then
tone:value("b", translate("B43 + B43C"))
tone:value("bv", translate("B43 + B43C + V43"))
xfer_mode = dsl:option(ListValue, "xfer_mode", translate("Encapsulation mode"))
xfer_mode:value("atm", translate("ATM (Asynchronous Transfer Mode)"))
xfer_mode:value("ptm", translate("PTM/EFM (Packet Transfer Mode)"))
if modemtype == "vdsl" then
xfer_mode = dsl:option(ListValue, "xfer_mode", translate("Encapsulation mode"))
xfer_mode:value("", translate("auto"))
xfer_mode:value("atm", translate("ATM (Asynchronous Transfer Mode)"))
xfer_mode:value("ptm", translate("PTM/EFM (Packet Transfer Mode)"))
line_mode = dsl:option(ListValue, "line_mode", translate("DSL line mode"))
line_mode:value("", translate("auto"))
line_mode:value("adsl", translate("ADSL"))
line_mode:value("vdsl", translate("VDSL"))
line_mode = dsl:option(ListValue, "line_mode", translate("DSL line mode"))
line_mode:value("", translate("auto"))
line_mode:value("adsl", translate("ADSL"))
line_mode:value("vdsl", translate("VDSL"))
ds_snr = dsl:option(ListValue, "ds_snr_offset", translate("Downstream SNR offset"))
ds_snr.default = "0"
for i = -100, 100, 5 do
ds_snr:value(i, translatef("%.1f dB", i / 10))
end
end
firmware = dsl:option(Value, "firmware", translate("Firmware File"))

View file

@ -228,7 +228,7 @@ if hwtype == "mac80211" then
s:taboption("advanced", Value, "country", translate("Country Code"), translate("Use ISO/IEC 3166 alpha2 country codes."))
end
legacyrates = s:taboption("advanced", Flag, "legacy_rates", translate("802.11b rates"))
legacyrates = s:taboption("advanced", Flag, "legacy_rates", translate("Allow legacy 802.11b rates"))
legacyrates.rmempty = false
legacyrates.default = "1"
@ -252,64 +252,6 @@ if hwtype == "mac80211" then
end
------------------- Madwifi Device ------------------
if hwtype == "atheros" then
tp = s:taboption("general",
(#tx_power_list > 0) and ListValue or Value,
"txpower", translate("Transmit Power"), "dBm")
tp.rmempty = true
tp.default = tx_power_cur
function tp.cfgvalue(...)
return txpower_current(Value.cfgvalue(...), tx_power_list)
end
tp:value("", translate("auto"))
for _, p in ipairs(tx_power_list) do
tp:value(p.driver_dbm, "%i dBm (%i mW)"
%{ p.display_dbm, p.display_mw })
end
s:taboption("advanced", Flag, "diversity", translate("Diversity")).rmempty = false
if not nsantenna then
ant1 = s:taboption("advanced", ListValue, "txantenna", translate("Transmitter Antenna"))
ant1.widget = "radio"
ant1.orientation = "horizontal"
ant1:depends("diversity", "")
ant1:value("0", translate("auto"))
ant1:value("1", translate("Antenna 1"))
ant1:value("2", translate("Antenna 2"))
ant2 = s:taboption("advanced", ListValue, "rxantenna", translate("Receiver Antenna"))
ant2.widget = "radio"
ant2.orientation = "horizontal"
ant2:depends("diversity", "")
ant2:value("0", translate("auto"))
ant2:value("1", translate("Antenna 1"))
ant2:value("2", translate("Antenna 2"))
else -- NanoFoo
local ant = s:taboption("advanced", ListValue, "antenna", translate("Transmitter Antenna"))
ant:value("auto")
ant:value("vertical")
ant:value("horizontal")
ant:value("external")
end
s:taboption("advanced", Value, "distance", translate("Distance Optimization"),
translate("Distance to farthest network member in meters."))
s:taboption("advanced", Value, "regdomain", translate("Regulatory Domain"))
s:taboption("advanced", Value, "country", translate("Country Code"))
s:taboption("advanced", Flag, "outdoor", translate("Outdoor Channels"))
--s:option(Flag, "nosbeacon", translate("Disable HW-Beacon timer"))
end
------------------- Broadcom Device ------------------
if hwtype == "broadcom" then
@ -418,7 +360,7 @@ mode:value("adhoc", translate("Ad-Hoc"))
meshid = s:taboption("general", Value, "mesh_id", translate("Mesh Id"))
meshid:depends({mode="mesh"})
meshfwd = s:taboption("advanced", Flag, "mesh_fwding", translate("internal forwarding of Mesh-peers"))
meshfwd = s:taboption("advanced", Flag, "mesh_fwding", translate("Forward mesh peer traffic"))
meshfwd.rmempty = false
meshfwd.default = "1"
meshfwd:depends({mode="mesh"})
@ -539,102 +481,13 @@ if hwtype == "mac80211" then
wmm:depends({mode="ap-wds"})
wmm.default = wmm.enabled
ifname = s:taboption("advanced", Value, "ifname", translate("Interface name"), translate("Override default interface name"))
ifname.optional = true
end
-------------------- Madwifi Interface ----------------------
if hwtype == "atheros" then
mode:value("ahdemo", translate("Pseudo Ad-Hoc (ahdemo)"))
mode:value("monitor", translate("Monitor"))
mode:value("ap-wds", "%s (%s)" % {translate("Access Point"), translate("WDS")})
mode:value("sta-wds", "%s (%s)" % {translate("Client"), translate("WDS")})
mode:value("wds", translate("Static WDS"))
function mode.write(self, section, value)
if value == "ap-wds" then
ListValue.write(self, section, "ap")
m.uci:set("wireless", section, "wds", 1)
elseif value == "sta-wds" then
ListValue.write(self, section, "sta")
m.uci:set("wireless", section, "wds", 1)
else
ListValue.write(self, section, value)
m.uci:delete("wireless", section, "wds")
end
end
function mode.cfgvalue(self, section)
local mode = ListValue.cfgvalue(self, section)
local wds = m.uci:get("wireless", section, "wds") == "1"
if mode == "ap" and wds then
return "ap-wds"
elseif mode == "sta" and wds then
return "sta-wds"
else
return mode
end
end
bssid:depends({mode="adhoc"})
bssid:depends({mode="ahdemo"})
bssid:depends({mode="wds"})
wdssep = s:taboption("advanced", Flag, "wdssep", translate("Separate WDS"))
wdssep:depends({mode="ap-wds"})
s:taboption("advanced", Flag, "doth", "802.11h")
hidden = s:taboption("general", Flag, "hidden", translate("Hide <abbr title=\"Extended Service Set Identifier\">ESSID</abbr>"))
hidden:depends({mode="ap"})
hidden:depends({mode="adhoc"})
hidden:depends({mode="ap-wds"})
hidden:depends({mode="sta-wds"})
isolate = s:taboption("advanced", Flag, "isolate", translate("Separate Clients"),
isolate = s:taboption("advanced", Flag, "isolate", translate("Isolate Clients"),
translate("Prevents client-to-client communication"))
isolate:depends({mode="ap"})
s:taboption("advanced", Flag, "bgscan", translate("Background Scan"))
isolate:depends({mode="ap-wds"})
mp = s:taboption("macfilter", ListValue, "macpolicy", translate("MAC-Address Filter"))
mp:value("", translate("disable"))
mp:value("allow", translate("Allow listed only"))
mp:value("deny", translate("Allow all except listed"))
ml = s:taboption("macfilter", DynamicList, "maclist", translate("MAC-List"))
ml.datatype = "macaddr"
ml:depends({macpolicy="allow"})
ml:depends({macpolicy="deny"})
nt.mac_hints(function(mac, name) ml:value(mac, "%s (%s)" %{ mac, name }) end)
s:taboption("advanced", Value, "rate", translate("Transmission Rate"))
s:taboption("advanced", Value, "mcast_rate", translate("Multicast Rate"))
s:taboption("advanced", Value, "frag", translate("Fragmentation Threshold"))
s:taboption("advanced", Value, "rts", translate("RTS/CTS Threshold"))
s:taboption("advanced", Value, "minrate", translate("Minimum Rate"))
s:taboption("advanced", Value, "maxrate", translate("Maximum Rate"))
s:taboption("advanced", Flag, "compression", translate("Compression"))
s:taboption("advanced", Flag, "bursting", translate("Frame Bursting"))
s:taboption("advanced", Flag, "turbo", translate("Turbo Mode"))
s:taboption("advanced", Flag, "ff", translate("Fast Frames"))
s:taboption("advanced", Flag, "wmm", translate("WMM Mode"))
s:taboption("advanced", Flag, "xr", translate("XR Support"))
s:taboption("advanced", Flag, "ar", translate("AR Support"))
local swm = s:taboption("advanced", Flag, "sw_merge", translate("Disable HW-Beacon timer"))
swm:depends({mode="adhoc"})
local nos = s:taboption("advanced", Flag, "nosbeacon", translate("Disable HW-Beacon timer"))
nos:depends({mode="sta"})
nos:depends({mode="sta-wds"})
local probereq = s:taboption("advanced", Flag, "probereq", translate("Do not send probe responses"))
probereq.enabled = "0"
probereq.disabled = "1"
ifname = s:taboption("advanced", Value, "ifname", translate("Interface name"), translate("Override default interface name"))
ifname.optional = true
end
@ -758,7 +611,7 @@ encr:value("none", "No Encryption")
encr:value("wep-open", translate("WEP Open System"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"}, {mode="ahdemo"}, {mode="wds"})
encr:value("wep-shared", translate("WEP Shared Key"), {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"}, {mode="ahdemo"}, {mode="wds"})
if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
if hwtype == "mac80211" or hwtype == "prism2" then
local supplicant = fs.access("/usr/sbin/wpa_supplicant")
local hostapd = fs.access("/usr/sbin/hostapd")
@ -767,9 +620,9 @@ if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
local has_sta_eap = (os.execute("wpa_supplicant -veap >/dev/null 2>/dev/null") == 0)
if hostapd and supplicant then
encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
if has_ap_eap and has_sta_eap then
encr:value("wpa", "WPA-EAP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
@ -787,9 +640,9 @@ if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
"and ad-hoc mode) to be installed."
)
elseif not hostapd and supplicant then
encr:value("psk", "WPA-PSK", {mode="sta"}, {mode="sta-wds"})
encr:value("psk2", "WPA2-PSK", {mode="sta"}, {mode="sta-wds"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"}, {mode="sta-wds"})
encr:value("psk", "WPA-PSK", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
encr:value("psk2", "WPA2-PSK", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
if has_sta_eap then
encr:value("wpa", "WPA-EAP", {mode="sta"}, {mode="sta-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="sta"}, {mode="sta-wds"})
@ -919,7 +772,7 @@ for slot=1,4 do
end
if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
if hwtype == "mac80211" or hwtype == "prism2" then
-- Probe 802.11r support (and EAP support as a proxy for Openwrt)
local has_80211r = (os.execute("hostapd -v11r 2>/dev/null || hostapd -veap 2>/dev/null") == 0)
@ -936,6 +789,9 @@ if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
ieee80211r:depends({mode="ap", encryption="psk"})
ieee80211r:depends({mode="ap", encryption="psk2"})
ieee80211r:depends({mode="ap", encryption="psk-mixed"})
ieee80211r:depends({mode="ap-wds", encryption="psk"})
ieee80211r:depends({mode="ap-wds", encryption="psk2"})
ieee80211r:depends({mode="ap-wds", encryption="psk-mixed"})
end
ieee80211r.rmempty = true
@ -1175,8 +1031,8 @@ if hwtype == "mac80211" then
ieee80211w:depends({mode="ap-wds", encryption="psk-mixed"})
max_timeout = s:taboption("encryption", Value, "ieee80211w_max_timeout",
translate("802.11w maximum timeout"),
translate("802.11w Association SA Query maximum timeout"))
translate("802.11w maximum timeout"),
translate("802.11w Association SA Query maximum timeout"))
max_timeout:depends({ieee80211w="1"})
max_timeout:depends({ieee80211w="2"})
max_timeout.datatype = "uinteger"
@ -1184,8 +1040,8 @@ if hwtype == "mac80211" then
max_timeout.rmempty = true
retry_timeout = s:taboption("encryption", Value, "ieee80211w_retry_timeout",
translate("802.11w retry timeout"),
translate("802.11w Association SA Query retry timeout"))
translate("802.11w retry timeout"),
translate("802.11w Association SA Query retry timeout"))
retry_timeout:depends({ieee80211w="1"})
retry_timeout:depends({ieee80211w="2"})
retry_timeout.datatype = "uinteger"
@ -1205,7 +1061,7 @@ if hwtype == "mac80211" then
key_retries:depends({mode="ap-wds", encryption="psk-mixed"})
end
if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
if hwtype == "mac80211" or hwtype == "prism2" then
local wpasupplicant = fs.access("/usr/sbin/wpa_supplicant")
local hostcli = fs.access("/usr/sbin/hostapd_cli")
if hostcli and wpasupplicant then

View file

@ -1,27 +0,0 @@
-- Copyright 2008 Steven Barth <steven@midlink.org>
-- Licensed to the public under the Apache License 2.0.
m = Map("system", translate("Buttons"),
translate("This page allows the configuration of custom button actions"))
s = m:section(TypedSection, "button", "")
s.anonymous = true
s.addremove = true
s:option(Value, "button", translate("Name"))
act = s:option(ListValue, "action",
translate("Action"),
translate("Specifies the button state to handle"))
act:value("released")
s:option(Value, "handler",
translate("Handler"),
translate("Path to executable which handles the button event"))
min = s:option(Value, "min", translate("Minimum hold time"))
min.rmempty = true
max = s:option(Value, "max", translate("Maximum hold time"))
max.rmempty = true

View file

@ -62,7 +62,7 @@ o = s:option(Flag, "auto_mount", translate("Automount Filesystem"), translate("A
o.default = o.enabled
o.rmempty = false
o = s:option(Flag, "check_fs", translate("Check fileystems before mount"), translate("Automatically check filesystem for errors before mounting"))
o = s:option(Flag, "check_fs", translate("Check filesystems before mount"), translate("Automatically check filesystem for errors before mounting"))
o.default = o.disabled
o.rmempty = false

View file

@ -152,4 +152,7 @@ for p in nixio.fs.glob("/sys/bus/usb/devices/*/usb[0-9]*-port[0-9]*") do
end
end
port_mask = s:option(Value, "port_mask", translate ("Switch Port Mask"))
port_mask:depends("trigger", "switch0")
return m

View file

@ -78,15 +78,16 @@
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
var host = hosts[duid2mac(st[1][i].duid)];
if (host)
tr.insertCell(-1).innerHTML = String.format(
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
((host.name && (host.ipv4 || host.ipv6))
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
);
if (!st[1][i].hostname)
tr.insertCell(-1).innerHTML =
(host && (host.name || host.ipv4 || host.ipv6))
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
: '?';
else
tr.insertCell(-1).innerHTML = st[1][i].hostname ? st[1][i].hostname : '?';
tr.insertCell(-1).innerHTML =
(host && host.name && st[1][i].hostname != host.name)
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(st[1][i].hostname, host.name)
: st[1][i].hostname;
tr.insertCell(-1).innerHTML = st[1][i].ip6addr;
tr.insertCell(-1).innerHTML = st[1][i].duid;

View file

@ -66,10 +66,6 @@
return name
-- madwifi
elseif name == "ath" or name == "wifi" then
return translatef("Atheros 802.11%s Wireless Controller", bands)
-- ralink
elseif name == "ra" then
return translatef("RaLink 802.11%s Wireless Controller", bands)

View file

@ -7,6 +7,6 @@
<%+header%>
<h2 name="content"><%:Kernel Log%></h2>
<div id="content_syslog">
<textarea readonly="readonly" wrap="off" rows="<%=dmesg:cmatch("\n")+2%>" id="syslog"><%=dmesg:pcdata()%></textarea>
<textarea style="font-size: 12px;" readonly="readonly" wrap="off" rows="<%=dmesg:cmatch("\n")+2%>" id="syslog"><%=dmesg:pcdata()%></textarea>
</div>
<%+footer%>

View file

@ -39,12 +39,11 @@
local wan6 = ntm:get_wan6net()
local conn_count = tonumber(
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count")) or 0
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
local conn_max = tonumber((
luci.sys.exec("sysctl net.nf_conntrack_max") or
luci.sys.exec("sysctl net.ipv4.netfilter.ip_conntrack_max") or
""):match("%d+")) or 4096
local conn_max = tonumber(luci.sys.exec(
"sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
):match("%d+")) or 4096
local rv = {
uptime = sysinfo.uptime or 0,
@ -420,15 +419,16 @@
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
var host = hosts[duid2mac(info.leases6[i].duid)];
if (host)
tr.insertCell(-1).innerHTML = String.format(
'<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis">%s</div>',
((host.name && (host.ipv4 || host.ipv6))
? '%h (%s)'.format(host.name, host.ipv4 || host.ipv6)
: '%h'.format(host.name || host.ipv4 || host.ipv6)).nobr()
);
if (!info.leases6[i].hostname)
tr.insertCell(-1).innerHTML =
(host && (host.name || host.ipv4 || host.ipv6))
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">? (%h)</div>'.format(host.name || host.ipv4 || host.ipv6)
: '?';
else
tr.insertCell(-1).innerHTML = info.leases6[i].hostname ? info.leases6[i].hostname : '?';
tr.insertCell(-1).innerHTML =
(host && host.name && info.leases6[i].hostname != host.name)
? '<div style="max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space: nowrap">%h (%h)</div>'.format(info.leases6[i].hostname, host.name)
: info.leases6[i].hostname;
tr.insertCell(-1).innerHTML = info.leases6[i].ip6addr;
tr.insertCell(-1).innerHTML = info.leases6[i].duid;

View file

@ -53,7 +53,7 @@
<tr class="cbi-section-table-row cbi-rowstyle-<%=(style and 1 or 2)%>">
<td class="cbi-value-field"><%=v.dest%></td>
<td class="cbi-value-field"><%=v.mac%></td>
<td class="cbi-value-field"><%=v.dev%></td>
<td class="cbi-value-field"><%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%></td>
</tr>
<%
style = not style

View file

@ -7,6 +7,6 @@
<%+header%>
<h2 name="content"><%:System Log%></h2>
<div id="content_syslog">
<textarea readonly="readonly" wrap="off" rows="<%=syslog:cmatch("\n")+2%>" id="syslog"><%=syslog:pcdata()%></textarea>
<textarea style="font-size: 12px;" readonly="readonly" wrap="off" rows="<%=syslog:cmatch("\n")+2%>" id="syslog"><%=syslog:pcdata()%></textarea>
</div>
<%+footer%>