X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-admin-full%2Fluasrc%2Fview%2Fadmin_status%2Findex.htm;h=5e6e494ad6e3cd03752ab76793bc7c189cdf385c;hp=eb4648806227782138451b7ce6f2496c538f2eb9;hb=HEAD;hpb=1e1a706db5040d94ec5fd98a1fbf3563637b6c67 diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index eb4648806..5e6e494ad 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -37,15 +37,12 @@ local wan = ntm:get_wannet() local wan6 = ntm:get_wan6net() - local conn_count = tonumber(( - luci.sys.exec("wc -l /proc/net/nf_conntrack") or - luci.sys.exec("wc -l /proc/net/ip_conntrack") or - ""):match("%d+")) or 0 + local conn_count = tonumber( + 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, @@ -76,12 +73,14 @@ if wan6 then rv.wan6 = { - ip6addr = wan6:ip6addr(), - gw6addr = wan6:gw6addr(), - dns = wan6:dns6addrs(), - uptime = wan6:uptime(), - ifname = wan6:ifname(), - link = wan6:adminlink() + ip6addr = wan6:ip6addr(), + gw6addr = wan6:gw6addr(), + dns = wan6:dns6addrs(), + ip6prefix = wan6:ip6prefix(), + uptime = wan6:uptime(), + proto = wan6:proto(), + ifname = wan6:ifname(), + link = wan6:adminlink() } end @@ -150,7 +149,7 @@ return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase(); // DUID-LL / Ethernet - if (duid.length === 24 && duid.substr(0, 8) === '00030001') + if (duid.length === 20 && duid.substr(0, 8) === '00030001') return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase(); return null; @@ -233,9 +232,34 @@ if (ifc6 && ifc6.ifname && ifc6.proto != 'none') { var s = String.format( - '<%:Address%>: %s
' + + '<%:Type%>: %s%s
', + ifc6.proto, (ifc6.ip6prefix) ? '-pd' : '' + ); + + if (!ifc6.ip6prefix) + { + s += String.format( + '<%:Address%>: %s
', + (ifc6.ip6addr) ? ifc6.ip6addr : '::' + ); + } + else + { + s += String.format( + '<%:Prefix Delegated%>: %s
', + ifc6.ip6prefix + ); + if (ifc6.ip6addr) + { + s += String.format( + '<%:Address%>: %s
', + ifc6.ip6addr + ); + } + } + + s += String.format( '<%:Gateway%>: %s
', - (ifc6.ip6addr) ? ifc6.ip6addr : '::', (ifc6.gw6addr) ? ifc6.gw6addr : '::' ); @@ -341,7 +365,9 @@ { var timestr; - if (info.leases[i].expires <= 0) + if (info.leases[i].expires === false) + timestr = '<%:unlimited%>'; + else if (info.leases[i].expires <= 0) timestr = '<%:expired%>'; else timestr = String.format('%t', info.leases[i].expires); @@ -379,7 +405,9 @@ { var timestr; - if (info.leases6[i].expires <= 0) + if (info.leases6[i].expires === false) + timestr = '<%:unlimited%>'; + else if (info.leases6[i].expires <= 0) timestr = '<%:expired%>'; else timestr = String.format('%t', info.leases6[i].expires); @@ -388,15 +416,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( - '
%s
', - ((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)) + ? '
? (%h)
'.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) + ? '
%h (%h)
'.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;