<%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth Copyright 2008-2011 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -%> <% require "luci.fs" require "luci.tools.status" local uci = require "luci.model.uci".cursor() local ntm = require "luci.model.network".init() local has_ipv4 = luci.fs.access("/proc/net/ipv4_route") local has_ipv6 = luci.fs.access("/proc/net/ipv6_route") local disable_ipv6_GUI = uci:get("functionlist","functionlist","SUPPORT_IPV6_DISABLED") or "0" local has_dhcp = luci.fs.access("/etc/config/dhcp") local lan_type if uci:get("functionlist","functionlist","SUPPORT_IPV6_SETTING_INDEPENDENT") == "1" then lan_type = uci:get("network", "lan", "ipv6_proto") else lan_type = uci:get("network", "lan", "proto") end local has_wifi = luci.fs.stat("/etc/config/wireless") has_wifi = has_wifi and has_wifi.size > 0 local only_eth1_for_lan = uci:get('functionlist','functionlist','SUPPORT_ONLY_ETH1_STATISTICS_FOR_LAN') if luci.http.formvalue("status") == "1" then local wan = ntm:get_wannet() local wan6 = ntm:get_wan6net() -- local _, _, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo() -- -- 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_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 rv = { -- uptime = luci.sys.uptime(), -- localtime = os.date(), -- loadavg = { luci.sys.loadavg() }, -- memtotal = memtotal, -- memcached = memcached, -- membuffers = membuffers, -- memfree = memfree, -- connmax = conn_max, -- conncount = conn_count, -- leases = luci.tools.status.dhcp_leases(), -- leases6 = luci.tools.status.dhcp6_leases(), wifinets = luci.tools.status.wifi_networks() } if wan then rv.wan = { ipaddr = wan:ipaddr(), gwaddr = wan:gwaddr(), netmask = wan:netmask(), dns = wan:dnsaddrs(), expires = wan:expires(), uptime = wan:uptime(), proto = wan:proto(), ifname = wan:ifname(), link = wan:adminlink(), } end -- if wan6 then -- rv.wan6 = { -- ip6addr = wan6:ip6addr(), -- gw6addr = wan6:gw6addr(), -- dns = wan6:dns6addrs(), -- uptime = wan6:uptime(), -- ifname = wan6:ifname(), -- link = wan6:adminlink() -- } -- end luci.http.prepare_content("application/json") luci.http.write_json(rv) return end if luci.http.formvalue("status") == "2" then local _, _, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo() local rv = { uptime = luci.sys.uptime(), localtime = os.date(), memtotal = memtotal, memcached = memcached, membuffers = membuffers, memfree = memfree, } if luci.http.formvalue("ipv6") == "1" then local conf, dnsaddrs conf = "/tmp/resolv.conf.auto" rv.ipv6 = { addr = {}, gwaddr = {}, dnsaddrs = {} } rv.ipv6.addr = luci.util.trim(luci.util.exec([[ip -6 addr show br-lan | grep 'scope global' | sed -n '1p' | sed 's/^.*inet6 //g' | sed 's/\/.*$//g']])) rv.ipv6.gwaddr = luci.util.trim(luci.util.exec([[ip -6 route show default | grep 'br-lan' | sed -n '1p' | sed 's/^.*via //g' | sed 's/ .*$//g']])) dnsaddrs = luci.util.exec([[cat %s | grep -E '^nameserver.*:' | grep -wv '::1' | cut -d ' ' -f 2]] % conf) rv.ipv6.dnsaddrs = luci.util.split(luci.util.trim(dnsaddrs), "\n") end luci.http.prepare_content("application/json") luci.http.write_json(rv) return end if luci.http.formvalue("status") == "3" then local rv = luci.tools.status.wifi_networks_actived_channels() luci.http.prepare_content("application/json") luci.http.write_json(rv) return end local system, model = luci.sys.sysinfo() local WLANVLANEnable = uci:get("network", "sys", "WLANVLANEnable") local managementVlanId = uci:get("network", "sys", "ManagementVLANID") or 0 local ManagementVLANID_MAX_VALUE = tonumber(uci:get("functionlist", "vendorlist", "ManagementVLANID_MAX_VALUE") or 4094) local uti = luci.util local lan_ip = uti.trim(uti.exec("ifconfig br-lan | grep \"inet addr\" | awk -F \" \" '{print $2}' | awk -F \":\" '{print $2}'")) local lan_mask = uti.trim(uti.exec("ifconfig br-lan | grep \"inet addr\" | awk -F \" \" '{print $4}' | awk -F \":\" '{print $2}'")) local ipv6_linklocal = uti.split(uti.trim(uti.exec("ifconfig br-lan | grep inet6 | grep Link | awk '{print $3}'")), "/")[1] or "N/A" if ipv6_linklocal == "" then ipv6_linklocal = "N/A" end local laninfo = uci:get_all("network", "lan") local firmwareVersion = luci.util.trim(luci.util.exec("cat /etc/version | grep Firmware | awk '{print $4}'")) local capwap_firmwareVersion = luci.util.trim(luci.util.exec("cat /etc/version_capwap")) or "?" local SystemName = luci.util.repSpec(tostring(uci:get_first("system", "system", "SystemName") or "?")) local lacpinfo if uci:get("functionlist","functionlist","SUPPORT_ETHERNET_BONDING") == "1" then lacpinfo = uci:get_all("network", "lacp") end local serial_number = luci.util.trim(luci.util.exec("setconfig -g 19 |cut -c 1-13")) --local bundle_number = luci.util.trim(luci.util.exec("setconfig -g 39")) or "" --if serial_number == "" or serial_number == "00000000000000000000" then -- serial_number = luci.util.trim(luci.util.exec("setconfig -g 0")) -- if bundle_number == "000000001" or bundle_number == "000000002" then -- local bundle = string.sub(bundle_number,-1) -- bundle = "-"..bundle -- serial_number = serial_number..bundle -- end --end local network_action = require "luci.controller.admin.network" local bandwidth_24g = network_action.get_sta_htmode_24g() local bandwidth_5g = network_action.get_sta_htmode_5g() local bandwidth_5g_2 = network_action.get_sta_htmode_5g_2() -%> <%+header%>

<%:A network protocol can be enabled to prevent network loops or the incurred broadcast radiation in your LAN network.%>

<% if uci:get('functionlist','functionlist','SUPPORT_WIFIJET') == '1' then --[[####SUPPORT_ENJET START #### --]] %> <% else %> <% end --[[####SUPPORT_ENJET END #### --]] %> <% if uci:get('functionlist','functionlist','SUPPORT_DISPLAY_SERIAL_NUMBER') == '1' then -----#### SUPPORT_DISPLAY_SERIAL_NUMBER START ### %> <% end-----#### SUPPORT_DISPLAY_SERIAL_NUMBER END #### %> <% if uci:get('sysProductInfo','model','modelName') ~= 'EMD11' then --[[ #### HIDE_LAN_PORT START ### --]]%> <% if uci:get('functionlist','functionlist','SUPPORT_DUAL_LAN_PORT') == '1' then --[[ #### SUPPORT_DUAL_LAN_PORT START ### --]] %> <% local lan1_mac local lan2_mac if uci:get('sysProductInfo','model','outdoor') == '1' then lan1_mac=ntm:get_mac("eth1") lan2_mac=ntm:get_mac("eth0") if uci:get('functionlist','functionlist','SUPPORT_ENGENIUS_DUAL_LAN_PORT') == '1' then lan1_mac=ntm:get_mac("eth0") lan2_mac=ntm:get_mac("eth1") end end if uci:get('sysProductInfo','model','outdoor') == '0' then lan1_mac=ntm:get_mac("eth0") lan2_mac=ntm:get_mac("eth1") if uci:get('functionlist','functionlist','SUPPORT_DUAL_LAN_PORT_INVERSE') == '1' then lan1_mac=ntm:get_mac("eth1") lan2_mac=ntm:get_mac("eth0") end end %> <% else --[[ #### SUPPORT_DUAL_LAN_PORT ELSE ### --]] %> <% if uci:get('functionlist','functionlist','SUPPORT_DEMO_APPLY') == '1' then -----#### SUPPORT_DEMO_APPLY START ### %> <% else -----#### SUPPORT_DEMO_APPLY ELSE ### %> <% end -----#### SUPPORT_DEMO_APPLY END ### %> <% end --[[ #### SUPPORT_DUAL_LAN_PORT END ### --]] %> <% end --[[ #### HIDE_LAN_PORT END ### --]] %> <% if WLAN24G=="1" then %> <% if uci:get('functionlist','functionlist','SUPPORT_DEMO_APPLY') == '1' then -----#### SUPPORT_DEMO_APPLY START ### %> <% else -----#### SUPPORT_DEMO_APPLY ELSE ### %> <% end -----#### SUPPORT_DEMO_APPLY END ### %> <% end %> <% if WLAN5G=="1" then %> <% if uci:get('functionlist','functionlist','SUPPORT_DEMO_APPLY') == '1' then --[[ #### SUPPORT_DEMO_APPLY START ### --]] %> <% else --[[ #### SUPPORT_DEMO_APPLY ELSE ### --]] %> <% end --[[ #### SUPPORT_DEMO_APPLY END ### --]] %> <% if WLAN5G_2 == '1' then --[[ #### WLAN5G_2 feature ### --]] %> <% end --[[ #### WLAN5G_2 feature ### --]] %> <% end %> <% if (uci:get('functionlist', 'functionlist', 'SUPPORT_WLAN24G') == '1') then %> <% if (uci:get('wireless', 'wifi0', 'country') == '00') then %> <% else %> <% end %> <% else %> <% if (uci:get('wireless', 'wifi1', 'country') == '00') then %> <% else %> <% end %> <% end %> <% if (uci:get('functionlist','functionlist','SUPPORT_CAPWAP_CONTROL') == '1' and uci:get('sysProductInfo','model','modelName') ~= 'EMD11' ) then -----#### SUPPORT_CAPWAP_CONTROL START ### %> <% if (uci:get('functionlist','functionlist','SUPPORT_ATKK_FW_VERSION') == '1') then -----#### SUPPORT_ATKK_FW_VERSION START ### %> <% else -----#### SUPPORT_ATKK_FW_VERSION ELSE #### %> <% end-----#### SUPPORT_ATKK_FW_VERSION END #### %> <% else -----#### SUPPORT_CAPWAP_CONTROL ELSE #### %> <% if (uci:get('functionlist','functionlist','SUPPORT_FULL_FW_VERSION') == '1') then -----#### SUPPORT_ATKK_FW_VERSION START ### %> <% else -----#### SUPPORT_FULL_FW_VERSION ELSE #### %> <% end-----#### SUPPORT_FULL_FW_VERSION END #### %> <% end-----#### SUPPORT_CAPWAP_CONTROL END #### %> <% if (uci:get('sysProductInfo','model','modelName') ~= 'EMD11') then %> <% if (WLANVLANEnable =="0") or (tonumber(managementVlanId) > ManagementVLANID_MAX_VALUE) or (tonumber(managementVlanId) < 1) then %> <% else %> <% end %> <% if (uci:get('functionlist','functionlist','SUPPORT_CAPWAP_CONTROL') == '1') then -----#### SUPPORT_CAPWAP_CONTROL START ### if (uci:get('functionlist','functionlist','SUPPORT_HIDE_CHECK_CODE_IN_STATUS') == '1') then -----#### SUPPORT_HIDE_CHECK_CODE_IN_STATUS START ### else %> <% end -----#### SUPPORT_HIDE_CHECK_CODE_IN_STATUS END #### end-----#### SUPPORT_CAPWAP_CONTROL END #### %> <% end %>
<%:Device Information%>
<%:AirBridge Name%>
<%:AP Name%>
<%:Serial Number%><%=serial_number%>
<%:MAC Address%>
- <%:LAN1%> <%=lan1_mac%>
- <%:LAN2%> <%=lan2_mac%>
- <%:LAN%><%:88:DC:96:88:99:30%><%=ntm:get_mac("br-lan")%>
- <%:Wireless LAN%> - 2.4GHz<%:88:DC:96:88:99:32%><%=ntm:get_mac("wifi0")%>
- <%:Wireless LAN%> - 5GHz<% if WLAN5G_2 == '1' then%> - 1<% end %><%:88:DC:96:88:99:33%><%=ntm:get_mac("wifi1")%>
- <%:Wireless LAN%> - 5GHz - 2 <%=ntm:get_mac("wifi2")%>
<%:Country%><%:Please select the country%><%=ntm:get_country()%><%:Please select the country%><%=ntm:get_country()%>
<%:Current Local Time%><%=os.date()%>
<%:Uptime%>
<%:Firmware Version%>
<%:Firmware Version%>
<%:Firmware Version%>
<%:Firmware Version%>
<%:Device Version%>
<%:Management VLAN ID%><%:Untagged%><%=managementVlanId%>
<%:LAN Speed%>
<%:Registration Check Code%>
<%:Memory Information%>
<%:Total Available%>-
<%:Free%>-
<%:Cached%>-
<%:Buffered%>-
<% if uci:get("functionlist","functionlist","SUPPORT_STP_STATUS") == "1" then else %> <% end %>
<%:LAN Information%> - IPv4
<%:IP Address%> <%=laninfo["ipaddr"]%>
<%:Subnet Mask%> <%=laninfo["netmask"]%>
<%:Gateway%> <%=laninfo["gateway"]%>
<%:Primary DNS%> N/A
<%:Secondary DNS%> N/A
<%:DHCP Client%> <%:Disable%>
<%:Spanning Tree Protocol(STP)%>
<% if has_ipv6 and disable_ipv6_GUI == "0" then %>
<%:LAN Information%> - IPv6
<%:IP Address%> N/A
<%:Link-Local Address%> <%=ipv6_linklocal%>
<%:Gateway%> N/A
<%:Primary DNS%> N/A
<%:Secondary DNS%> N/A
<% end %> <% if uci:get("functionlist","functionlist","SUPPORT_STP_STATUS") == "1" then %>
<%:Spanning Tree Protocol(STP) Information%>
<%:Status%>
<%:Hello Time%> <%=laninfo["hello_time"] or "0"%>
<%:Max Age%> <%=laninfo["max_age"] or "0"%>
<%:Forward Delay%> <%=laninfo["forward_delay"] or "0"%>
<%:Priority%> <%=laninfo["priority"] or "0"%>
<%:Designated Root%> N/A
<% end %> <% if uci:get("functionlist","functionlist","SUPPORT_ETHERNET_BONDING") == "1" then if uci:get("functionlist","functionlist","SUPPORT_ETHERNET_BONDING_STATUS") == "1" then %>
<%:Link Aggregation Control Protocol (LACP) Information%>
<%:Status%>
<%:Timeout%>
<%:System Priority%> <%=lacpinfo["system_priority"] or "0"%>
<%:Actor Key%> N/A
<%:Partner Key%> N/A
<%:Partner Mac Address%> N/A
<% end end %> <% if has_wifi then %>
<%:Collecting data...%>
<% if uci:get('functionlist','functionlist','SUPPORT_COMBINED_SSID_SETTING') == '1' then %>
<% end %> <% end %> <% if (uci:get('functionlist','functionlist','SUPPORT_ENGENIUS_DDNS') == '1') or (uci:get('functionlist','functionlist','OMIT_ENGENIUS_DDNS') == '0')then -----#### SUPPORT_ENGENIUS_DDNS or OMIT_ENGENIUS_DDNS ### %>
<%:UID / DDNS%>
<%=luci.util.trim(luci.util.exec("setconfig -g 35"))%>
<%=luci.util.trim(luci.util.exec("setconfig -g 35"))%>.<%=luci.util.trim(luci.util.exec("setconfig -g 37"))%>
<% end-----#### SUPPORT_ENGENIUS_DDNS or OMIT_ENGENIUS_DDNS #### %> <%- require "luci.util" require "nixio.fs" local plugins = nixio.fs.dir(luci.util.libpath() .. "/view/admin_status/index") if plugins then local inc for inc in plugins do if inc:match("%.htm$") then include("admin_status/index/" .. inc:gsub("%.htm$", "")) end end end -%> <% if (uci:get('functionlist','functionlist','SUPPORT_CAPWAP_CONTROL') == '1') then -----#### SUPPORT_CAPWAP_CONTROL START ### if (uci:get('functionlist','functionlist','SUPPORT_HIDE_CHECK_CODE_IN_STATUS') == '1') then -----#### SUPPORT_HIDE_CHECK_CODE_IN_STATUS START ### else %> <% end -----#### SUPPORT_HIDE_CHECK_CODE_IN_STATUS END #### end-----#### SUPPORT_CAPWAP_CONTROL END #### %> <% if uci:get('functionlist','functionlist','SUPPORT_RENEW_STATISTICS_BY_BUTTON') == '1' then -----#### SUPPORT_RENEW_STATISTICS_BY_BUTTON START ### local ntm = require "luci.model.network".init() local fwm = require "luci.model.firewall".init() local net local ifaces = { } local netlist = { } for _, net in ipairs(ntm:get_networks()) do if net:name() ~= "loopback" and net:name() ~= "pptp" and net:name() ~= "l2tp" then --local z = fwm:get_zone_by_network(net:name()) ifaces[#ifaces+1] = net:name() netlist[#netlist+1] = { net:name() } end end if only_eth1_for_lan == '1' then ifaces[#ifaces+1] = "eth1" end --[[ for _, wdev in ipairs(ntm:get_wifidevs()) do local wnet for _, wnet in ipairs(wdev:get_wifinets()) do ifaces[#ifaces+1] = wnet:name() netlist[#netlist+1] = { wnet:name() } luci.sys.exec('echo '.. wnet:name().." >> /tmp/test123") end end ]] table.sort(netlist, function(a, b) return a[1] < b[1] end) %>
onclick='renew_statistics_func_SSID_based();'<% else %>onclick='renew_statistics_func();'<% end %> /> <%:Loading%>
<% end-----#### SUPPORT_RENEW_STATISTICS_BY_BUTTON END #### %> <%+footer%>