local has_wifi = false
-
+
uci:foreach("wireless", "wifi-device",
function(s)
has_wifi = true
return false
end)
-
+
if has_wifi then
page = entry({"admin", "network", "wireless_join"}, call("wifi_join"), nil)
page.leaf = true
local wnet = ntm:get_wifinet(network)
if wnet then
local dev = wnet:get_device()
- local net = wnet:get_network()
+ local nets = wnet:get_networks()
if dev then
luci.sys.call("env -i /sbin/wifi down %q >/dev/null" % dev:name())
ntm:del_wifinet(network)
ntm:commit("wireless")
- if net and net:is_empty() then
- ntm:del_network(net:name())
- ntm:commit("network")
+ local _, net
+ for _, net in ipairs(nets) do
+ if net:is_empty() then
+ ntm:del_network(net:name())
+ ntm:commit("network")
+ end
end
luci.sys.call("env -i /sbin/wifi up %q >/dev/null" % dev:name())
end
}
end
for _, a in ipairs(device:ip6addrs()) do
- data.ip6addrs[#data.ip6addrs+1] = {
- addr = a:host():string(),
- netmask = a:mask():string(),
- prefix = a:prefix()
- }
+ if not a:is6linklocal() then
+ data.ip6addrs[#data.ip6addrs+1] = {
+ addr = a:host():string(),
+ netmask = a:mask():string(),
+ prefix = a:prefix()
+ }
+ end
end
for _, device in ipairs(net:get_interfaces() or {}) do
local s = require "luci.tools.status"
luci.http.prepare_content("application/json")
+ luci.http.write('[')
luci.http.write_json(s.dhcp_leases())
+ luci.http.write(',')
+ luci.http.write_json(s.dhcp6_leases())
+ luci.http.write(']')
end
function diag_command(cmd)