diff options
| author | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-18 13:58:22 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-18 13:58:22 +0000 |
| commit | 839dcdc01299869bc714990c19d8e244f18318b5 (patch) | |
| tree | fa375ce3c8a90ac71de0f443b806c97094bdb66a /modules | |
| parent | 31d76dbb64da3bcba3132d6246422ae50b376e5c (diff) | |
luci-0.11: merge outstanding trunk changes
Diffstat (limited to 'modules')
25 files changed, 220 insertions, 174 deletions
diff --git a/modules/admin-core/luasrc/controller/admin/servicectl.lua b/modules/admin-core/luasrc/controller/admin/servicectl.lua index 68a59364c2..753d2c77f1 100644 --- a/modules/admin-core/luasrc/controller/admin/servicectl.lua +++ b/modules/admin-core/luasrc/controller/admin/servicectl.lua @@ -30,15 +30,13 @@ function action_status() end end -function action_restart() +function action_restart(args) local uci = require "luci.model.uci".cursor() - local rqp = luci.dispatcher.context.requestpath - - if rqp[3] then + if args then local service local services = { } - for service in rqp[3]:gmatch("[%w_-]+") do + for service in args:gmatch("[%w_-]+") do services[#services+1] = service end diff --git a/modules/admin-core/luasrc/tools/status.lua b/modules/admin-core/luasrc/tools/status.lua index e5c517f238..3ececa8f13 100644 --- a/modules/admin-core/luasrc/tools/status.lua +++ b/modules/admin-core/luasrc/tools/status.lua @@ -153,35 +153,40 @@ function wifi_network(id) return { } end -function switch_status(dev) - local ports = { } - local swc = io.popen("swconfig dev %q show" % dev, "r") - if swc then - local l - repeat - l = swc:read("*l") - if l then - local port, up = l:match("port:(%d+) link:(%w+)") - if port then - local speed = l:match(" speed:(%d+)") - local duplex = l:match(" (%w+)-duplex") - local txflow = l:match(" (txflow)") - local rxflow = l:match(" (rxflow)") - local auto = l:match(" (auto)") - - ports[#ports+1] = { - port = tonumber(port) or 0, - speed = tonumber(speed) or 0, - link = (up == "up"), - duplex = (duplex == "full"), - rxflow = (not not rxflow), - txflow = (not not txflow), - auto = (not not auto) - } +function switch_status(devs) + local dev + local switches = { } + for dev in devs:gmatch("[^%s,]+") do + local ports = { } + local swc = io.popen("swconfig dev %q show" % dev, "r") + if swc then + local l + repeat + l = swc:read("*l") + if l then + local port, up = l:match("port:(%d+) link:(%w+)") + if port then + local speed = l:match(" speed:(%d+)") + local duplex = l:match(" (%w+)-duplex") + local txflow = l:match(" (txflow)") + local rxflow = l:match(" (rxflow)") + local auto = l:match(" (auto)") + + ports[#ports+1] = { + port = tonumber(port) or 0, + speed = tonumber(speed) or 0, + link = (up == "up"), + duplex = (duplex == "full"), + rxflow = (not not rxflow), + txflow = (not not txflow), + auto = (not not auto) + } + end end - end - until not l - swc:close() + until not l + swc:close() + end + switches[dev] = ports end - return ports + return switches end diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 85dc68fff0..f401ecd185 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -68,7 +68,7 @@ function index() page = entry({"admin", "network", "wireless_reconnect"}, call("wifi_reconnect"), nil) page.leaf = true - page = entry({"admin", "network", "wireless_shutdown"}, call("wifi_reconnect"), nil) + page = entry({"admin", "network", "wireless_shutdown"}, call("wifi_shutdown"), nil) page.leaf = true page = entry({"admin", "network", "wireless"}, arcombine(template("admin_network/wifi_overview"), cbi("admin_network/wifi")), _("Wifi"), 15) @@ -156,6 +156,12 @@ function index() page = entry({"admin", "network", "diag_traceroute"}, call("diag_traceroute"), nil) page.leaf = true + + page = entry({"admin", "network", "diag_ping6"}, call("diag_ping6"), nil) + page.leaf = true + + page = entry({"admin", "network", "diag_traceroute6"}, call("diag_traceroute6"), nil) + page.leaf = true -- end end @@ -235,13 +241,12 @@ function wifi_delete(network) luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless")) end -function iface_status() - local path = luci.dispatcher.context.requestpath +function iface_status(ifaces) local netm = require "luci.model.network".init() local rv = { } local iface - for iface in path[#path]:gmatch("[%w%.%-_]+") do + for iface in ifaces:gmatch("[%w%.%-_]+") do local net = netm:get_network(iface) local device = net and net:get_interface() if device then @@ -318,11 +323,8 @@ function iface_status() luci.http.status(404, "No such device") end -function iface_reconnect() - local path = luci.dispatcher.context.requestpath - local iface = path[#path] +function iface_reconnect(iface) local netmd = require "luci.model.network".init() - local net = netmd:get_network(iface) if net then luci.sys.call("env -i /sbin/ifup %q >/dev/null 2>/dev/null" % iface) @@ -333,11 +335,8 @@ function iface_reconnect() luci.http.status(404, "No such interface") end -function iface_shutdown() - local path = luci.dispatcher.context.requestpath - local iface = path[#path] +function iface_shutdown(iface) local netmd = require "luci.model.network".init() - local net = netmd:get_network(iface) if net then luci.sys.call("env -i /sbin/ifdown %q >/dev/null 2>/dev/null" % iface) @@ -348,11 +347,8 @@ function iface_shutdown() luci.http.status(404, "No such interface") end -function iface_delete() - local path = luci.dispatcher.context.requestpath - local iface = path[#path] +function iface_delete(iface) local netmd = require "luci.model.network".init() - local net = netmd:del_network(iface) if net then luci.sys.call("env -i /sbin/ifdown %q >/dev/null 2>/dev/null" % iface) @@ -365,13 +361,12 @@ function iface_delete() luci.http.status(404, "No such interface") end -function wifi_status() - local path = luci.dispatcher.context.requestpath +function wifi_status(devs) local s = require "luci.tools.status" local rv = { } local dev - for dev in path[#path]:gmatch("[%w%.%-]+") do + for dev in devs:gmatch("[%w%.%-]+") do rv[#rv+1] = s.wifi_network(dev) end @@ -384,23 +379,19 @@ function wifi_status() luci.http.status(404, "No such device") end -function wifi_reconnect() - local path = luci.dispatcher.context.requestpath - local mode = path[#path-1] - local wnet = path[#path] +local function wifi_reconnect_shutdown(shutdown, wnet) local netmd = require "luci.model.network".init() - local net = netmd:get_wifinet(wnet) local dev = net:get_device() if dev and net then luci.sys.call("env -i /sbin/wifi down >/dev/null 2>/dev/null") dev:set("disabled", nil) - net:set("disabled", (mode == "wireless_shutdown") and 1 or nil) + net:set("disabled", shutdown and 1 or nil) netmd:commit("wireless") luci.sys.call("env -i /sbin/wifi up >/dev/null 2>/dev/null") - luci.http.status(200, (mode == "wireless_shutdown") and "Shutdown" or "Reconnected") + luci.http.status(200, shutdown and "Shutdown" or "Reconnected") return end @@ -408,6 +399,14 @@ function wifi_reconnect() luci.http.status(404, "No such radio") end +function wifi_reconnect(wnet) + wifi_reconnect_shutdown(false, wnet) +end + +function wifi_shutdown(wnet) + wifi_reconnect_shutdown(true, wnet) +end + function lease_status() local s = require "luci.tools.status" @@ -419,18 +418,14 @@ function lease_status() luci.http.write(']') end -function switch_status() - local path = luci.dispatcher.context.requestpath +function switch_status(switches) local s = require "luci.tools.status" luci.http.prepare_content("application/json") - luci.http.write_json(s.switch_status(path[#path])) + luci.http.write_json(s.switch_status(switches)) end -function diag_command(cmd) - local path = luci.dispatcher.context.requestpath - local addr = path[#path] - +function diag_command(cmd, addr) if addr and addr:match("^[a-zA-Z0-9%-%.:_]+$") then luci.http.prepare_content("text/plain") @@ -452,14 +447,22 @@ function diag_command(cmd) luci.http.status(500, "Bad address") end -function diag_ping() - diag_command("ping -c 5 -W 1 %q 2>&1") +function diag_ping(addr) + diag_command("ping -c 5 -W 1 %q 2>&1", addr) +end + +function diag_traceroute(addr) + diag_command("traceroute -q 1 -w 1 -n %q 2>&1", addr) +end + +function diag_nslookup(addr) + diag_command("nslookup %q 2>&1", addr) end -function diag_traceroute() - diag_command("traceroute -q 1 -w 1 -n %q 2>&1") +function diag_ping6(addr) + diag_command("ping6 -c 5 %q 2>&1", addr) end -function diag_nslookup() - diag_command("nslookup %q 2>&1") +function diag_traceroute6(addr) + diag_command("traceroute6 -q 1 -w 2 -n %q 2>&1", addr) end diff --git a/modules/admin-full/luasrc/controller/admin/status.lua b/modules/admin-full/luasrc/controller/admin/status.lua index d7d301c542..a9e37c7995 100644 --- a/modules/admin-full/luasrc/controller/admin/status.lua +++ b/modules/admin-full/luasrc/controller/admin/status.lua @@ -71,10 +71,7 @@ function action_iptables() end end -function action_bandwidth() - local path = luci.dispatcher.context.requestpath - local iface = path[#path] - +function action_bandwidth(iface) luci.http.prepare_content("application/json") local bwc = io.popen("luci-bwc -i %q 2>/dev/null" % iface) @@ -92,10 +89,7 @@ function action_bandwidth() end end -function action_wireless() - local path = luci.dispatcher.context.requestpath - local iface = path[#path] - +function action_wireless(iface) luci.http.prepare_content("application/json") local bwc = io.popen("luci-bwc -r %q 2>/dev/null" % iface) diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua b/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua index c791a57d0f..b4fee8cf07 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/hosts.lua @@ -30,7 +30,8 @@ ip = s:option(Value, "ip", translate("IP address")) ip.datatype = "ipaddr" ip.rmempty = true -for i, dataset in ipairs(luci.sys.net.arptable()) do +local arptable = luci.sys.net.arptable() or {} +for i, dataset in ipairs(arptable) do ip:value( dataset["IP address"], "%s (%s)" %{ dataset["IP address"], dataset["HW address"] } diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua b/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua index 9dc3f2f636..0fa2696e8a 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua @@ -14,6 +14,8 @@ You may obtain a copy of the License at m = Map("network", translate("Switch"), translate("The network ports on this device can be combined to several <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s in which computers can communicate directly with each other. <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network.")) +local switches = { } + m.uci:foreach("network", "switch", function(x) local sid = x['.name'] @@ -199,11 +201,13 @@ m.uci:foreach("network", "switch", end - local vid = s:option(Value, has_vlan4k or "vlan", "VLAN ID") + local vid = s:option(Value, has_vlan4k or "vlan", "VLAN ID", "<div id='portstatus-%s'></div>" % switch_name) + local mx_vid = has_vlan4k and 4094 or (num_vlans - 1) vid.rmempty = false vid.forcewrite = true vid.vlan_used = { } + vid.datatype = "and(uinteger,range("..min_vid..","..mx_vid.."))" -- Validate user provided VLAN ID, make sure its within the bounds -- allowed by the switch. @@ -276,12 +280,13 @@ m.uci:foreach("network", "switch", port_opts[#port_opts+1] = po end - - -- Switch status template - s = m:section(SimpleSection) - s.template = "admin_network/switch_status" - s.switch = switch_name + switches[#switches+1] = switch_name end ) +-- Switch status template +s = m:section(SimpleSection) +s.template = "admin_network/switch_status" +s.switches = switches + return m diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index f645493a61..6c06b21b4a 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -208,6 +208,12 @@ if hwtype == "mac80211" then htmode:value("HT40-", translate("40MHz 2nd channel below")) htmode:value("HT40+", translate("40MHz 2nd channel above")) + noscan = s:taboption("advanced", Flag, "noscan", translate("Force 40MHz mode"), + translate("Always use 40MHz channels even if the secondary channel overlaps. Using this option does not comply with IEEE 802.11n-2009!")) + noscan:depends("htmode", "HT40+") + noscan:depends("htmode", "HT40-") + noscan.default = noscan.disabled + --htcapab = s:taboption("advanced", DynamicList, "ht_capab", translate("HT capabilities")) --htcapab:depends("hwmode", "11na") --htcapab:depends("hwmode", "11ng") diff --git a/modules/admin-full/luasrc/view/admin_network/diagnostics.htm b/modules/admin-full/luasrc/view/admin_network/diagnostics.htm index a991f9a48f..64666880da 100644 --- a/modules/admin-full/luasrc/view/admin_network/diagnostics.htm +++ b/modules/admin-full/luasrc/view/admin_network/diagnostics.htm @@ -14,18 +14,33 @@ $Id$ <%+header%> +<% +local fs = require "nixio.fs" +local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6") +local has_traceroute6 = fs.access("/usr/bin/traceroute6") +%> + <script type="text/javascript" src="<%=resource%>/cbi.js"></script> <script type="text/javascript">//<![CDATA[ var stxhr = new XHR(); - function update_status(field) + function update_status(field,proto) { var tool = field.name; var addr = field.value; + var protocol = "" var legend = document.getElementById('diag-rc-legend'); var output = document.getElementById('diag-rc-output'); + if (typeof proto != 'undefined') { + for(var i = 0; i < proto.length; i++) { + if(proto[i].checked) { + protocol = proto[i].value; + } + } + } + if (legend && output) { output.innerHTML = @@ -36,7 +51,7 @@ $Id$ legend.parentNode.style.display = 'block'; legend.style.display = 'inline'; - stxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/diag_' + tool + '/' + addr, null, + stxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/diag_' + tool + protocol + '/' + addr, null, function(x) { if (x.responseText) @@ -64,17 +79,29 @@ $Id$ <br /> - <div style="width:30%; float:left; text-align:center"> + <div style="width:30%; float:left"> <input style="width: 50%" type="text" value="openwrt.org" name="ping" /> - <input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping)" /> + <input type="button" value="<%:Ping%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.ping,this.form.proto)" /> + <% if has_ping6 then %> + <div style="width:100%; margin-top: 10px;"> + <input type="radio" name="proto" value="" checked="checked" /> <%:IPv4%> + <input type="radio" name="proto" value="6" /> <%:IPv6%> + </div> + <%end%> </div> - <div style="width:30%; float:left; text-align:center"> + <div style="width:33%; float:left"> <input style="width: 50%" type="text" value="openwrt.org" name="traceroute" /> - <input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute)" /> + <input type="button" value="<%:Traceroute%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.traceroute,this.form.trproto)" /> + <% if has_traceroute6 then %> + <div style="width:100%; margin-top: 10px;"> + <input type="radio" name="trproto" value="" checked="checked" /> <%:IPv4%> + <input type="radio" name="trproto" value="6" /> <%:IPv6%> + </div> + <%end%> </div> - <div style="width:30%; float:left; text-align:center"> + <div style="width:33%; float:left;"> <input style="width: 50%" type="text" value="openwrt.org" name="nslookup" /> <input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" /> </div> diff --git a/modules/admin-full/luasrc/view/admin_network/switch_status.htm b/modules/admin-full/luasrc/view/admin_network/switch_status.htm index 0b284833e7..b299575e2f 100644 --- a/modules/admin-full/luasrc/view/admin_network/switch_status.htm +++ b/modules/admin-full/luasrc/view/admin_network/switch_status.htm @@ -1,31 +1,28 @@ <script type="text/javascript">//<![CDATA[ - var tb; - var ths = document.getElementsByTagName('th'); - for (var i = 0; i < ths.length; i++) - if (ths[i].className = 'cbi-section-table-cell' && !ths[i].innerHTML) + var switches = [ '<%=table.concat(self.switches, "', '")%>' ]; + XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "switch_status")%>/' + switches.join(','), null, + function(x, st) { - ths[i].innerHTML = '<%:Port status:%>'; - tb = ths[i].parentNode; - break; - } - - if (tb) - { - XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "switch_status", self.switch)%>', null, - function(x, st) + for (var i = 0; i < switches.length; i++) { - if (st && st.length) + var ports = st[switches[i]]; + var th0 = document.getElementById('portstatus-' + switches[i]); + + if (th0 && ports && ports.length) { - for (var i = 0; i < st.length; i++) + if (!th0.innerHTML) + th0.innerHTML = '<%:Port status:%>'; + + for (var j = 0; j < ports.length; j++) { - var th = tb.childNodes[i+1]; + var th = th0.parentNode.parentNode.childNodes[j+1]; - if (st[i].link) + if (ports[j].link) { th.innerHTML = String.format( '<small><img src="<%=resource%>/icons/port_up.png" />' + '<br />%d<%:baseT%><br />%s</small>', - st[i].speed, st[i].duplex + ports[j].speed, ports[j].duplex ? '<%:full-duplex%>' : '<%:half-duplex%>' ); } @@ -39,6 +36,6 @@ } } } - ); - } + } + ); //]]></script> diff --git a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm index 1f59a1830d..ab5d7a2134 100644 --- a/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm +++ b/modules/admin-full/luasrc/view/admin_network/wifi_overview.htm @@ -9,8 +9,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ - -%> <%- @@ -124,6 +122,10 @@ $Id$ var is_reconnecting = false; + function nowrap(s) { + return s.replace(/ /g, ' '); + } + function wifi_shutdown(id, toggle) { var reconnect = (toggle.getAttribute('active') == 'false'); @@ -300,24 +302,24 @@ $Id$ icon, assoclist[j].signal, assoclist[j].noise ); - tr.insertCell(-1).innerHTML = String.format('%h', iw.ssid ? iw.ssid : '?'); + tr.insertCell(-1).innerHTML = nowrap(String.format('%h', iw.ssid ? iw.ssid : '?')); tr.insertCell(-1).innerHTML = assoclist[j].bssid; tr.insertCell(-1).innerHTML = arptable[assoclist[j].bssid] ? arptable[assoclist[j].bssid] : '?'; - tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[j].signal); - tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[j].noise); + tr.insertCell(-1).innerHTML = nowrap(String.format('%d <%:dBm%>', assoclist[j].signal)); + tr.insertCell(-1).innerHTML = nowrap(String.format('%d <%:dBm%>', assoclist[j].noise)); - tr.insertCell(-1).innerHTML = (assoclist[j].rx_mcs > -1) + tr.insertCell(-1).innerHTML = nowrap((assoclist[j].rx_mcs > -1) ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[j].rx_rate / 1000, assoclist[j].rx_mcs, assoclist[j].rx_40mhz ? 40 : 20) : String.format('%.1f <%:Mbit/s%>', assoclist[j].rx_rate / 1000) - ; + ); - tr.insertCell(-1).innerHTML = (assoclist[j].tx_mcs > -1) + tr.insertCell(-1).innerHTML = nowrap((assoclist[j].tx_mcs > -1) ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[j].tx_rate / 1000, assoclist[j].tx_mcs, assoclist[j].tx_40mhz ? 40 : 20) : String.format('%.1f <%:Mbit/s%>', assoclist[j].tx_rate / 1000) - ; + ); rowstyle = (rowstyle == 1) ? 2 : 1; } diff --git a/modules/admin-full/luasrc/view/admin_status/connections.htm b/modules/admin-full/luasrc/view/admin_status/connections.htm index 9c9eb01c96..6525391aad 100644 --- a/modules/admin-full/luasrc/view/admin_status/connections.htm +++ b/modules/admin-full/luasrc/view/admin_status/connections.htm @@ -8,8 +8,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ - -%> <%+header%> @@ -161,6 +159,10 @@ $Id$ for (var i = 0; i < conn.length; i++) { var c = conn[i]; + + if (c.src == '127.0.0.1' && c.dst == '127.0.0.1') + continue; + var tr = conn_table.rows[0].parentNode.insertRow(-1); tr.className = 'cbi-section-table-row cbi-rowstyle-' + (1 + (i % 2)); diff --git a/modules/admin-full/luasrc/view/admin_status/index.htm b/modules/admin-full/luasrc/view/admin_status/index.htm index 003ec31031..f8707c05dd 100644 --- a/modules/admin-full/luasrc/view/admin_status/index.htm +++ b/modules/admin-full/luasrc/view/admin_status/index.htm @@ -9,8 +9,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ - -%> <% @@ -432,22 +430,22 @@ $Id$ tr.insertCell(-1).innerHTML = assoclist[i].bssid; tr.insertCell(-1).innerHTML = String.format( - '<a href="%s">%h</a>', + '<a href="%s">%s</a>', assoclist[i].link, - assoclist[i].name + '%h'.format(assoclist[i].name).nobr() ); - tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[i].signal); - tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[i].noise); + tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[i].signal).nobr(); + tr.insertCell(-1).innerHTML = String.format('%d <%:dBm%>', assoclist[i].noise).nobr(); tr.insertCell(-1).innerHTML = (assoclist[i].rx_mcs > -1) - ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[i].rx_rate / 1000, assoclist[i].rx_mcs, assoclist[i].rx_40mhz ? 40 : 20) - : String.format('%.1f <%:Mbit/s%>', assoclist[i].rx_rate / 1000) + ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[i].rx_rate / 1000, assoclist[i].rx_mcs, assoclist[i].rx_40mhz ? 40 : 20).nobr() + : String.format('%.1f <%:Mbit/s%>', assoclist[i].rx_rate / 1000).nobr() ; tr.insertCell(-1).innerHTML = (assoclist[i].tx_mcs > -1) - ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[i].tx_rate / 1000, assoclist[i].tx_mcs, assoclist[i].tx_40mhz ? 40 : 20) - : String.format('%.1f <%:Mbit/s%>', assoclist[i].tx_rate / 1000) + ? String.format('%.1f <%:Mbit/s%>, MCS %d, %d<%:MHz%>', assoclist[i].tx_rate / 1000, assoclist[i].tx_mcs, assoclist[i].tx_40mhz ? 40 : 20).nobr() + : String.format('%.1f <%:Mbit/s%>', assoclist[i].tx_rate / 1000).nobr() ; } diff --git a/modules/admin-full/luasrc/view/admin_status/load.htm b/modules/admin-full/luasrc/view/admin_status/load.htm index 64d2f3fb68..a002715ec8 100644 --- a/modules/admin-full/luasrc/view/admin_status/load.htm +++ b/modules/admin-full/luasrc/view/admin_status/load.htm @@ -8,8 +8,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ - -%> <%+header%> @@ -235,7 +233,7 @@ $Id$ label_01_cur.innerHTML = (data_01[data_01.length-1] / 100).toFixed(2); label_05_cur.innerHTML = (data_05[data_05.length-1] / 100).toFixed(2); - label_15_cur.innerHTML = (data_01[data_15.length-1] / 100).toFixed(2); + label_15_cur.innerHTML = (data_15[data_15.length-1] / 100).toFixed(2); label_01_avg.innerHTML = (data_01_avg / 100).toFixed(2); label_05_avg.innerHTML = (data_05_avg / 100).toFixed(2); @@ -244,9 +242,6 @@ $Id$ label_01_peak.innerHTML = (data_01_peak / 100).toFixed(2); label_05_peak.innerHTML = (data_05_peak / 100).toFixed(2); label_15_peak.innerHTML = (data_15_peak / 100).toFixed(2); - - /* reset timer */ - window.setTimeout(update_graph, 1000); } ); } @@ -262,7 +257,7 @@ $Id$ <table style="width:100%; table-layout:fixed" cellspacing="5"> <tr> - <td style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ff0000"><%:1 Minute Load:%></strong></td> + <td style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ff0000; white-space:nowrap"><%:1 Minute Load:%></strong></td> <td id="lb_load01_cur">0</td> <td style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></td> @@ -272,7 +267,7 @@ $Id$ <td id="lb_load01_peak">0</td> </tr> <tr> - <td style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ff6600"><%:5 Minute Load:%></strong></td> + <td style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ff6600; white-space:nowrap"><%:5 Minute Load:%></strong></td> <td id="lb_load05_cur">0</td> <td style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></td> @@ -282,7 +277,7 @@ $Id$ <td id="lb_load05_peak">0</td> </tr> <tr> - <td style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ffaa00"><%:15 Minute Load:%></strong></td> + <td style="text-align:right; vertical-align:top"><strong style="border-bottom:2px solid #ffaa00; white-space:nowrap"><%:15 Minute Load:%></strong></td> <td id="lb_load15_cur">0</td> <td style="text-align:right; vertical-align:top"><strong><%:Average:%></strong></td> diff --git a/modules/admin-full/luasrc/view/admin_status/wireless.htm b/modules/admin-full/luasrc/view/admin_status/wireless.htm index ff8382bf0b..465143ebce 100644 --- a/modules/admin-full/luasrc/view/admin_status/wireless.htm +++ b/modules/admin-full/luasrc/view/admin_status/wireless.htm @@ -8,8 +8,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ - -%> <%- @@ -304,14 +302,14 @@ $Id$ label_50_2.firstChild.data = rate_label(1.1 * 0.50 * data_max_2); label_75_2.firstChild.data = rate_label(1.1 * 0.75 * data_max_2); - label_rssi_cur.innerHTML = wireless_label(data_rssi[data_rssi.length-1], data_noise[data_noise.length-1]); - label_noise_cur.innerHTML = wireless_label(data_noise[data_noise.length-1]); + label_rssi_cur.innerHTML = wireless_label(data_rssi[data_rssi.length-1], data_noise[data_noise.length-1]).nobr(); + label_noise_cur.innerHTML = wireless_label(data_noise[data_noise.length-1]).nobr(); - label_rssi_avg.innerHTML = wireless_label(data_rssi_avg, data_noise_avg); - label_noise_avg.innerHTML = wireless_label(data_noise_avg); + label_rssi_avg.innerHTML = wireless_label(data_rssi_avg, data_noise_avg).nobr(); + label_noise_avg.innerHTML = wireless_label(data_noise_avg).nobr(); - label_rssi_peak.innerHTML = wireless_label(data_rssi_peak, data_noise_peak); - label_noise_peak.innerHTML = wireless_label(data_noise_peak); + label_rssi_peak.innerHTML = wireless_label(data_rssi_peak, data_noise_peak).nobr(); + label_noise_peak.innerHTML = wireless_label(data_noise_peak).nobr(); label_rate_cur.innerHTML = rate_label(data_rate[data_rate.length-1]); label_rate_avg.innerHTML = rate_label(data_rate_avg); diff --git a/modules/admin-full/luasrc/view/admin_system/packages.htm b/modules/admin-full/luasrc/view/admin_system/packages.htm index 73a35bec98..00b4be4868 100644 --- a/modules/admin-full/luasrc/view/admin_system/packages.htm +++ b/modules/admin-full/luasrc/view/admin_system/packages.htm @@ -9,8 +9,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -$Id$ - -%> <%- local bit = require "bit" @@ -35,16 +33,18 @@ local free_byte = space_free * fstat.frsize local filter = { } +local opkg_list = luci.model.ipkg.list_all local querypat if query and #query > 0 then - querypat = "*%s*" % query + querypat = '*%s*' % query + opkg_list = luci.model.ipkg.find end local letterpat if letter == 35 then - letterpat = "[^a-zA-Z]*" + letterpat = "[^a-z]*" else - letterpat = string.char(91, letter, letter + 32, 93, 42) -- '[' 'A' 'a' ']' '*' + letterpat = string.char(letter, 42) -- 'A' '*' end -%> @@ -173,7 +173,7 @@ end <th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th> <th class="cbi-section-table-cell" style="text-align:left"><%:Description%></th> </tr> - <% local empty = true; luci.model.ipkg.list_all(querypat or letterpat, function(n, v, d) if filter[n] then return end; empty = false %> + <% local empty = true; opkg_list(querypat or letterpat, function(n, v, d) if filter[n] then return end; empty = false %> <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>"> <td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:Install%> "<%=luci.util.pcdata(n)%>" ?')" href="<%=REQUEST_URI%>?submit=1&install=<%=luci.util.pcdata(n)%>"><%:Install%></a></td> <td style="text-align:left"><%=luci.util.pcdata(n)%></td> diff --git a/modules/admin-full/src/luci-bwc.c b/modules/admin-full/src/luci-bwc.c index 52e25e6f78..1a4f510d78 100644 --- a/modules/admin-full/src/luci-bwc.c +++ b/modules/admin-full/src/luci-bwc.c @@ -536,6 +536,10 @@ static int run_daemon(void) if (strstr(line, "TIME_WAIT")) continue; + if (strstr(line, "src=127.0.0.1 ") && + strstr(line, "dst=127.0.0.1 ")) + continue; + if (sscanf(line, "%*s %*d %s", ifname) || sscanf(line, "%s %*d", ifname)) { if (!strcmp(ifname, "tcp")) diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua index 666f0864b3..e81e07c94e 100644 --- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua @@ -251,15 +251,14 @@ function jsonstatus() ltn12.pump.all(json.Encoder(root):source(), http.write) end -function public_status_json() +function public_status_json(devs) local twa = require "luci.tools.webadmin" local sys = require "luci.sys" local i18n = require "luci.i18n" - local path = luci.dispatcher.context.requestpath local rv = { } local dev - for dev in path[#path]:gmatch("[%w%.%-]+") do + for dev in devs:gmatch("[%w%.%-]+") do local j = { id = dev } local iw = luci.sys.wifi.getiwinfo(dev) if iw then diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/basics.lua b/modules/freifunk/luasrc/model/cbi/freifunk/basics.lua index bbf7c56ce0..8987b1cb46 100644 --- a/modules/freifunk/luasrc/model/cbi/freifunk/basics.lua +++ b/modules/freifunk/luasrc/model/cbi/freifunk/basics.lua @@ -15,7 +15,6 @@ local fs = require "luci.fs" local util = require "luci.util" local uci = require "luci.model.uci".cursor() local profiles = "/etc/config/profile_" -luci.i18n.loadc("freifunk") m = Map("freifunk", translate ("Community")) c = m:section(NamedSection, "community", "public", nil, translate("These are the basic settings for your local wireless community. These settings define the default values for the wizard and DO NOT affect the actual configuration of the router.")) diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua b/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua index 6f998819a3..f6cdec7fe1 100644 --- a/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua +++ b/modules/freifunk/luasrc/model/cbi/freifunk/contact.lua @@ -11,8 +11,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ]]-- -luci.i18n.loadc("freifunk") - m = Map("freifunk", translate("Contact"), translate("Please fill in your contact details below.")) c = m:section(NamedSection, "contact", "public", "") diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua b/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua index 933efb45f4..a8beef8468 100644 --- a/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua +++ b/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua @@ -13,7 +13,6 @@ You may obtain a copy of the License at local uci = require "luci.model.uci".cursor() local ipkg = require "luci.model.ipkg" local community = uci:get("freifunk", "community", "name") -luci.i18n.loadc("freifunk") if community == nil then luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error")) diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua b/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua index b08c0f0249..a0b8f34bc9 100644 --- a/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua +++ b/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua @@ -13,7 +13,6 @@ You may obtain a copy of the License at local fs = require "nixio.fs" local uci = require "luci.model.uci".cursor() local community = uci:get("freifunk", "community", "name") -luci.i18n.loadc("freifunk") if community == nil then luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error")) diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/user_index.lua b/modules/freifunk/luasrc/model/cbi/freifunk/user_index.lua index e23ea901ab..fe1d8fe7ed 100644 --- a/modules/freifunk/luasrc/model/cbi/freifunk/user_index.lua +++ b/modules/freifunk/luasrc/model/cbi/freifunk/user_index.lua @@ -1,6 +1,5 @@ local fs = require "nixio.fs" local file = "/www/luci-static/index_user.html" -luci.i18n.loadc("freifunk") m = Map("freifunk", translate("Edit index page"), translate("You can display additional content on the public index page by inserting valid XHTML in the form below.<br />Headlines should be enclosed between <h2> and </h2>.")) diff --git a/modules/freifunk/luasrc/view/freifunk-map/frame.htm b/modules/freifunk/luasrc/view/freifunk-map/frame.htm index 909b27065b..b2e168363f 100644 --- a/modules/freifunk/luasrc/view/freifunk-map/frame.htm +++ b/modules/freifunk/luasrc/view/freifunk-map/frame.htm @@ -12,10 +12,18 @@ <% if has_latlon then %> <iframe style="width:100%; height:640px; border:none" src="<%=luci.dispatcher.build_url("freifunk/map/content")%>"></iframe> + <h3><%:Legend%>:</h3> + <ul> + <li><strong><span style="color:#00cc00"><%:Green%></span></strong>:<%:Very good (ETX < 2)%></li> + <li><strong><span style="color:#ffcb05"><%:Yellow%></span></strong>:<%:Good (2 < ETX < 4)%></li> + <li><strong><span style="color:#ff6600"><%:Orange%></span></strong>:<%:Still usable (4 < ETX < 10)%></li> + <li><strong><span style="color:#bb3333"><%:Red%></span></strong>:<%:Bad (ETX > 10)%></li> + </ul> + <% else %> <h2><%:Map Error%></h2> <p><%_The OLSRd service is not configured to capture position data from the network.<br /> Please make sure that the nameservice plugin is properly configured and that the <em>latlon_file</em> option is enabled.%></p> <% end %> - <%+footer%> + diff --git a/modules/freifunk/luasrc/view/freifunk-map/map.htm b/modules/freifunk/luasrc/view/freifunk-map/map.htm index f373a7a6b7..02b1afdab0 100644 --- a/modules/freifunk/luasrc/view/freifunk-map/map.htm +++ b/modules/freifunk/luasrc/view/freifunk-map/map.htm @@ -43,11 +43,22 @@ if (null != alias[fromip]) fromip = alias[fromip]; if (null != points[fromip] && null != points[toip]) { - var w = 1; - if (etx < 4) w++; - if (etx < 2) w++; + var color; + var red = 240; + var green = 0; + var blue = 0; + var w = 1 + + if (etx < 100) {red=252;green=102;blue=0;w=2}; + if (etx < 10) {red=255;green=203;blue=5;w=3}; + if (etx < 4) {red=240;green=255;blue=0;w=4}; + if (etx < 2) {red=0;green=204;blue=0;w=5}; + if (etx < 1) {red=80;green=0;blue=0;w=1}; + map.AddPolyline(new VEPolyline('id'+lineid, [points[fromip], points[toip]], - new VEColor(102,Math.floor(lq*255.0),Math.floor(nlq*255.0),1.0), w)); + new VEColor(red, green, blue, 0.5), w)); + + } else { diff --git a/modules/freifunk/luasrc/view/freifunk/adminindex.htm b/modules/freifunk/luasrc/view/freifunk/adminindex.htm index 92169a80da..e0252ba891 100644 --- a/modules/freifunk/luasrc/view/freifunk/adminindex.htm +++ b/modules/freifunk/luasrc/view/freifunk/adminindex.htm @@ -17,7 +17,6 @@ else mail = contact.mail end -luci.i18n.loadc("freifunk") %> <h2><%:Freifunk Overview%></h2> |
