Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gluon-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nico
gluon-test
Commits
89a9d813
Commit
89a9d813
authored
9 years ago
by
Jan-Philipp Litza
Browse files
Options
Downloads
Patches
Plain Diff
gluon-mesh-batman-adv-core: Announce client count by frequency
parent
4405f398
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-mesh-batman-adv-core/files/lib/gluon/announce/statistics.d/clients
+43
-8
43 additions, 8 deletions
...an-adv-core/files/lib/gluon/announce/statistics.d/clients
with
43 additions
and
8 deletions
package/gluon-mesh-batman-adv-core/files/lib/gluon/announce/statistics.d/clients
+
43
−
8
View file @
89a9d813
local list = io.lines("/sys/kernel/debug/batman_adv/bat0/transtable_local")
local iwinfo = require 'iwinfo'
local counts = { total = 0
, wifi = 0
, wifi24 = 0
, wifi5 = 0
}
local
count = 0
local
wifi
=
0
local
list = io.lines("/sys/kernel/debug/batman_adv/bat0/transtable_local")
local
clients
=
{}
for line in list do
local mac, _, flags, lastseen = line:match("^ %* ([0-9a-f:]+) *(.- )%[(.-)%] +(%d+%.%d+)")
if mac then
if not flags:match('P') then
count = count + 1
counts.total = counts.total + 1
clients[mac:lower()] = true
if flags:match('W') then
wifi =
wifi +1
counts.wifi = counts.
wifi +1
end
end
end
end
return { total = count
, wifi = wifi
}
function count_iface_stations(iface)
local wifitype = iwinfo.type(iface)
if wifitype == nil then
return
end
local freq = iwinfo[wifitype].frequency(iface)
local key
if freq >= 2400 and freq < 2500 then
key = "wifi24"
elseif freq >= 5000 and freq < 6000 then
key = "wifi5"
else
return
end
for k, v in pairs(iwinfo[wifitype].assoclist(iface)) do
if clients[k:lower()] then
counts[key] = counts[key] + 1
end
end
end
local ifaces = {}
uci:foreach("wireless", "wifi-iface", function(s)
if s.network == "client" and s.mode == "ap" then
count_iface_stations(s.ifname)
end
end)
return counts
This diff is collapsed.
Click to expand it.
Nico
@nrb
mentioned in commit
0924074a
·
5 years ago
mentioned in commit
0924074a
mentioned in commit 0924074a34057b94f27fb6c5b7c15e30c8af0d4b
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment