diff options
Diffstat (limited to 'applications/luci-app-dawn')
7 files changed, 260 insertions, 0 deletions
diff --git a/applications/luci-app-dawn/Makefile b/applications/luci-app-dawn/Makefile new file mode 100644 index 0000000000..1b2b598cc8 --- /dev/null +++ b/applications/luci-app-dawn/Makefile @@ -0,0 +1,10 @@ +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for DAWN +LUCI_DEPENDS:=+dawn +luci-compat +luci-lib-json +LUCI_PKGARCH:=all + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature + diff --git a/applications/luci-app-dawn/luasrc/controller/dawn.lua b/applications/luci-app-dawn/luasrc/controller/dawn.lua new file mode 100644 index 0000000000..6ba53f13d4 --- /dev/null +++ b/applications/luci-app-dawn/luasrc/controller/dawn.lua @@ -0,0 +1,11 @@ +module("luci.controller.dawn", package.seeall) + +function index() + local e = entry({ "admin", "dawn" }, firstchild(), "DAWN", 60) + e.dependent = false + e.acl_depends = { "luci-app-dawn" } + + entry({ "admin", "dawn", "configure_daemon" }, cbi("dawn/dawn_config"), "Configure DAWN", 1) + entry({ "admin", "dawn", "view_network" }, cbi("dawn/dawn_network"), "View Network Overview", 2) + entry({ "admin", "dawn", "view_hearing_map" }, cbi("dawn/dawn_hearing_map"), "View Hearing Map", 3) +end diff --git a/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_config.lua b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_config.lua new file mode 100644 index 0000000000..b965451b03 --- /dev/null +++ b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_config.lua @@ -0,0 +1,42 @@ +m = Map("dawn", translate("Dawn Configuration"), translate("")) +s = m:section(TypedSection, "metric", "Metric", "Metric"); s.anonymous = true; +s:option(Value, "ht_support", "High Throughput Support") +s:option(Value, "no_ht_support", "No High Throughput Support") +s:option(Value, "vht_support", "Very High Throughput Support") +s:option(Value, "no_vht_support", "No Very High Throughput Support") +s:option(Value, "rssi", "RSSI") +s:option(Value, "low_rssi", "Low RSSI") +s:option(Value, "freq", "5GHz") +s:option(Value, "chan_util", "Channel Utilization") +s:option(Value, "max_chan_util", "Above Maximum Channel Utilization") + +s = m:section(TypedSection, "metric", "Threshold", "Thresholds"); s.anonymous = true; +s:option(Value, "bandwidth_threshold", "Bandwidth Threshold") +s:option(Value, "rssi_val", "RSSI Threshold") +s:option(Value, "low_rssi_val", "Low RSSI Threshold") +s:option(Value, "chan_util_val", "Channel Utilization Threshold") +s:option(Value, "max_chan_util_val", "Maximaum Channel Utilization Threshold") +s:option(Value, "min_probe_count", "Minimum Probe Count") +s:option(Value, "min_number_to_kick", "Minimum Number After Kicking Client") + +s = m:section(TypedSection, "metric", "Evaluate", "What should be evaluated?"); s.anonymous = true; +s:option(Flag, "kicking", "Activate Kicking") +s:option(Flag, "eval_probe_req", "Evaluate Probe Requests") +s:option(Flag, "eval_auth_req", "Evaluate Authentication Requests") +s:option(Flag, "eval_assoc_req", "Evaluate Association Requests") +s:option(Flag, "use_station_count", "Use Station Count") + +s = m:section(TypedSection, "metric", "IEE802.11", "Reasons for denying"); s.anonymous = true; +s:option(Value, "deny_auth_reason", "Denying Authentication") +s:option(Value, "deny_assoc_reason", "Denying Association") + +s = m:section(TypedSection, "times", "Time Configuration", "Time Configs"); s.anonymous = true; +s:option(Value, "update_client", "Update Client Information Interval") +s:option(Value, "denied_req_threshold", "Checking if client is connected") +s:option(Value, "remove_client", "Remove Client Information") +s:option(Value, "remove_probe", "Remove Hearing Map Information") +s:option(Value, "update_hostapd", "Check for new Hostapd Sockets") +s:option(Value, "update_tcp_con", "Check for new Routers") +s:option(Value, "update_chan_util", "Update Channel Utilization Interval") + +return m
\ No newline at end of file diff --git a/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua new file mode 100644 index 0000000000..844fa72c43 --- /dev/null +++ b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_hearing_map.lua @@ -0,0 +1,72 @@ +m = Map("dawn", "Hearing Map", translate("Hearing Map")) +m.pageaction = false + +s = m:section(NamedSection, "__hearingmap__") + +function s.render(self, sid) + local tpl = require "luci.template" + tpl.render_string([[ + <% + local utl = require "luci.util" + local status = require "luci.tools.ieee80211" + local stat = utl.ubus("dawn", "get_hearing_map", { }) + local name, macs + + for name, macs in pairs(stat) do + %> + <div class="cbi-section-node"> + <h3>SSID: <%= name %></h3> + <div class="table" id="dawn_hearing_map"> + <div class="tr table-titles"> + <div class="th">Client MAC</div> + <div class="th">AP MAC</div> + <div class="th">Frequency</div> + <div class="th">HT Sup</div> + <div class="th">VHT Sup</div> + <div class="th">Signal</div> + <div class="th">RCPI</div> + <div class="th">RSNI</div> + <div class="th">Channel Utilization</div> + <div class="th">Station connect to AP</div> + <div class="th">Score</div> + </div> + <% + local mac, data + for mac, data in pairs(macs) do + local mac2, data2 + local count_loop = 0 + + for mac2, data2 in pairs(data) do + %> + <div class="tr"> + <% if (count_loop == 0) then %> + <div class="td"><%= mac %></div> + <% else %> + <div></div> + <% end %> + <div class="td"><%= mac2 %></div> + <div class="td"><%= "%.3f" %( data2.freq / 1000 ) %> GHz Channel: <%= "%d" %( status.frequency_to_channel(data2.freq) ) %></div> + <div class="td"><%= (data2.ht_capabilities == true and data2.ht_support == true) and "True" or "False" %></div> + <div class="td"><%= (data2.vht_capabilities == true and data2.vht_support == true) and "True" or "False" %></div> + <div class="td"><%= "%d" %data2.signal %></div> + <div class="td"><%= "%d" %data2.rcpi %></div> + <div class="td"><%= "%d" %data2.rsni %></div> + <div class="td"><%= "%.2f" %(data2.channel_utilization / 2.55) %> %</div> + <div class="td"><%= "%d" %data2.num_sta %></div> + <div class="td"><%= "%d" %data2.score %></div> + </div> + <% + count_loop = count_loop + 1 + end + end + %> + </div> + </div> + <% + end + %> + </div> + ]]) +end + +return m
\ No newline at end of file diff --git a/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_network.lua b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_network.lua new file mode 100644 index 0000000000..222778162b --- /dev/null +++ b/applications/luci-app-dawn/luasrc/model/cbi/dawn/dawn_network.lua @@ -0,0 +1,96 @@ +m = Map("dawn", "Network Overview", translate("Network Overview")) +m.pageaction = false + +s = m:section(NamedSection, "__networkoverview__") + +function s.render(self, sid) + local tpl = require "luci.template" + local json = require "luci.json" + local utl = require "luci.util" + tpl.render_string([[ + <% + local status = require "luci.tools.ieee80211" + local utl = require "luci.util" + local sys = require "luci.sys" + local hosts = sys.net.host_hints() + local stat = utl.ubus("dawn", "get_network", { }) + local name, macs + for name, macs in pairs(stat) do + %> + + <div class="cbi-section-node"> + <h3>SSID: <%= name %></h3> + <div class="table" id=network_overview_main"> + <div class="tr table-titles"> + <div class="th">AP</div> + <div class="th">Clients</div> + </div> + <% + local mac, data + for mac, data in pairs(macs) do + %> + <div class="tr"> + <div class="td" style="vertical-align: top;"> + <div class="table" id="ap-<%= mac %>"> + <div class="tr table-titles"> + <div class="th">Hostname</div> + <div class="th">Interface</div> + <div class="th">MAC</div> + <div class="th">Utilization</div> + <div class="th">Frequency</div> + <div class="th">Stations</div> + <div class="th">HT Sup</div> + <div class="th">VHT Sup</div> + </div> + <div class="tr"> + <div class="td"><%= data.hostname %></div> + <div class="td"><%= data.iface %></div> + <div class="td"><%= mac %></div> + <div class="td"><%= "%.2f" %(data.channel_utilization / 2.55) %> %</div> + <div class="td"><%= "%.3f" %( data.freq / 1000 ) %> GHz (Channel: <%= "%d" %( status.frequency_to_channel(data.freq) ) %>)</div> + <div class="td"><%= "%d" %data.num_sta %></div> + <div class="td"><%= (data.ht_support == true) and "available" or "not available" %></div> + <div class="td"><%= (data.vht_support == true) and "available" or "not available" %></div> + </div> + </div> + </div> + <div class="td" style="vertical-align: top;"> + <div class="table" id="clients-<%= mac %>"> + <div class="tr table-titles"> + <div class="th">MAC</div> + <div class="th">HT</div> + <div class="th">VHT</div> + <div class="th">Signal</div> + </div> + <% + local mac2, data2 + for clientmac, clientvals in pairs(data) do + if (type(clientvals) == "table") then + %> + <div class="tr"> + <div class="td"><%= clientmac %></div> + <div class="td"><%= (clientvals.ht == true) and "available" or "not available" %></div> + <div class="td"><%= (clientvals.vht == true) and "available" or "not available" %></div> + <div class="td"><%= "%d" %clientvals.signal %></div> + </div> + <% + end + %> + <% + end + %> + </div> + </div> + </div> + <% + end + %> + </div> + </div> + <% + end + %> + ]]) +end + +return m diff --git a/applications/luci-app-dawn/luasrc/tools/ieee80211.lua b/applications/luci-app-dawn/luasrc/tools/ieee80211.lua new file mode 100644 index 0000000000..b35991ed7d --- /dev/null +++ b/applications/luci-app-dawn/luasrc/tools/ieee80211.lua @@ -0,0 +1,18 @@ +module("luci.tools.ieee80211", package.seeall) + +function frequency_to_channel(freq) + if (freq == 2484) then + return 14; + elseif (freq < 2484) then + return (freq - 2407) / 5; + elseif (freq >= 4910 and freq <= 4980) then + return (freq - 4000) / 5; + elseif (freq <= 45000) then + return (freq - 5000) / 5; + elseif (freq >= 58320 and freq <= 64800) then + return (freq - 56160) / 2160; + else + return 0; + end +end + diff --git a/applications/luci-app-dawn/root/usr/share/rpcd/acl.d/luci-app-dawn.json b/applications/luci-app-dawn/root/usr/share/rpcd/acl.d/luci-app-dawn.json new file mode 100644 index 0000000000..4fece64a86 --- /dev/null +++ b/applications/luci-app-dawn/root/usr/share/rpcd/acl.d/luci-app-dawn.json @@ -0,0 +1,11 @@ +{ + "luci-app-dawn": { + "description": "Grant UCI access for luci-app-dawn", + "read": { + "uci": [ "dawn" ] + }, + "write": { + "uci": [ "dawn" ] + } + } +} |