Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-gluon
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ffbs
ffbs-gluon
Commits
423aafbd
Commit
423aafbd
authored
7 years ago
by
Martin Weinelt
Browse files
Options
Downloads
Patches
Plain Diff
gluon-core: improve channel and add chanlist validation
parent
bf552491
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package/gluon-core/check_site.lua
+11
-3
11 additions, 3 deletions
package/gluon-core/check_site.lua
scripts/check_site.lua
+33
-0
33 additions, 0 deletions
scripts/check_site.lua
with
44 additions
and
3 deletions
package/gluon-core/check_site.lua
+
11
−
3
View file @
423aafbd
...
...
@@ -33,9 +33,17 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
if
need_table
({
config
},
nil
,
false
)
then
need_string
(
in_site
({
'regdom'
}))
-- regdom is only required when wifi24 or wifi5 is configured
need_number
({
config
,
'channel'
})
if
config
==
'wifi5'
then
need_string_match
({
config
,
'outdoor_chanlist'
},
'^[%d%s-]+$'
,
false
)
if
config
==
"wifi24"
then
local
channels
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
}
need_one_of
({
config
,
'channel'
},
channels
)
elseif
config
==
'wifi5'
then
local
channels
=
{
34
,
36
,
38
,
40
,
42
,
44
,
46
,
48
,
50
,
52
,
54
,
56
,
58
,
60
,
62
,
64
,
96
,
100
,
102
,
104
,
106
,
108
,
110
,
112
,
114
,
116
,
118
,
120
,
122
,
124
,
126
,
128
,
132
,
134
,
136
,
138
,
140
,
142
,
144
,
149
,
151
,
153
,
155
,
157
,
159
,
161
,
165
,
169
,
173
}
need_one_of
({
config
,
'channel'
},
channels
)
need_chanlist
({
config
,
'outdoor_chanlist'
},
channels
,
false
)
end
obsolete
({
config
,
'supported_rates'
},
'802.11b rates are disabled by default.'
)
...
...
This diff is collapsed.
Click to expand it.
scripts/check_site.lua
+
33
−
0
View file @
423aafbd
...
...
@@ -203,6 +203,33 @@ function alternatives(...)
end
local
function
check_chanlist
(
channels
)
local
is_valid_channel
=
check_one_of
(
channels
)
return
function
(
chanlist
)
for
group
in
chanlist
:
gmatch
(
"%S+"
)
do
if
group
:
match
(
"^%d+$"
)
then
channel
=
tonumber
(
group
)
if
not
is_valid_channel
(
channel
)
then
return
false
end
elseif
group
:
match
(
"^%d+-%d+$"
)
then
from
,
to
=
group
:
match
(
"^(%d+)-(%d+)$"
)
from
=
tonumber
(
from
)
to
=
tonumber
(
to
)
if
from
>=
to
then
return
false
end
if
not
is_valid_channel
(
from
)
or
not
is_valid_channel
(
to
)
then
return
false
end
else
return
false
end
end
return
true
end
end
function
need
(
path
,
check
,
required
,
msg
)
local
val
=
loadvar
(
path
)
if
required
==
false
and
val
==
nil
then
...
...
@@ -307,6 +334,12 @@ function need_array_of(path, array, required)
return
need_array
(
path
,
function
(
e
)
need_one_of
(
e
,
array
)
end
,
required
)
end
function
need_chanlist
(
path
,
channels
,
required
)
local
valid_chanlist
=
check_chanlist
(
channels
)
return
need
(
path
,
valid_chanlist
,
required
,
'be a space-separated list of WiFi channels or channel-ranges (separated by a hyphen). '
..
'Valid channels are: '
..
array_to_string
(
channels
))
end
function
need_domain_name
(
path
)
need_string
(
path
)
need
(
path
,
function
(
domain_name
)
...
...
This diff is collapsed.
Click to expand it.
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