|
|
@@ -128,6 +128,7 @@ local function get_hostapd_interfaces()
|
|
|
end
|
|
|
f:close()
|
|
|
end
|
|
|
+ log_info("hostapd interfaces: " .. table.concat(interfaces, ", "))
|
|
|
return interfaces
|
|
|
end
|
|
|
|
|
|
@@ -157,13 +158,16 @@ local function get_all_ssids()
|
|
|
local result = f:read("*a")
|
|
|
f:close()
|
|
|
local current_iface = nil
|
|
|
+ log_info("iw dev output: " .. result:sub(1, 200))
|
|
|
for line in result:gmatch("[^\n]+") do
|
|
|
- local iface = line:match("Interface%s+(wlan%d-%d)")
|
|
|
+ -- Match ANY wlan interface (wlan0, wlan0-1, wlan1, etc.)
|
|
|
+ local iface = line:match("Interface%s+(wlan%d[^%s]*)")
|
|
|
if iface then current_iface = iface end
|
|
|
local ssid = line:match("ssid%s+(.+)")
|
|
|
if ssid and current_iface then
|
|
|
local hostapd_iface = "hostapd." .. current_iface
|
|
|
ssids[hostapd_iface] = { enabled = true, ssid = ssid }
|
|
|
+ log_info("SSID found: " .. ssid .. " on " .. hostapd_iface)
|
|
|
end
|
|
|
end
|
|
|
end
|
|
|
@@ -181,10 +185,12 @@ local function get_wifi_clients()
|
|
|
|
|
|
local count = 0
|
|
|
for _, iface in ipairs(interfaces) do
|
|
|
+ log_info("Querying WiFi clients on: " .. iface)
|
|
|
local f = io.popen("ubus call " .. iface .. " get_clients 2>/dev/null")
|
|
|
if f then
|
|
|
local result = f:read("*a")
|
|
|
f:close()
|
|
|
+ log_info(iface .. " clients result: " .. result:sub(1, 200))
|
|
|
if result:find('"clients"') and not result:find('"clients":%s*{}') then
|
|
|
local mac_count = 0
|
|
|
for mac in result:gmatch('([a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9]:[a-fA-F0-9][a-fA-F0-9])') do
|
|
|
@@ -197,6 +203,7 @@ local function get_wifi_clients()
|
|
|
end
|
|
|
end
|
|
|
end
|
|
|
+ log_info("Total WiFi clients found: " .. count)
|
|
|
return clients
|
|
|
end
|
|
|
|