3 Copyright (C) 2006-2010 Jonathan Zarate
4 http://www.polarcloud.com/tomato/
6 For use with Tomato Firmware only.
7 No part of this file may be used without permission.
11 //<% nvram("ppp_get_ip,pptp_server_ip,router_name,wan_domain,wan_gateway,wan_gateway_get,wan_get_domain,wan_hostname,wan_hwaddr,wan_ipaddr,wan_netmask,wan_proto,wan_run_mtu,et0macaddr,lan_proto,lan_ipaddr,dhcp_start,dhcp_num,dhcpd_startip,dhcpd_endip,lan_netmask,wl_security_mode,wl_crypto,wl_mode,wl_wds_enable,wl_hwaddr,wl_net_mode,wl_radio,wl_channel,lan_gateway,wl_ssid,t_model_name,t_features,pptp_dhcp"); %>
23 if (typeof(last_wan_proto) == 'undefined') {
24 last_wan_proto = nvram.wan_proto;
26 else if (last_wan_proto != nvram.wan_proto) {
29 stats.flashsize = sysinfo.flashsize+'MB';
30 stats.cpumhz = sysinfo.cpuclk+'MHz';
31 stats.systemtype = sysinfo.systemtype;
32 stats.cpuload = ((sysinfo.loads[0] / 65536.0).toFixed(2) + '<small> / </small> ' +
33 (sysinfo.loads[1] / 65536.0).toFixed(2) + '<small> / </small>' +
34 (sysinfo.loads[2] / 65536.0).toFixed(2));
35 stats.freqcpu = nvram.clkfreq;
36 stats.uptime = sysinfo.uptime_s;
39 b = sysinfo.totalfreeram;
40 stats.memory = scaleSize(a) + ' / ' + scaleSize(b) + ' <small>(' + (b / a * 100.0).toFixed(2) + '%)</small>';
41 if (sysinfo.totalswap > 0) {
42 a = sysinfo.totalswap;
44 stats.swap = scaleSize(a) + ' / ' + scaleSize(b) + ' <small>(' + (b / a * 100.0).toFixed(2) + '%)</small>';
48 stats.time = '<% time(); %>';
49 stats.wanup = '<% wanup(); %>' == '1';
50 stats.wanprebuf = nvram.wan_ipaddr_buf;
51 stats.wanuptime = '<% link_uptime(); %>';
52 stats.wanlease = '<% dhcpc_time(); %>';
55 stats.dns = dns.join(', ');
57 stats.wanip = nvram.wan_ipaddr;
58 stats.wannetmask = nvram.wan_netmask;
59 stats.wangateway = nvram.wan_gateway_get;
60 if (stats.wangateway == '0.0.0.0' || stats.wangateway == '')
61 stats.wangateway = nvram.wan_gateway;
63 switch (nvram.wan_proto) {
67 stats.wanip = nvram.ppp_get_ip;
68 if (nvram.pptp_dhcp == '1') {
69 if (nvram.wan_ipaddr != '' && nvram.wan_ipaddr != '0.0.0.0' && nvram.wan_ipaddr != stats.wanip)
70 stats.wanip += ' <small>(DHCP: ' + nvram.wan_ipaddr + ')</small>';
71 if (nvram.wan_gateway != '' && nvram.wan_gateway != '0.0.0.0' && nvram.wan_gateway != stats.wangateway)
72 stats.wangateway += ' <small>(DHCP: ' + nvram.wan_gateway + ')</small>';
74 if (stats.wannetmask == '0.0.0.0')
75 stats.wannetmask = '255.255.255.255';
78 if (nvram.wan_proto == 'pptp')
79 stats.wangateway = nvram.pptp_server_ip;
84 stats.wanip = '0.0.0.0';
85 stats.wannetmask = '0.0.0.0';
86 stats.wangateway = '0.0.0.0';
91 stats.ip6_wan = ((typeof(sysinfo.ip6_wan) != 'undefined') ? sysinfo.ip6_wan : '') + '';
92 stats.ip6_lan = ((typeof(sysinfo.ip6_lan) != 'undefined') ? sysinfo.ip6_lan : '') + ''
93 stats.ip6_lan_ll = ((typeof(sysinfo.ip6_lan_ll) != 'undefined') ? sysinfo.ip6_lan_ll : '') + ''
96 stats.wanstatus = '<% wanstatus(); %>';
97 if (stats.wanstatus != 'Connected') stats.wanstatus = '<b>' + stats.wanstatus + '</b>';
100 stats.interference = [];
103 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
106 a = i = wlstats[uidx].channel * 1;
108 stats.channel.push('<a href="tools-survey.asp">' + ((i) ? i + '' : 'Auto') +
109 ((wlstats[uidx].mhz) ? ' - ' + (wlstats[uidx].mhz / 1000.0).toFixed(3) + ' <small>GHz</small>' : '') + '</a>' +
110 ((a < 0) ? ' <small>(scanning...)</small>' : ''));
111 stats.interference.push((wlstats[uidx].intf >= 0) ? ((wlstats[uidx].intf) ? 'Severe' : 'Acceptable') : '');
113 a = wlstats[uidx].nbw * 1;
114 wlstats[uidx].nbw = (a > 0) ? (a + ' <small>MHz</small>') : 'Auto';
116 if (wlstats[uidx].radio) {
117 a = wlstats[uidx].rate * 1;
119 wlstats[uidx].rate = Math.floor(a / 2) + ((a & 1) ? '.5' : '') + ' <small>Mbps</small>';
121 wlstats[uidx].rate = '-';
123 if (wlstats[uidx].client) {
124 if (wlstats[uidx].rssi == 0) a = 0;
125 else a = MAX(wlstats[uidx].rssi - wlstats[uidx].noise, 0);
126 stats.qual.push(a + ' <img src="bar' + MIN(MAX(Math.floor(a / 10), 1), 6) + '.gif">');
131 wlstats[uidx].noise += ' <small>dBm</small>';
132 wlstats[uidx].rssi += ' <small>dBm</small>';
135 wlstats[uidx].rate = '';
136 wlstats[uidx].noise = '';
137 wlstats[uidx].rssi = '';