Age | Commit message (Collapse) | Author | Files | Lines |
|
Write the CC rule such that it only tries to produce a single output
file (the .so). When including the .h files in the compiler invocation,
this suggests we should be producing pre-compiled headers too, which
doesn't make sense in this context, and Clang happens not to like.
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
|
|
As if kernel v4.15 CRDA is no longer needed. Annotate this. The
code will still be maintained to help older kernels.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
|
|
Cc: Luis R. Rodriguez <mcgrof@kernel.org>
Cc: WIRELESS ML <linux-wireless@vger.kernel.org>
Cc: REGDB ML <wireless-regdb@lists.infradead.org>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
|
|
If you have a umask of 077 your library files won't be
accessible to non-root users. Fix that.
Reported-by: Lukas Pirl <mail@lukas-pirl.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
|
|
Just a missing tab. No functional changes.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
Fix error: ‘keys’ defined but not used [-Werror=unused-const-variable=]
by informing GCC keys is unused.
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
Add new binaries db2rd and optimize, also ignore the generated .so.
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
|
|
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>
|
|
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>
|
|
Remove strange parsers.
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>
|
|
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>
|
|
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.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>
|
|
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>
|
|
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>
|
|
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>
|
|
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 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 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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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 consolidates the number of arguments.
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>
|
|
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>
|
|
There are no functional changes in this change.
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>
|
|
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>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
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>
|
|
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>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Just do this explicitly.
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
This will be used later by other code so just share it.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
|
|
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>
|
|
We want to move this to reglib so nuke all that fluff.
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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 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 by CRDA to find the alpha2.
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>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
|
|
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Distributions which need a custom pubkey dir can just
specify it upon build time.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
/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>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
|
|
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.
|
|
Upstream has renamed nl_handle to nl_sock. Update crda to the new names
and add #define for libnl-1.1.
Signed-off-by: Pat Erley <pat-lkml@erley.org>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Otherwise, the error messase would be very confusing.
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
For --as-needed to work (and for traditional ld too) the libraries should
always be passed _after_ the object files, move them so that they are
picked up properly.
Also rename LIBS to NLLIBS to avoid confusion between LIBS/LDLIBS.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This one uses cdbs to make debian/rules smaller.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
We add a man page for regdbdump and we correct some typos
on the Makefile. We now add SBINDIR and MANDIR targets as
well for installation.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This adds crda man page and adds options the Makefile
to let distributions customize their udev rule target
directory and level for the regulatory.rules.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Instead of throwing a cryptic Python backtrace, throw a better error message, if
the M2Crypto module is not installed.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
|
|
Specify output file on the command line, so that it's not created in
case of fatal errors, such as asbence of M2Crypto.
Signed-off-by: Pavel Roskin <proski@gnu.org>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This patch updates CRDA to use the new libnl-2 interface, and adds
backwards compatability with libnl-1. It follows the same pattern that
the patch included into iw uses.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Pat Erley <pat-lkml@erley.org>
|
|
1) wrong wildcard expansion in makefile
2) multiple pubkeys don't work
This fixes both of these issues.
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
It contains a few nl80211 updates, this file is also now
under the ISC license which removes any legal ambiguity
from ISC licensed programs (like this one) from shipping
it.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This allows to avoid linking them in the crda binary where they are
not used.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
The function is only ever used in that translation unit so it makes no
sense to define it for all the binaries.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
When building the libgcrypt-based code, string.h is included through
libgcrypt itself, but when building with OpenSSL it's missing.
Include it explicitly so that it's always safe.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Since they are never modified, mark the key tables constant so they
are emitted in .rodata.
Note that even though they are probably also never modified, the
OpenSSL tables generate warnings when they are marked constant, as
such they are untouched.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This makes the build more parallel since regdbdump.o build and link
can happen in parallel with the keys generation and the build of the
rest of the units.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
By building with "make USE_OPENSSL=1", OpenSSL will be used in
libcrypt's stead. This also allows for properly depend just on the
keys-*.c source file that is actually going to be used.
Note that the all target is moved up so that it still hits as default
target.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Since the keys .c files are included by reglib.c, it's not the final
output to depend on them but rather reglib.o.
This not only fixes proper regeneration of reglib.o when the pem files
are changed, but also allows proper parallel make of the package.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
When using GNU ld --as-needed option, you need to ensure that the
order of parameters to the linker is formally correct, with libraries
coming after the object files. For this reason, don't use LDFLAGS for
passing the libraries, and make sure that LDLIBS goes at the end of
the line.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
on regulutory.bin being present where the distribution
wants it to be. Note that it should be installed first.
You only need regulatory.bin present to verify the signature
used to build it matches.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
external URLs to retrieve the regulatory.bin and public keys.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This needs some more review...
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Lets make country2rd() easier to read by not using
double pointers.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This adds country2rd() and friends which allows us to
use more friendlier data structures that are not big endian
and standardizes printing this new rd structure.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
renamed: regdb.c -> reglib.c
renamed: crda.h -> reglib.h
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
We keep regdb.h clean specifically for file regdb data structures.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
* use pkg-config for libnl and openssl
* fix dir creation in the 'install' target
* transform all 'keys-*.c' targets into a single pattern rule
* better output in non-verbose mode
* general cleanup
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Fix warnings spit out by gcc -Wextra and checkpatch.pl
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Identical code used by both crda.c and dump.c
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Both crda.c and dump.c had their own version of the code which
checks the validity of the signature on the regulatory db.
Having a common implementation shared by both files makes
maintenance easier and removes code duplication.
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
* use $(wildcard *.pem) in the keys-gcrypt.c target
* remove key.priv.pem if it's the test-key in the
clean target
Signed-off-by: Evgeni Golov <sargentd@die-welt.net>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This makes the flags match Linux nl80211.h
Signed-off-by: Benoit PAPILLAULT <benoit.papillault@free.fr>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Singed-off-by: Benoit PAPILLAULT <benoit.papillault@free.fr>
|
|
Signed-off-by: Benoit PAPILLAULT <benoit.papillault@free.fr>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Benoit PAPILLAULT <benoit.papillault@free.fr>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
By calling nl80211_init() a bit later, we can simplify error handling
and avoid a lot of goto's in error paths.
While at it, fix a couple of minor leaks in openssl-related code.
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
This seems to fix to get this to work on some versions of gcrypt.
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
in userspace anywhere and kernel support hasn't been merged yet.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
data from "Frequenznutzungsplan" (as published in April 2008),
downloaded from http://www.bundesnetzagentur.de/media/archive/13358.pdf
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
in 5260 MHz - 5700 MHz. For frequency ranges with a larger span
we split them to ensure DFS is still used only on the specific band.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
If we can standardize on it later then good but this needs
more review on implementations by different vendors.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
Extend the documentation to explain details on compliance limits,
and DFS. Add a LICENSE.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|