8 years agoMerge branch 'upstream_master' master R8.6 R8.6_SP1 R8.6_compat R8.7 R8.7_ED R8.7_SP1 R8.7_SP2 R8.7_SP3 ol_r8.a9.23 ol_r8.a9.24 ol_r8.a9.25 ol_r8.a9.26 ol_r8.a9.27 ol_r8.a9.28
Merge branch 'upstream_master'
crda: Trust regulatory.bin from Seth Forshee
I have taken over maintenance of the regulatory database from
linville. Add my key so that regulatory.bin files signed by me
will be trusted, but also keep John's key so that existing files
will continue to be trusted. Update the makefile to point to the
new wireless-regdb repository location, and update the readme and
man page to reflect the change in maintainership.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
I have taken over maintenance of the regulatory database from
linville. Add my key so that regulatory.bin files signed by me
will be trusted, but also keep John's key so that existing files
will continue to be trusted. Update the makefile to point to the
new wireless-regdb repository location, and update the readme and
man page to reflect the change in maintainership.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: db2rd, parse/print CAC time
db2rd, parse and print DFS CAC time
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
db2rd, parse and print DFS CAC time
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: simplify text parsing for country/rules
Remove strange parsers.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Remove strange parsers.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: add AUTO-BW rule flag support
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: sync with latest nl80211.h
Sync with latest nl80211.h wireless-testing.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Sync with latest nl80211.h wireless-testing.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
9 years agoLink against libdl as well R8.4 R8.5 R8.5_v3.18 ol_r8.a9.13 ol_r8.a9.14 ol_r8.a9.15 ol_r8.a9.16 ol_r8.a9.17 ol_r8.a9.18 ol_r8.a9.19 ol_r8.a9.20 ol_r8.a9.21 ol_r8.a9.22
Link against libdl as well
some toolchanins complain otherwise
Signed-off-by: Eliad Peller <eliad@wizery.com>
some toolchanins complain otherwise
Signed-off-by: Eliad Peller <eliad@wizery.com>
allow building crda statically
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Makefile: Don't use ldconfig
Don't use ldconfig
Signed-off-by: Guy Mishol <guym@ti.com>
Don't use ldconfig
Signed-off-by: Guy Mishol <guym@ti.com>
Makefile: don't use -Werror (TEMP)
keys-ssl.c has hardcoded 8-bytes keys which
are stored into ULONG. this triggers warnings
in 32-bit systems...
workaround it for now.
Signed-off-by: Eliad Peller <eliad@wizery.com>
keys-ssl.c has hardcoded 8-bytes keys which
are stored into ULONG. this triggers warnings
in 32-bit systems...
workaround it for now.
Signed-off-by: Eliad Peller <eliad@wizery.com>
crda: Makefile: don't compile keys-ssl.c
keys-ssl.c is included in reglib.c, so no need
to compile it explicitly (this actually causes
compilation error as BN_ULONG is not defined
in keys-ssl.c itself.
Solve it by making reglib.c (instead of LIBREG)
dependent on keys-ssl.c, and while on it
change LIBREG compilation to compile only
the relevant .c file.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Guy Mishol <guym@ti.com>
keys-ssl.c is included in reglib.c, so no need
to compile it explicitly (this actually causes
compilation error as BN_ULONG is not defined
in keys-ssl.c itself.
Solve it by making reglib.c (instead of LIBREG)
dependent on keys-ssl.c, and while on it
change LIBREG compilation to compile only
the relevant .c file.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Guy Mishol <guym@ti.com>
crda: Add DESTDIR support in install-libreg* rules in Makefile
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: Fix the linking order to avoid compilation error
While linking the crda.o and libreg.so, first put crda.o
and then -lreg. This fixed the below error:
GEN keys-gcrypt.c
Trusted pubkeys: pubkeys/linville.key.pub.pem
CC libreg.so
CC crda.o
LD crda
crda.o: In function `main':
crda/crda.c:196: undefined reference to `reglib_get_rd_alpha2'
collect2: ld returned 1 exit status
make: *** [crda] Error 1
Note: This still doesn't fix the below error (will send another mail)
CHK /usr/lib/crda/regulatory.bin
Database signature verification failed.
Invalid or empty regulatory file, note: a binary regulatory file should be used.
make: *** [verify] Error 234
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
While linking the crda.o and libreg.so, first put crda.o
and then -lreg. This fixed the below error:
GEN keys-gcrypt.c
Trusted pubkeys: pubkeys/linville.key.pub.pem
CC libreg.so
CC crda.o
LD crda
crda.o: In function `main':
crda/crda.c:196: undefined reference to `reglib_get_rd_alpha2'
collect2: ld returned 1 exit status
make: *** [crda] Error 1
Note: This still doesn't fix the below error (will send another mail)
CHK /usr/lib/crda/regulatory.bin
Database signature verification failed.
Invalid or empty regulatory file, note: a binary regulatory file should be used.
make: *** [verify] Error 234
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
crda: document contribution process using the DCO
This documents the contribution process for CRDA, which makes
use of the Developer Certificate of Origin:
http://developercertificate.org/
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This documents the contribution process for CRDA, which makes
use of the Developer Certificate of Origin:
http://developercertificate.org/
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
reglib: fix memset usage
gcc-4.8 fails to compile reglib due to:
reglib.c:1133:22: error: argument to ‘sizeof’ in ‘memset’ call is
the same expression as the destination; did you mean
to dereference it? [-Werror=sizeof-pointer-memaccess]
memset(rd, 0, sizeof(rd));
^
reglib.c:1155:22: error: argument to ‘sizeof’ in... (same as above)
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
gcc-4.8 fails to compile reglib due to:
reglib.c:1133:22: error: argument to ‘sizeof’ in ‘memset’ call is
the same expression as the destination; did you mean
to dereference it? [-Werror=sizeof-pointer-memaccess]
memset(rd, 0, sizeof(rd));
^
reglib.c:1155:22: error: argument to ‘sizeof’ in... (same as above)
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: make reglib a shared library
Now that we have quite a few helpers this puts the more
valuable helpers into a library.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Now that we have quite a few helpers this puts the more
valuable helpers into a library.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: make ssl keys include stdint.h
This is required to fix compilation if we
move reglig to its own library.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This is required to fix compilation if we
move reglig to its own library.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: add regulatory domain optimizer
This adds a regulatory domain optimizer which can be
used with information of a regulatory domain in db.txt
format in stdin. It makes use of the new shiny regulatory
domain stream parser.
The way this works is it iterates over the regulatory domain
computing unions between each frequency, starting from each
frequency as a pivot. If a union leads to a valid regulatory
rule we verify that the pivot and othre frequency rules that
provided that valid union can fit into that union regulatory
rule by computing an intersection. If an intersection is
possible it means two rules can be optimized out. We do
this repetitively.
Note: cfg80211's nl80211.h API has:
#define NL80211_MAX_SUPP_REG_RULES 32
Our tools, both the stream parser and the optimizer are not
limited to these artificial limits ! We can work on extending
the kernel's limit but so far we have had no needs. A few
notes below though on the existing reasoning for the limit
and possible future enhancements.
This is used nl80211_set_reg() upon intercept of a regulatory
domain being sent from userspace to it. We picked a limitation
to at least have a stopping gap to avoid userpace flooding the
kernel with a denial of service requests on memory from userspace.
This means that userspace can only request at most a kmalloc
of up to 32 regulatory rules for processing for the regulatory
data that we are copying from userspace. There's a Linux kernel
enhancement that will be made soon so that we invalidate bogus
requests, by checking to see if the incomming regulatory domain
alpha2 was not expected upon a regulatory hint initiator (even
if userspace first tells the kernel it is waiting for a response
from kernel space), and if its invalid then we drop the userspace
supplied request, therefore avoiding some form of flooding on
memory to the kernel.
Note that we can still get flooding if the userspace API is used
to *request* to the kernel for a regulatory domain to be sent
from userspace, in that case the kernel will properly expect the
regulatory data for the alpha2. To prevent flooding there perhaps
its a good idea for us to check whether a userspace pending request
is pendingg and if so deny new updates until the last one triggers
a timeout.
Screenshot for a US file with 40 rules:
mcgrof@frijol ~/devel/xlreg (git::master)$ cat us | grep --"(" | wc -l
40
mcgrof@frijol ~/devel/crda (git::master)$ cat us
country US: DFS-FCC
(2402.000 - 2422.000 @ 20.000), (30.00)
(2407.000 - 2427.000 @ 20.000), (30.00)
(2412.000 - 2432.000 @ 20.000), (30.00)
(2417.000 - 2437.000 @ 20.000), (30.00)
(2422.000 - 2442.000 @ 20.000), (30.00)
(2427.000 - 2447.000 @ 20.000), (30.00)
(2432.000 - 2452.000 @ 20.000), (30.00)
(2437.000 - 2457.000 @ 20.000), (30.00)
(2442.000 - 2462.000 @ 20.000), (30.00)
(2447.000 - 2467.000 @ 20.000), (30.00)
(2452.000 - 2472.000 @ 20.000), (30.00)
(2402.000 - 2442.000 @ 40.000), (30.00)
(2407.000 - 2447.000 @ 40.000), (30.00)
(2412.000 - 2452.000 @ 40.000), (30.00)
(2417.000 - 2457.000 @ 40.000), (30.00)
(2422.000 - 2462.000 @ 40.000), (30.00)
(2427.000 - 2467.000 @ 40.000), (30.00)
(2432.000 - 2472.000 @ 40.000), (30.00)
(5170.000 - 5190.000 @ 20.000), (17.00)
(5190.000 - 5210.000 @ 20.000), (17.00)
(5210.000 - 5230.000 @ 20.000), (17.00)
(5230.000 - 5250.000 @ 20.000), (17.00)
(5250.000 - 5270.000 @ 20.000), (23.00), DFS
(5270.000 - 5290.000 @ 20.000), (23.00), DFS
(5290.000 - 5310.000 @ 20.000), (23.00), DFS
(5310.000 - 5330.000 @ 20.000), (23.00), DFS
(5735.000 - 5755.000 @ 20.000), (30.00)
(5755.000 - 5775.000 @ 20.000), (30.00)
(5775.000 - 5795.000 @ 20.000), (30.00)
(5795.000 - 5815.000 @ 20.000), (30.00)
(5815.000 - 5835.000 @ 20.000), (30.00)
(5170.000 - 5210.000 @ 40.000), (17.00)
(5210.000 - 5250.000 @ 40.000), (17.00)
(5250.000 - 5290.000 @ 40.000), (23.00), DFS
(5290.000 - 5330.000 @ 40.000), (23.00), DFS
(5735.000 - 5775.000 @ 40.000), (30.00)
(5775.000 - 5815.000 @ 40.000), (30.00)
(5170.000 - 5250.000 @ 80.000), (17.00)
(5250.000 - 5330.000 @ 80.000), (23.00), DFS
(5735.000 - 5815.000 @ 80.000), (30.00)
mcgrof@frijol ~/devel/crda (git::master)$ cat us | ./optimize
country US: DFS-FCC
(2402.000 - 2472.000 @ 40.000), (30.00)
(5170.000 - 5250.000 @ 80.000), (17.00)
(5250.000 - 5330.000 @ 80.000), (23.00), DFS
(5735.000 - 5835.000 @ 80.000), (30.00)
I've also tested this with the current db.txt from wireless-regdb
and get real optimiziations which I will post later.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This adds a regulatory domain optimizer which can be
used with information of a regulatory domain in db.txt
format in stdin. It makes use of the new shiny regulatory
domain stream parser.
The way this works is it iterates over the regulatory domain
computing unions between each frequency, starting from each
frequency as a pivot. If a union leads to a valid regulatory
rule we verify that the pivot and othre frequency rules that
provided that valid union can fit into that union regulatory
rule by computing an intersection. If an intersection is
possible it means two rules can be optimized out. We do
this repetitively.
Note: cfg80211's nl80211.h API has:
#define NL80211_MAX_SUPP_REG_RULES 32
Our tools, both the stream parser and the optimizer are not
limited to these artificial limits ! We can work on extending
the kernel's limit but so far we have had no needs. A few
notes below though on the existing reasoning for the limit
and possible future enhancements.
This is used nl80211_set_reg() upon intercept of a regulatory
domain being sent from userspace to it. We picked a limitation
to at least have a stopping gap to avoid userpace flooding the
kernel with a denial of service requests on memory from userspace.
This means that userspace can only request at most a kmalloc
of up to 32 regulatory rules for processing for the regulatory
data that we are copying from userspace. There's a Linux kernel
enhancement that will be made soon so that we invalidate bogus
requests, by checking to see if the incomming regulatory domain
alpha2 was not expected upon a regulatory hint initiator (even
if userspace first tells the kernel it is waiting for a response
from kernel space), and if its invalid then we drop the userspace
supplied request, therefore avoiding some form of flooding on
memory to the kernel.
Note that we can still get flooding if the userspace API is used
to *request* to the kernel for a regulatory domain to be sent
from userspace, in that case the kernel will properly expect the
regulatory data for the alpha2. To prevent flooding there perhaps
its a good idea for us to check whether a userspace pending request
is pendingg and if so deny new updates until the last one triggers
a timeout.
Screenshot for a US file with 40 rules:
mcgrof@frijol ~/devel/xlreg (git::master)$ cat us | grep --"(" | wc -l
40
mcgrof@frijol ~/devel/crda (git::master)$ cat us
country US: DFS-FCC
(2402.000 - 2422.000 @ 20.000), (30.00)
(2407.000 - 2427.000 @ 20.000), (30.00)
(2412.000 - 2432.000 @ 20.000), (30.00)
(2417.000 - 2437.000 @ 20.000), (30.00)
(2422.000 - 2442.000 @ 20.000), (30.00)
(2427.000 - 2447.000 @ 20.000), (30.00)
(2432.000 - 2452.000 @ 20.000), (30.00)
(2437.000 - 2457.000 @ 20.000), (30.00)
(2442.000 - 2462.000 @ 20.000), (30.00)
(2447.000 - 2467.000 @ 20.000), (30.00)
(2452.000 - 2472.000 @ 20.000), (30.00)
(2402.000 - 2442.000 @ 40.000), (30.00)
(2407.000 - 2447.000 @ 40.000), (30.00)
(2412.000 - 2452.000 @ 40.000), (30.00)
(2417.000 - 2457.000 @ 40.000), (30.00)
(2422.000 - 2462.000 @ 40.000), (30.00)
(2427.000 - 2467.000 @ 40.000), (30.00)
(2432.000 - 2472.000 @ 40.000), (30.00)
(5170.000 - 5190.000 @ 20.000), (17.00)
(5190.000 - 5210.000 @ 20.000), (17.00)
(5210.000 - 5230.000 @ 20.000), (17.00)
(5230.000 - 5250.000 @ 20.000), (17.00)
(5250.000 - 5270.000 @ 20.000), (23.00), DFS
(5270.000 - 5290.000 @ 20.000), (23.00), DFS
(5290.000 - 5310.000 @ 20.000), (23.00), DFS
(5310.000 - 5330.000 @ 20.000), (23.00), DFS
(5735.000 - 5755.000 @ 20.000), (30.00)
(5755.000 - 5775.000 @ 20.000), (30.00)
(5775.000 - 5795.000 @ 20.000), (30.00)
(5795.000 - 5815.000 @ 20.000), (30.00)
(5815.000 - 5835.000 @ 20.000), (30.00)
(5170.000 - 5210.000 @ 40.000), (17.00)
(5210.000 - 5250.000 @ 40.000), (17.00)
(5250.000 - 5290.000 @ 40.000), (23.00), DFS
(5290.000 - 5330.000 @ 40.000), (23.00), DFS
(5735.000 - 5775.000 @ 40.000), (30.00)
(5775.000 - 5815.000 @ 40.000), (30.00)
(5170.000 - 5250.000 @ 80.000), (17.00)
(5250.000 - 5330.000 @ 80.000), (23.00), DFS
(5735.000 - 5815.000 @ 80.000), (30.00)
mcgrof@frijol ~/devel/crda (git::master)$ cat us | ./optimize
country US: DFS-FCC
(2402.000 - 2472.000 @ 40.000), (30.00)
(5170.000 - 5250.000 @ 80.000), (17.00)
(5250.000 - 5330.000 @ 80.000), (23.00), DFS
(5735.000 - 5835.000 @ 80.000), (30.00)
I've also tested this with the current db.txt from wireless-regdb
and get real optimiziations which I will post later.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: add regulatory domain stream parser
This adds a stream parser for regulatory domains. This
allows developers to build regulatory domains now using
the db.txt from a stream, either stdin, or a from an
opened file.
This also adds a simple db2rd which for now only uses the
library but with a bit of effort can also be used as a
suitable replacement for the kernel's genregdb.awk.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This adds a stream parser for regulatory domains. This
allows developers to build regulatory domains now using
the db.txt from a stream, either stdin, or a from an
opened file.
This also adds a simple db2rd which for now only uses the
library but with a bit of effort can also be used as a
suitable replacement for the kernel's genregdb.awk.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: fix -pedantic gcc compilation
gcc likes to complain about this, fix that as we're
going to get a bit more anal with code here soon as
we're moving towards making a library out of reglib.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
gcc likes to complain about this, fix that as we're
going to get a bit more anal with code here soon as
we're moving towards making a library out of reglib.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: relicense under copyleft-next-0.3.0
I'm relicensing CRDA to copyleft-next-0.3.0. The original
motivation was to help with the BSD family but they are not
using any of this software and as this software grows I'd
like to ensure we use the best free software license
possible.
Fontana's work on copyleft-next is great and has good
community traction. At this point development for
copyleft-next has slowed down as copyleft-next-0.3.0
is already a good, usable alternative to GPLv2 and GPLv3.
A few notes:
* With copyleft we don't have to specify 'at your option
any later version' since the license allows that by
default.
* Some folks might wonder if copyleft-next-0.3.0 is
OSI OSD-conformant or FSF-free since neither of
those bodies have examined the license officially,
but note, although IANAL, that copyleft-next is
outbound-compatible with GPLv2 and GPLv3
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
I'm relicensing CRDA to copyleft-next-0.3.0. The original
motivation was to help with the BSD family but they are not
using any of this software and as this software grows I'd
like to ensure we use the best free software license
possible.
Fontana's work on copyleft-next is great and has good
community traction. At this point development for
copyleft-next has slowed down as copyleft-next-0.3.0
is already a good, usable alternative to GPLv2 and GPLv3.
A few notes:
* With copyleft we don't have to specify 'at your option
any later version' since the license allows that by
default.
* Some folks might wonder if copyleft-next-0.3.0 is
OSI OSD-conformant or FSF-free since neither of
those bodies have examined the license officially,
but note, although IANAL, that copyleft-next is
outbound-compatible with GPLv2 and GPLv3
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: remove antenna gain
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: consolidate passive-scan and no-ibss flags
We consolidate these two flags into one flag to indicate
initiating radiation is not allowed.
For parsing we'll treat the no-ibss flag moving forward
as also passive-scan as well, newer kernels will always
treat these equally, older kernels will use the still
use them separately even though in practice they are
used together interchangably.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
We consolidate these two flags into one flag to indicate
initiating radiation is not allowed.
For parsing we'll treat the no-ibss flag moving forward
as also passive-scan as well, newer kernels will always
treat these equally, older kernels will use the still
use them separately even though in practice they are
used together interchangably.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
reglib: add reglib_is_valid_rd() and verify data upon build
This will verify the sanity of a regulatory domain upon build
time. This is useful if you are making modifications to
wireless-regdb and need to verify the regulatory domains
won't be rejected by a similar checker. In the case of the
Linux kernel regulatory domain data structures that get
a complaint would have been rejected completely.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This will verify the sanity of a regulatory domain upon build
time. This is useful if you are making modifications to
wireless-regdb and need to verify the regulatory domains
won't be rejected by a similar checker. In the case of the
Linux kernel regulatory domain data structures that get
a complaint would have been rejected completely.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
reglib: Validate all structure and array lengths
Add checks that:
- Signature length does not exceed the file length (this was already
checked, but did not account for signature lengths greater than 2 GB)
- Database length is long enough for all structures we expect in it
- Array length calculations will not overflow
To keep these checks simple, change the types of array length and index
variables to unsigned int (must be at least 32-bit, matching the file
format) and the types of byte-length variables to size_t.
Alexandre Rebert <alexandre@cmu.edu> reported and provided a test case
for the signature length issue; the others I found by inspection.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Add checks that:
- Signature length does not exceed the file length (this was already
checked, but did not account for signature lengths greater than 2 GB)
- Database length is long enough for all structures we expect in it
- Array length calculations will not overflow
To keep these checks simple, change the types of array length and index
variables to unsigned int (must be at least 32-bit, matching the file
format) and the types of byte-length variables to size_t.
Alexandre Rebert <alexandre@cmu.edu> reported and provided a test case
for the signature length issue; the others I found by inspection.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: make reglib_for_each_country() use the reglib context
This allows users of reglib to iterate over the regdb
with just one open() and mmap() to be kept sharing as
much code as possible. This makes the regdbdump and
intersection code use the context therefore sharing
all that boiler plate code.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This allows users of reglib to iterate over the regdb
with just one open() and mmap() to be kept sharing as
much code as possible. This makes the regdbdump and
intersection code use the context therefore sharing
all that boiler plate code.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: pass struct reglib_regdb_ctx to country2rd()
This consolidates the number of arguments.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This consolidates the number of arguments.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: add reglib regdb context helpers: reglib_(malloc|free)_regdb_ctx()
These are used to allow users of reglib to instantiate a
reglib context to be used with reglib without having to
always open the regdb, mmap() it and verify it. It also
allows us to tuck away all that magic from users and put
the responsibility on reglib to do all the sanity work
for users.
To start with consolidate with two users:
reglib_get_rd_idx() and reglib_get_rd_alpha2()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
These are used to allow users of reglib to instantiate a
reglib context to be used with reglib without having to
always open the regdb, mmap() it and verify it. It also
allows us to tuck away all that magic from users and put
the responsibility on reglib to do all the sanity work
for users.
To start with consolidate with two users:
reglib_get_rd_idx() and reglib_get_rd_alpha2()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: move regdbprint to its own helper
We'll later move this to reglib but first we have
to clean up the print utility to make it more general.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
We'll later move this to reglib but first we have
to clean up the print utility to make it more general.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: move reglib_intersect_regdb() to reglib
There are no functional changes in this change.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
There are no functional changes in this change.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: separate intersecting a full db into a helper
This should make it easier to review the code and allow
us to stuff it next into reglib. This has no real functional
changes except that of returning NULL in case of any failure
while reading the regdb.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This should make it easier to review the code and allow
us to stuff it next into reglib. This has no real functional
changes except that of returning NULL in case of any failure
while reading the regdb.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: clarify intersect.c only computes an intersection
World regulatory domains should deal with passive scan
flags to account for gaps in the frequency spectrum that
some countries do not rely on but some APs / Cell towers
could be relied upon for determining location.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
World regulatory domains should deal with passive scan
flags to account for gaps in the frequency spectrum that
some countries do not rely on but some APs / Cell towers
could be relied upon for determining location.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: fix spacing on reglib_for_each_country()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename min() to reglib_min()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename max() to reglib_max()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename is_valid_regdom() to reglib_is_valid_regdom()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename is_alpha2() to reglib_is_alpha2()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename isalpha_upper() to reglib_isalpha_upper()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename is_world_regdom() to reglib_is_world_regdom()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: move reg print helpers to reglib
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: make print-regdom use internal flags
Do not rely on nl80211.h for general regulatory db parsing.
Its best to use our own OS agnostic definitions.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Do not rely on nl80211.h for general regulatory db parsing.
Its best to use our own OS agnostic definitions.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: add regdb_dfs_regions
These are already in dbparse.py. As it stands silicon
vendor DFS solutions group up DFS compliance requirements
into three categorical groups. Each country that requires
DFS has opted to follow one type of group category set
of rules.
CRDA was already reading the DFS regions but using
nl80211.h definitions for its parsing and printing of
these flags, its best to use our own OS agnostic
definitions.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
These are already in dbparse.py. As it stands silicon
vendor DFS solutions group up DFS compliance requirements
into three categorical groups. Each country that requires
DFS has opted to follow one type of group category set
of rules.
CRDA was already reading the DFS regions but using
nl80211.h definitions for its parsing and printing of
these flags, its best to use our own OS agnostic
definitions.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename print_regdom() to reglib_print_regdom()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename crda_verify_db_signature() to reglib_verify_db_signature()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename crda_get_file_ptr() to reglib_get_file_ptr()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename regdom_intersect() to reglib_intersect_rds()
This fits more in line with the reglib prefix usage.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This fits more in line with the reglib prefix usage.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: remove verbosity out of intersect.c
No need for such much verbosity, additionally,
we'll move this eventually to reglib.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
No need for such much verbosity, additionally,
we'll move this eventually to reglib.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename world and prev_world on intersect.c
The assumption was that intersect.c was creating a world
regulatory domain for by doing an intersection of all
regulatory domains. This is technically still true however
it does not add passive scan flag'd frequency ranges and
as such to be precise lets just rename the "world" and
"prev_world" variables as intersection variables.
This change introduces no functional changes.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
The assumption was that intersect.c was creating a world
regulatory domain for by doing an intersection of all
regulatory domains. This is technically still true however
it does not add passive scan flag'd frequency ranges and
as such to be precise lets just rename the "world" and
"prev_world" variables as intersection variables.
This change introduces no functional changes.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: use gcry_mpi_release() when using gcry_mpi_scan()
Its not well documented you should do this but I found out
through valgrind. This fixes the last 4 valgrind issues
I was seeing with regdbdump.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Its not well documented you should do this but I found out
through valgrind. This fixes the last 4 valgrind issues
I was seeing with regdbdump.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: explicitly use close() and munmap() on reglib_get_rd_alpha2()
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: use gcry_sexp_release() on crda_verify_db_signature()
This fixes 6 of 10 reported valgrind errors when
crda_verify_db_signature() is used through regdbdump.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This fixes 6 of 10 reported valgrind errors when
crda_verify_db_signature() is used through regdbdump.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: separate crda_verify_db_signature() implementations
This will allow us to handle the error codes more cleanly
and in a readible manner. This change should have no
functional change.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This will allow us to handle the error codes more cleanly
and in a readible manner. This change should have no
functional change.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: explicitly close file descriptor and munmap() on failures
Just do this explicitly.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Just do this explicitly.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: explicitly munmap() on reglib_get_rd_alpha2()
Although the region mapped by mmap() is also automatically
unmapped when the process is terminated lets just munmap()
it ourselves to be more tidy.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Although the region mapped by mmap() is also automatically
unmapped when the process is terminated lets just munmap()
it ourselves to be more tidy.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: fix intersect.c memory management
We didn't free memory in some cases, fix this and
to help with the complexity also simplify the case
where any regdom_intersect() fails by completely
failing. In such cases we need an alternative strategy
to build "world regulatory" domains.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
We didn't free memory in some cases, fix this and
to help with the complexity also simplify the case
where any regdom_intersect() fails by completely
failing. In such cases we need an alternative strategy
to build "world regulatory" domains.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: annotate intersection worst case scenerio
In the worst case scenerio of regulatory domain intersections
between a different set of regulatory rules you will end up
without being able to initiate radiation on any frequency
range. Provide a hint as to what needs to be done next in
order to actually build a useful regulatory domain. Currently
we do this manually but building the mathematics would be
even more useful as we grow usage of the spectrum.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
In the worst case scenerio of regulatory domain intersections
between a different set of regulatory rules you will end up
without being able to initiate radiation on any frequency
range. Provide a hint as to what needs to be done next in
order to actually build a useful regulatory domain. Currently
we do this manually but building the mathematics would be
even more useful as we grow usage of the spectrum.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: do not double count on reglib_for_each_country()
Commit ebcbfcf4 introduced reglib_for_each_country() used
by regdbump and later intersect. This helper however only
increased the index count after we requestd getting a new
regulatory domain, this is incorrect and causes us to iterate
over the same element twice in the beginning. This means
intersection and regdb printing was going over the first
element twice. This has been present since v1.1.
This also requires an adjustment on intersect due to the
way things were being handled before.
mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains ebcbfcf4
v1.1.3~9
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Commit ebcbfcf4 introduced reglib_for_each_country() used
by regdbump and later intersect. This helper however only
increased the index count after we requestd getting a new
regulatory domain, this is incorrect and causes us to iterate
over the same element twice in the beginning. This means
intersection and regdb printing was going over the first
element twice. This has been present since v1.1.
This also requires an adjustment on intersect due to the
way things were being handled before.
mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains ebcbfcf4
v1.1.3~9
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: move intersection if first attempt failed
The intersection should be able to continue on even if
the first two countries could not be intersected.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
The intersection should be able to continue on even if
the first two countries could not be intersected.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: fix regression when using reglib_for_each_country()
When reglib_for_each_country() was introduced via ebcbfcf4
its users were not updated with the possibility of rd being
NULL due to the fact that the parsed file could be invalid
or empty. The users
mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains 7a09f4dd
v1.1.3~8
mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains ebcbfcf45
v1.1.3~9
This regression exists since v1.1. Fix this.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
When reglib_for_each_country() was introduced via ebcbfcf4
its users were not updated with the possibility of rd being
NULL due to the fact that the parsed file could be invalid
or empty. The users
mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains 7a09f4dd
v1.1.3~8
mcgrof@frijol ~/devel/crda (git::master)$ git describe --contains ebcbfcf45
v1.1.3~9
This regression exists since v1.1. Fix this.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: move regdom_intersect() to reglib
This will be used later by other code so just share it.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This will be used later by other code so just share it.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: remove unused BUG_ON() from intersect.c
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: constify usage of struct ieee80211_regdomain
Where we can use const.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Where we can use const.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: remove verbose errors out of regdom_intersect()
We want to move this to reglib so nuke all that fluff.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
We want to move this to reglib so nuke all that fluff.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: port over Linux is_valid_reg_rule() change bd05f28e
This was added upstream:
mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains bd05f28e
v2.6.29~3^2~47
commit bd05f28e1a15ae62994fe309a524695fe26dd834
Author: Roel Kluin <roel.kluin@gmail.com>
Date: Tue Mar 3 22:55:21 2009 +0100
cfg80211: test before subtraction on unsigned
freq_diff is unsigned, so test before subtraction
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This was added upstream:
mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains bd05f28e
v2.6.29~3^2~47
commit bd05f28e1a15ae62994fe309a524695fe26dd834
Author: Roel Kluin <roel.kluin@gmail.com>
Date: Tue Mar 3 22:55:21 2009 +0100
cfg80211: test before subtraction on unsigned
freq_diff is unsigned, so test before subtraction
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: make reg_rules_intersect() style match Linux
This makes reg_rules_intersect() style match exactly
as it is upstream as of next-20130522.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This makes reg_rules_intersect() style match exactly
as it is upstream as of next-20130522.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: display DFS regulatory domain in regdbdump
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: synch up nl80211.h
This is needed to make DFS regulatory domain support work again.
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This is needed to make DFS regulatory domain support work again.
Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: fix compile warning on pcc for reglib for string.h
This fixes these compile warnings:
make -j5 -l4 UDEV_RULE_DIR=/lib/udev/rules.d
REG_BIN=/usr/lib64/crda/regulatory.bin USE_OPENSSL=1
CC=x86_64-pc-linux-gnu-gcc all_noverify V=1
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o crda.o crda.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o intersect.o
intersect.c
./utils/key2pub.py --ssl pubkeys/linville.key.pub.pem keys-ssl.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o
print-regdom.o print-regdom.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o regdbdump.o
regdbdump.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o reglib.o
reglib.c
reglib.c: In function ‘country2rd’:
reglib.c:213:2: warning: implicit declaration of function ‘memset’
[-Wimplicit-function-declaration]
reglib.c:213:2: warning: incompatible implicit declaration of built-in
function ‘memset’ [enabled by default]
reglib.c: In function ‘reglib_get_rd_alpha2’:
reglib.c:344:3: warning: implicit declaration of function ‘memcmp’
[-Wimplicit-function-declaration]
x86_64-pc-linux-gnu-gcc -Os -pipe -march=native -frecord-gcc-switches
-ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -Wl,-O1
-Wl,--as-needed -Wl,--hash-style=gnu -o crda reglib.o crda.o `pkg-config
--libs openssl` -lnl-genl-3 -lnl-3 `pkg-config --libs libnl-3.0`
x86_64-pc-linux-gnu-gcc -Os -pipe -march=native -frecord-gcc-switches
-ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -Wl,-O1
-Wl,--as-needed -Wl,--hash-style=gnu -o intersect reglib.o intersect.o
print-regdom.o `pkg-config --libs openssl`
x86_64-pc-linux-gnu-gcc -Os -pipe -march=native -frecord-gcc-switches
-ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -Wl,-O1
-Wl,--as-needed -Wl,--hash-style=gnu -o regdbdump reglib.o regdbdump.o
print-regdom.o `pkg-config --libs openssl`
Reported-by: Richard Farina <sidhayn@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
This fixes these compile warnings:
make -j5 -l4 UDEV_RULE_DIR=/lib/udev/rules.d
REG_BIN=/usr/lib64/crda/regulatory.bin USE_OPENSSL=1
CC=x86_64-pc-linux-gnu-gcc all_noverify V=1
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o crda.o crda.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o intersect.o
intersect.c
./utils/key2pub.py --ssl pubkeys/linville.key.pub.pem keys-ssl.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o
print-regdom.o print-regdom.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o regdbdump.o
regdbdump.c
x86_64-pc-linux-gnu-gcc -c -Os -pipe -march=native
-frecord-gcc-switches -ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -o reglib.o
reglib.c
reglib.c: In function ‘country2rd’:
reglib.c:213:2: warning: implicit declaration of function ‘memset’
[-Wimplicit-function-declaration]
reglib.c:213:2: warning: incompatible implicit declaration of built-in
function ‘memset’ [enabled by default]
reglib.c: In function ‘reglib_get_rd_alpha2’:
reglib.c:344:3: warning: implicit declaration of function ‘memcmp’
[-Wimplicit-function-declaration]
x86_64-pc-linux-gnu-gcc -Os -pipe -march=native -frecord-gcc-switches
-ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -Wl,-O1
-Wl,--as-needed -Wl,--hash-style=gnu -o crda reglib.o crda.o `pkg-config
--libs openssl` -lnl-genl-3 -lnl-3 `pkg-config --libs libnl-3.0`
x86_64-pc-linux-gnu-gcc -Os -pipe -march=native -frecord-gcc-switches
-ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -Wl,-O1
-Wl,--as-needed -Wl,--hash-style=gnu -o intersect reglib.o intersect.o
print-regdom.o `pkg-config --libs openssl`
x86_64-pc-linux-gnu-gcc -Os -pipe -march=native -frecord-gcc-switches
-ggdb -Wall -g -DUSE_OPENSSL
-DPUBKEY_DIR=\"/etc/wireless-regdb/pubkeys\" `pkg-config --cflags
openssl` -DCONFIG_LIBNL30 `pkg-config --cflags libnl-3.0` -Wl,-O1
-Wl,--as-needed -Wl,--hash-style=gnu -o regdbdump reglib.o regdbdump.o
print-regdom.o `pkg-config --libs openssl`
Reported-by: Richard Farina <sidhayn@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
crda: rename reglib_get_*() routines
reglib_get_country_idx() --> reglib_get_rd_alpha2()
reglib_get_country_alpha2() --> reglib_get_rd_alpha2()
This reflects better what we provide back out.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
reglib_get_country_idx() --> reglib_get_rd_alpha2()
reglib_get_country_alpha2() --> reglib_get_rd_alpha2()
This reflects better what we provide back out.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: make usage of regdb.h exclusive to reglib.c
The only other remaining user of regdb.h is regdbdump tool
but as I see it this utility can exist in either a reglib
library, or on each OS for its own specific adaptation of
the reglib code. For now we just make regdbump use the local
copy of nl80211.h. Later the reglib library can have its own
print / dump utility if we deem it necessary.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
The only other remaining user of regdb.h is regdbdump tool
but as I see it this utility can exist in either a reglib
library, or on each OS for its own specific adaptation of
the reglib code. For now we just make regdbump use the local
copy of nl80211.h. Later the reglib library can have its own
print / dump utility if we deem it necessary.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: make country2rd() static
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: clean header files
Remove unused headers now that we have an object
(soon to be library) using what it has to separately.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Remove unused headers now that we have an object
(soon to be library) using what it has to separately.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: make crda use reglib_get_country_alpha2()
This removes all file specific operations over to the
reglib. This also required converting the processing of the
regulatory domain from the mmap'd rules to the standard
ieee80211_regdomain data structure.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
This removes all file specific operations over to the
reglib. This also required converting the processing of the
regulatory domain from the mmap'd rules to the standard
ieee80211_regdomain data structure.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: add dfs_region to the ieee80211_regdomain data structure
This will be used later once crda.c starts using the
ieee80211_regdomain data structure passed on from reglib
instead of using the mmap()'d regulatory file directly.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
This will be used later once crda.c starts using the
ieee80211_regdomain data structure passed on from reglib
instead of using the mmap()'d regulatory file directly.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: add new reglib_get_country_alpha2()
This will be used by CRDA to find the alpha2.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
This will be used by CRDA to find the alpha2.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: close fd upon leaving
This was never done. Do this at the end for now but soon
this will be changed in preference for the file opening
only to be done by crda for checking which file to use
to pass on to reglib for usage.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
This was never done. Do this at the end for now but soon
this will be changed in preference for the file opening
only to be done by crda for checking which file to use
to pass on to reglib for usage.
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: make intersect.c use reglib_for_each_country()
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: add a reglib iterator reglib_for_each_country()
To allow for a simple library on reglib.c we want to enable
an iterator over the regulatory database that does not have
to lock the file, or pass references to the file. We instead
add an iterator reglib_get_country_idx() which will use a
new reglib_get_country_idx(), that does an O(n) search for
each new regulatory domain it needs to read.
The trade off here is to allow for a simple reglib.c implementation
at the cost that upon each iteration reglib_get_country_idx()
we will will be opening the regdb, and verifying the db signature.
Given that the only user of this iterator is regdbdump though and
that this is used for debugging for now this is trade off I am
willing to live with.
Systems that want to use the regdb as a database for fine tuning
radio parameters dynamically and reading this file very *often*
(seconds, minutes, who knows what the future holds) may want to
consider a slight optimization of exporting the direct mmap()
through the library but we are I think light years away from that.
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
To allow for a simple library on reglib.c we want to enable
an iterator over the regulatory database that does not have
to lock the file, or pass references to the file. We instead
add an iterator reglib_get_country_idx() which will use a
new reglib_get_country_idx(), that does an O(n) search for
each new regulatory domain it needs to read.
The trade off here is to allow for a simple reglib.c implementation
at the cost that upon each iteration reglib_get_country_idx()
we will will be opening the regdb, and verifying the db signature.
Given that the only user of this iterator is regdbdump though and
that this is used for debugging for now this is trade off I am
willing to live with.
Systems that want to use the regdb as a database for fine tuning
radio parameters dynamically and reading this file very *often*
(seconds, minutes, who knows what the future holds) may want to
consider a slight optimization of exporting the direct mmap()
through the library but we are I think light years away from that.
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
crda: move country2rd() and its helper to reglib.c
Start cleaning the way we deal with reglib.c as the goal
is to make that stuff a library to be shared first in
userspace with the regulatory simulator [0]. We start
off by moving country2rd() and its helper over to
reglib.c.
[0] git://github.com/mcgrof/regsim.git
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Start cleaning the way we deal with reglib.c as the goal
is to make that stuff a library to be shared first in
userspace with the regulatory simulator [0]. We start
off by moving country2rd() and its helper over to
reglib.c.
[0] git://github.com/mcgrof/regsim.git
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: add nested support for libnl-3.2
Skip libnl-3.1 due to broken .pc files.
Tested to work with:
- libnl-3.2.3 (Debian 3.2.3-1)
Changes-licensed-under: ISC
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
Skip libnl-3.1 due to broken .pc files.
Tested to work with:
- libnl-3.2.3 (Debian 3.2.3-1)
Changes-licensed-under: ISC
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
crda: use stdint.h instead of linux/types.h
Given that we may need to make a library out of some
routines here to share with the regulatory simulator.
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Given that we may need to make a library out of some
routines here to share with the regulatory simulator.
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
crda: add support to send DFS master region
wireless-regdb now has support for a DFS master region
for each country. We must read this from the file and
send it as an NL80211_ATTR_DFS_REGION attribute.
We add a "creqs" value for the country structure but only
use the first two bits as that is all we need right now.
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
wireless-regdb now has support for a DFS master region
for each country. We must read this from the file and
send it as an NL80211_ATTR_DFS_REGION attribute.
We add a "creqs" value for the country structure but only
use the first two bits as that is all we need right now.
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
crda: fix null string assumption for alpha2
The wireless-regdb only accounts for two bytes for
the country code but CRDA defined the alpha2 to be
as a string of length 2, and so does the nl80211 attribute
policy:
[NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 },
The meaning of a string is it'll be null terminated, so if you
do not add the null termination a country without the null termination
will not match up with the nl80211 attribute policy.
This has no impact for us unless we want to use the next available
pad byte on the wireless-regdb. This fixes CRDA by using a local copy
of the regdb's alpha2 that is properly null terminated and sending it.
The implications of this change is that new wirelesss-regdb's that
make use of the next pad byte for a country will get that country
ignored for regulatory hints sent to the kernel. At this point we
don't yet know what the next byte will be used for though so this
has no impact. The second pad byte is being used for DFS and that
is not impacted by this nor is this change required for it.
Distributions should upgrade though in case we ever do decide to use
this last precious country byte. I've tested that this indeed fixes
the bogus issue I saw when instead of using the second pad byte we
use the first pad byte. Thanks to Johannes for spotting the issue.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
The wireless-regdb only accounts for two bytes for
the country code but CRDA defined the alpha2 to be
as a string of length 2, and so does the nl80211 attribute
policy:
[NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 },
The meaning of a string is it'll be null terminated, so if you
do not add the null termination a country without the null termination
will not match up with the nl80211 attribute policy.
This has no impact for us unless we want to use the next available
pad byte on the wireless-regdb. This fixes CRDA by using a local copy
of the regdb's alpha2 that is properly null terminated and sending it.
The implications of this change is that new wirelesss-regdb's that
make use of the next pad byte for a country will get that country
ignored for regulatory hints sent to the kernel. At this point we
don't yet know what the next byte will be used for though so this
has no impact. The second pad byte is being used for DFS and that
is not impacted by this nor is this change required for it.
Distributions should upgrade though in case we ever do decide to use
this last precious country byte. I've tested that this indeed fixes
the bogus issue I saw when instead of using the second pad byte we
use the first pad byte. Thanks to Johannes for spotting the issue.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
crda: synch up nl80211.h
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
crda: add nested support for libnl-3.0
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Space fix
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Implement runtime loading of RSA public keys
This patch allows crda to load and use additional keys from a
pre-configured location for the database signature verification. This
provides a convenient way for distro maintainers and card manufacturers to
supply a custom regulatory database along with their public keys, without
the need to recompile crda.
Implemented for USE_OPENSSL=1 case only because libgcrypt lacks PEM parser.
Default location for public keys in PEM format is
/etc/wireless-regdb/pubkeys and can be changed by specifying
RUNTIME_PUBKEY_DIR at the make command line.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
This patch allows crda to load and use additional keys from a
pre-configured location for the database signature verification. This
provides a convenient way for distro maintainers and card manufacturers to
supply a custom regulatory database along with their public keys, without
the need to recompile crda.
Implemented for USE_OPENSSL=1 case only because libgcrypt lacks PEM parser.
Default location for public keys in PEM format is
/etc/wireless-regdb/pubkeys and can be changed by specifying
RUNTIME_PUBKEY_DIR at the make command line.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
crda: Cosmetic fix for udev path
BugLink: http://bugs.launchpad.net/bugs/340995
SBINDIR already has a trailing '/', so its not needed
in the udev rule.
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
BugLink: http://bugs.launchpad.net/bugs/340995
SBINDIR already has a trailing '/', so its not needed
in the udev rule.
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
CRDA and cross-compilation
On Thu, 2009-08-06 at 09:56 -0700, Luis R. Rodriguez wrote:
> ACK, is it possible to make it simpler?
OK, here's my take.
We only need a native compiler to verify regulatory.bin. I believe it's
orthogonal to building CRDA.
For someone doing a cross-compilation, it makes no sense to verify the
installed regulatory.bin. Thus, the verification should be optional.
But the compilation of regdbdump shouldn't be. Firstly, it's installed
by "make install". Secondly, somebody may want to verify regulatory.bin
on the target system.
Here's the patch:
crda: make it possible to disable verification
Signed-off-by: Pavel Roskin <proski@gnu.org>
On Thu, 2009-08-06 at 09:56 -0700, Luis R. Rodriguez wrote:
> ACK, is it possible to make it simpler?
OK, here's my take.
We only need a native compiler to verify regulatory.bin. I believe it's
orthogonal to building CRDA.
For someone doing a cross-compilation, it makes no sense to verify the
installed regulatory.bin. Thus, the verification should be optional.
But the compilation of regdbdump shouldn't be. Firstly, it's installed
by "make install". Secondly, somebody may want to verify regulatory.bin
on the target system.
Here's the patch:
crda: make it possible to disable verification
Signed-off-by: Pavel Roskin <proski@gnu.org>
break lines nicer in 64-bit openssl keys
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
make openssl keys 64-bit safe
openssl uses unsigned longs -- which are 8 bytes on 64-bit
platforms, not 4, so the python code needs to account for
that... how stupid!
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
openssl uses unsigned longs -- which are 8 bytes on 64-bit
platforms, not 4, so the python code needs to account for
that... how stupid!
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
make openssl verification safe for multiple keys
it seems openssl caches some things in there and subsequent
uses of the same key struct fail or something -- since this
fixes it I'm not bothering trying to figure out what's wrong
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
it seems openssl caches some things in there and subsequent
uses of the same key struct fail or something -- since this
fixes it I'm not bothering trying to figure out what's wrong
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Allow distributions to specify a custom pubkeys dir
Distributions which need a custom pubkey dir can just
specify it upon build time.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Distributions which need a custom pubkey dir can just
specify it upon build time.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Doh, forgot to add crda after SBINDIR
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Add comments to explain paths
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Add /usr/local/lib/crda/regulatory.bin as first in path
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
crda: allow loading of regulatory.bin from /lib/crda in addition to /usr/lib/crda
As crda is typically installed in /sbin it might be worth to install
regulatory.bin into /lib/crda instead of /usr/lib/crda. Hence, extend
crda to try both paths for loading the database.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
As crda is typically installed in /sbin it might be worth to install
regulatory.bin into /lib/crda instead of /usr/lib/crda. Hence, extend
crda to try both paths for loading the database.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Fix Makefile to not overwrite udev/regulatory.rules for SBINDIR changes
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
also replace the SBINDIR used in the rules file
use SBINDIR in install target of CRDA
You supply the user with a chance to specify SBINDIR during make
install, yet forgot to use it in one place at the install target. I
attached a patch against trunk for crda.git which fixes that.
You supply the user with a chance to specify SBINDIR during make
install, yet forgot to use it in one place at the install target. I
attached a patch against trunk for crda.git which fixes that.