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("l2tp_get_ip,ppp_get_ac,pptp_get_ip,pptp_server_ip,router_name,clkfreq,wan_ipaddr_buf,wan_domain,wan_gateway,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,security_mode2,wl_crypto,wl_mode,wds_enable,wl0_hwaddr,wl_net_mode,wl_radio,wl_channel,lan_gateway,wl_ssid,t_model_name,t_features"); %>
22 if (typeof(last_wan_proto) == 'undefined') {
23 last_wan_proto = nvram.wan_proto;
25 else if (last_wan_proto != nvram.wan_proto) {
29 stats.cpuload = ((sysinfo.loads[0] / 65536.0).toFixed(2) + '<small> / </small> ' +
30 (sysinfo.loads[1] / 65536.0).toFixed(2) + '<small> / </small>' +
31 (sysinfo.loads[2] / 65536.0).toFixed(2));
32 stats.freqcpu = nvram.clkfreq;
33 stats.uptime = sysinfo.uptime_s;
36 b = sysinfo.totalfreeram;
37 stats.memory = scaleSize(a) + ' / ' + scaleSize(b) + ' <small>(' + (b / a * 100.0).toFixed(2) + '%)</small>';
38 if (sysinfo.totalswap > 0) {
39 a = sysinfo.totalswap;
41 stats.swap = scaleSize(a) + ' / ' + scaleSize(b) + ' <small>(' + (b / a * 100.0).toFixed(2) + '%)</small>';
45 stats.time = '<% time(); %>';
46 stats.wanup = '<% wanup(); %>' == '1';
47 stats.wanprebuf = nvram.wan_ipaddr_buf;
48 stats.wanuptime = '<% link_uptime(); %>';
49 stats.wanlease = '<% dhcpc_time(); %>';
52 stats.dns = dns.join(', ');
54 stats.wanip = nvram.wan_ipaddr;
55 stats.wannetmask = nvram.wan_netmask;
56 stats.wangateway = nvram.wan_gateway;
57 stats.ispconid = nvram.ppp_get_ac; //Victek
59 switch (nvram.wan_proto) {
63 stats.wanip = nvram.ppp_get_ip;
64 if (nvram.wan_ipaddr != '' && nvram.wan_ipaddr != '0.0.0.0' && nvram.wan_ipaddr != nvram.ppp_get_ip)
65 stats.wanip += ' <small>(DHCP: ' + nvram.wan_ipaddr + ')</small>';
66 if (stats.wannetmask == '0.0.0.0')
67 stats.wannetmask = '255.255.255.255';
70 if (nvram.wan_proto == 'pptp')
71 stats.wangateway = nvram.pptp_server_ip;
76 stats.wanip = '0.0.0.0';
77 stats.wannetmask = '0.0.0.0';
78 stats.wangateway = '0.0.0.0';
82 stats.wanstatus = '<% wanstatus(); %>';
83 if (stats.wanstatus != 'Connected') stats.wanstatus = '<b>' + stats.wanstatus + '</b>';
86 a = i = wlchaninfo[0] * 1;
88 stats.channel = '<a href="tools-survey.asp">' + ((i) ? i + '' : 'Auto') +
89 ((wlchaninfo[1]) ? ' - ' + (wlchaninfo[1] / 1000.0).toFixed(3) + ' <small>GHz</small>' : '') + '</a>' +
90 ((a < 0) ? ' <small>(scanning...)</small>' : '');
91 stats.interference = (wlchaninfo[2] >= 0) ? ((wlchaninfo[2]) ? 'Severe' : 'Acceptable') : '';
93 a = '<% wlnbw(); %>' * 1;
95 stats.nbw = a + ' <small>MHz</small>';
99 wlcrssi = wlnoise = stats.qual = stats.rate = '';
100 isClient = ((nvram.wl_mode == 'wet') || (nvram.wl_mode == 'sta'));
102 a = '<% wlrate(); %>' * 1;
104 stats.rate = Math.floor(a / 2) + ((a & 1) ? '.5' : '') + ' <small>Mbps</small>';
108 if (wlcrssi == 0) a = 0;
109 else a = MAX(wlcrssi - wlnoise, 0);
110 stats.qual = a + ' <img src="bar' + MIN(MAX(Math.floor(a / 10), 1), 6) + '.gif">';
112 wlnoise += ' <small>dBm</small>';
113 wlcrssi += ' <small>dBm</small>';