]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - wilink8-wlan/crda.git/log
wilink8-wlan/crda.git
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
Yaniv Machani [Sun, 10 May 2015 10:28:59 +0000 (13:28 +0300)]
Merge branch 'upstream_master'

9 years agocrda: Trust regulatory.bin from Seth Forshee v3.18
Seth Forshee [Fri, 5 Dec 2014 19:30:39 +0000 (13:30 -0600)]
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>
9 years agocrda: db2rd, parse/print CAC time
Janusz Dziedzic [Wed, 2 Jul 2014 12:02:11 +0000 (14:02 +0200)]
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>
9 years agocrda: simplify text parsing for country/rules
Janusz Dziedzic [Thu, 12 Jun 2014 06:35:38 +0000 (08:35 +0200)]
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>
9 years agocrda: add AUTO-BW rule flag support
Janusz Dziedzic [Fri, 9 May 2014 08:38:43 +0000 (10:38 +0200)]
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>
9 years agocrda: sync with latest nl80211.h
Janusz Dziedzic [Fri, 9 May 2014 08:38:42 +0000 (10:38 +0200)]
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>
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
Eliad Peller [Sun, 4 May 2014 08:26:22 +0000 (11:26 +0300)]
Link against libdl as well

some toolchanins complain otherwise

Signed-off-by: Eliad Peller <eliad@wizery.com>
9 years agoallow building crda statically
Eliad Peller [Tue, 29 Apr 2014 16:09:31 +0000 (19:09 +0300)]
allow building crda statically

Signed-off-by: Eliad Peller <eliad@wizery.com>
10 years agoMakefile: Don't use ldconfig
Barak Bercovitz [Sun, 16 Feb 2014 15:00:47 +0000 (17:00 +0200)]
Makefile: Don't use ldconfig

Don't use ldconfig

Signed-off-by: Guy Mishol <guym@ti.com>
10 years agoMakefile: don't use -Werror (TEMP)
Eliad Peller [Thu, 13 Feb 2014 13:01:24 +0000 (15:01 +0200)]
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>
10 years agocrda: Makefile: don't compile keys-ssl.c
Eliad Peller [Thu, 13 Feb 2014 11:33:28 +0000 (13:33 +0200)]
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>
10 years agocrda: Add DESTDIR support in install-libreg* rules in Makefile
John W. Linville [Fri, 14 Feb 2014 18:58:44 +0000 (13:58 -0500)]
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>
10 years agocrda: Fix the linking order to avoid compilation error
Krishna Chaitanya [Mon, 16 Dec 2013 16:27:39 +0000 (21:57 +0530)]
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>
10 years agocrda: document contribution process using the DCO
Luis R. Rodriguez [Fri, 24 Jan 2014 22:11:57 +0000 (14:11 -0800)]
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>
10 years agoreglib: fix memset usage v3.13
Christian Lamparter [Mon, 11 Nov 2013 19:39:50 +0000 (20:39 +0100)]
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>
10 years agocrda: make reglib a shared library
Luis R. Rodriguez [Mon, 28 Oct 2013 01:38:48 +0000 (02:38 +0100)]
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>
10 years agocrda: make ssl keys include stdint.h
Luis R. Rodriguez [Mon, 28 Oct 2013 01:40:25 +0000 (02:40 +0100)]
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>
10 years agocrda: add regulatory domain optimizer
Luis R. Rodriguez [Sun, 27 Oct 2013 17:17:00 +0000 (18:17 +0100)]
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>
10 years agocrda: add regulatory domain stream parser
Luis R. Rodriguez [Fri, 25 Oct 2013 22:00:07 +0000 (00:00 +0200)]
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>
10 years agocrda: fix -pedantic gcc compilation
Luis R. Rodriguez [Mon, 28 Oct 2013 00:45:05 +0000 (01:45 +0100)]
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>
10 years agocrda: relicense under copyleft-next-0.3.0
Luis R. Rodriguez [Sun, 27 Oct 2013 23:43:19 +0000 (00:43 +0100)]
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>
10 years agocrda: remove antenna gain
Luis R. Rodriguez [Wed, 23 Oct 2013 18:53:49 +0000 (20:53 +0200)]
crda: remove antenna gain

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: consolidate passive-scan and no-ibss flags
Luis R. Rodriguez [Mon, 21 Oct 2013 12:06:56 +0000 (14:06 +0200)]
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>
10 years agoreglib: add reglib_is_valid_rd() and verify data upon build
Luis R. Rodriguez [Wed, 17 Jul 2013 01:08:28 +0000 (18:08 -0700)]
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>
10 years agoreglib: Validate all structure and array lengths
Ben Hutchings [Sun, 30 Jun 2013 23:49:31 +0000 (00:49 +0100)]
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>
10 years agocrda: make reglib_for_each_country() use the reglib context
Luis R. Rodriguez [Fri, 31 May 2013 01:04:41 +0000 (18:04 -0700)]
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>
10 years agocrda: pass struct reglib_regdb_ctx to country2rd()
Luis R. Rodriguez [Fri, 31 May 2013 00:41:18 +0000 (17:41 -0700)]
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>
10 years agocrda: add reglib regdb context helpers: reglib_(malloc|free)_regdb_ctx()
Luis R. Rodriguez [Fri, 31 May 2013 00:29:18 +0000 (17:29 -0700)]
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>
10 years agocrda: move regdbprint to its own helper
Luis R. Rodriguez [Thu, 30 May 2013 22:35:41 +0000 (15:35 -0700)]
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>
10 years agocrda: move reglib_intersect_regdb() to reglib
Luis R. Rodriguez [Thu, 30 May 2013 22:20:55 +0000 (15:20 -0700)]
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>
10 years agocrda: separate intersecting a full db into a helper
Luis R. Rodriguez [Thu, 30 May 2013 22:16:50 +0000 (15:16 -0700)]
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>
10 years agocrda: clarify intersect.c only computes an intersection
Luis R. Rodriguez [Thu, 30 May 2013 21:57:06 +0000 (14:57 -0700)]
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>
10 years agocrda: fix spacing on reglib_for_each_country()
Luis R. Rodriguez [Thu, 30 May 2013 21:55:33 +0000 (14:55 -0700)]
crda: fix spacing on reglib_for_each_country()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename min() to reglib_min()
Luis R. Rodriguez [Thu, 30 May 2013 21:53:04 +0000 (14:53 -0700)]
crda: rename min() to reglib_min()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename max() to reglib_max()
Luis R. Rodriguez [Thu, 30 May 2013 21:52:33 +0000 (14:52 -0700)]
crda: rename max() to reglib_max()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename is_valid_regdom() to reglib_is_valid_regdom()
Luis R. Rodriguez [Thu, 30 May 2013 21:48:58 +0000 (14:48 -0700)]
crda: rename is_valid_regdom() to reglib_is_valid_regdom()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename is_alpha2() to reglib_is_alpha2()
Luis R. Rodriguez [Thu, 30 May 2013 21:48:13 +0000 (14:48 -0700)]
crda: rename is_alpha2() to reglib_is_alpha2()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename isalpha_upper() to reglib_isalpha_upper()
Luis R. Rodriguez [Thu, 30 May 2013 21:47:23 +0000 (14:47 -0700)]
crda: rename isalpha_upper() to reglib_isalpha_upper()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename is_world_regdom() to reglib_is_world_regdom()
Luis R. Rodriguez [Thu, 30 May 2013 21:37:32 +0000 (14:37 -0700)]
crda: rename is_world_regdom() to reglib_is_world_regdom()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: move reg print helpers to reglib
Luis R. Rodriguez [Thu, 30 May 2013 21:35:12 +0000 (14:35 -0700)]
crda: move reg print helpers to reglib

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: make print-regdom use internal flags
Luis R. Rodriguez [Thu, 30 May 2013 21:29:35 +0000 (14:29 -0700)]
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>
10 years agocrda: add regdb_dfs_regions
Luis R. Rodriguez [Thu, 30 May 2013 21:23:14 +0000 (14:23 -0700)]
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>
10 years agocrda: rename print_regdom() to reglib_print_regdom()
Luis R. Rodriguez [Thu, 30 May 2013 10:44:48 +0000 (03:44 -0700)]
crda: rename print_regdom() to reglib_print_regdom()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename crda_verify_db_signature() to reglib_verify_db_signature()
Luis R. Rodriguez [Thu, 30 May 2013 10:41:35 +0000 (03:41 -0700)]
crda: rename crda_verify_db_signature() to reglib_verify_db_signature()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename crda_get_file_ptr() to reglib_get_file_ptr()
Luis R. Rodriguez [Thu, 30 May 2013 01:59:22 +0000 (18:59 -0700)]
crda: rename crda_get_file_ptr() to reglib_get_file_ptr()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: rename regdom_intersect() to reglib_intersect_rds()
Luis R. Rodriguez [Thu, 30 May 2013 01:57:02 +0000 (18:57 -0700)]
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>
10 years agocrda: remove verbosity out of intersect.c
Luis R. Rodriguez [Thu, 30 May 2013 01:51:25 +0000 (18:51 -0700)]
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>
10 years agocrda: rename world and prev_world on intersect.c
Luis R. Rodriguez [Thu, 30 May 2013 01:18:28 +0000 (18:18 -0700)]
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>
10 years agocrda: use gcry_mpi_release() when using gcry_mpi_scan()
Luis R. Rodriguez [Thu, 30 May 2013 01:04:23 +0000 (18:04 -0700)]
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>
10 years agocrda: explicitly use close() and munmap() on reglib_get_rd_alpha2()
Luis R. Rodriguez [Thu, 30 May 2013 00:24:32 +0000 (17:24 -0700)]
crda: explicitly use close() and munmap() on reglib_get_rd_alpha2()

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: use gcry_sexp_release() on crda_verify_db_signature()
Luis R. Rodriguez [Thu, 30 May 2013 00:05:51 +0000 (17:05 -0700)]
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>
10 years agocrda: separate crda_verify_db_signature() implementations
Luis R. Rodriguez [Wed, 29 May 2013 23:49:48 +0000 (16:49 -0700)]
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>
10 years agocrda: explicitly close file descriptor and munmap() on failures
Luis R. Rodriguez [Wed, 29 May 2013 22:25:48 +0000 (15:25 -0700)]
crda: explicitly close file descriptor and munmap() on failures

Just do this explicitly.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: explicitly munmap() on reglib_get_rd_alpha2()
Luis R. Rodriguez [Wed, 29 May 2013 22:19:40 +0000 (15:19 -0700)]
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>
10 years agocrda: fix intersect.c memory management
Luis R. Rodriguez [Wed, 29 May 2013 21:41:32 +0000 (14:41 -0700)]
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>
10 years agocrda: annotate intersection worst case scenerio
Luis R. Rodriguez [Sat, 25 May 2013 19:09:16 +0000 (12:09 -0700)]
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>
10 years agocrda: do not double count on reglib_for_each_country()
Luis R. Rodriguez [Sat, 25 May 2013 01:24:04 +0000 (18:24 -0700)]
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>
10 years agocrda: move intersection if first attempt failed
Luis R. Rodriguez [Sat, 25 May 2013 00:03:44 +0000 (17:03 -0700)]
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>
10 years agocrda: fix regression when using reglib_for_each_country()
Luis R. Rodriguez [Fri, 24 May 2013 02:48:19 +0000 (19:48 -0700)]
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>
10 years agocrda: move regdom_intersect() to reglib
Luis R. Rodriguez [Fri, 24 May 2013 00:32:38 +0000 (17:32 -0700)]
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>
10 years agocrda: remove unused BUG_ON() from intersect.c
Luis R. Rodriguez [Fri, 24 May 2013 00:23:49 +0000 (17:23 -0700)]
crda: remove unused BUG_ON() from intersect.c

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: constify usage of struct ieee80211_regdomain
Luis R. Rodriguez [Fri, 24 May 2013 00:22:14 +0000 (17:22 -0700)]
crda: constify usage of struct ieee80211_regdomain

Where we can use const.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
10 years agocrda: remove verbose errors out of regdom_intersect()
Luis R. Rodriguez [Thu, 23 May 2013 22:48:44 +0000 (15:48 -0700)]
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>
10 years agocrda: port over Linux is_valid_reg_rule() change bd05f28e
Luis R. Rodriguez [Thu, 23 May 2013 22:33:44 +0000 (15:33 -0700)]
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>
10 years agocrda: make reg_rules_intersect() style match Linux
Luis R. Rodriguez [Thu, 23 May 2013 22:27:29 +0000 (15:27 -0700)]
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>
11 years agocrda: display DFS regulatory domain in regdbdump
Zefir Kurtisi [Wed, 3 Apr 2013 13:51:58 +0000 (15:51 +0200)]
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>
11 years agocrda: synch up nl80211.h
Zefir Kurtisi [Wed, 3 Apr 2013 13:51:16 +0000 (15:51 +0200)]
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>
11 years agocrda: fix compile warning on pcc for reglib for string.h
Luis R. Rodriguez [Mon, 21 Jan 2013 20:24:03 +0000 (12:24 -0800)]
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>
12 years agocrda: rename reglib_get_*() routines v1.1.3
Luis R. Rodriguez [Thu, 19 Jan 2012 02:19:09 +0000 (18:19 -0800)]
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>
12 years agocrda: make usage of regdb.h exclusive to reglib.c
Luis R. Rodriguez [Thu, 19 Jan 2012 02:14:07 +0000 (18:14 -0800)]
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>
12 years agocrda: make country2rd() static
Luis R. Rodriguez [Thu, 19 Jan 2012 02:03:11 +0000 (18:03 -0800)]
crda: make country2rd() static

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocrda: clean header files
Luis R. Rodriguez [Thu, 19 Jan 2012 02:00:48 +0000 (18:00 -0800)]
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>
12 years agocrda: make crda use reglib_get_country_alpha2()
Luis R. Rodriguez [Thu, 19 Jan 2012 01:37:00 +0000 (17:37 -0800)]
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>
12 years agocrda: add dfs_region to the ieee80211_regdomain data structure
Luis R. Rodriguez [Thu, 19 Jan 2012 01:43:34 +0000 (17:43 -0800)]
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>
12 years agocrda: add new reglib_get_country_alpha2()
Luis R. Rodriguez [Thu, 19 Jan 2012 01:04:33 +0000 (17:04 -0800)]
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>
12 years agocrda: close fd upon leaving
Luis R. Rodriguez [Thu, 19 Jan 2012 00:21:51 +0000 (16:21 -0800)]
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>
12 years agocrda: make intersect.c use reglib_for_each_country()
Luis R. Rodriguez [Wed, 18 Jan 2012 21:59:46 +0000 (13:59 -0800)]
crda: make intersect.c use reglib_for_each_country()

Signed-off-by: Luis R. Rodriguez <mcgrof@frijolero.org>
12 years agocrda: add a reglib iterator reglib_for_each_country()
Luis R. Rodriguez [Wed, 21 Dec 2011 23:43:58 +0000 (15:43 -0800)]
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>
12 years agocrda: move country2rd() and its helper to reglib.c
Luis R. Rodriguez [Wed, 21 Dec 2011 02:04:18 +0000 (18:04 -0800)]
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>
12 years agocrda: add nested support for libnl-3.2
Stefan Lippers-Hollmann [Wed, 18 Jan 2012 19:53:03 +0000 (20:53 +0100)]
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>
12 years agocrda: use stdint.h instead of linux/types.h
Luis R. Rodriguez [Tue, 15 Nov 2011 21:50:23 +0000 (13:50 -0800)]
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>
12 years agocrda: add support to send DFS master region
Luis R. Rodriguez [Tue, 4 Oct 2011 19:50:32 +0000 (12:50 -0700)]
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>
12 years agocrda: fix null string assumption for alpha2
Luis R. Rodriguez [Fri, 7 Oct 2011 20:47:53 +0000 (13:47 -0700)]
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>
12 years agocrda: synch up nl80211.h
Luis R. Rodriguez [Mon, 3 Oct 2011 22:48:26 +0000 (15:48 -0700)]
crda: synch up nl80211.h

Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
12 years agocrda: add nested support for libnl-3.0 v1.1.2
Tim Gardner [Mon, 8 Aug 2011 16:49:49 +0000 (10:49 -0600)]
crda: add nested support for libnl-3.0

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
14 years agoSpace fix v1.1.1
Luis R. Rodriguez [Mon, 25 Jan 2010 17:43:20 +0000 (09:43 -0800)]
Space fix

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
14 years agoImplement runtime loading of RSA public keys
Paul Fertser [Sat, 23 Jan 2010 11:34:14 +0000 (14:34 +0300)]
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>
14 years agocrda: Cosmetic fix for udev path
Tim Gardner [Mon, 12 Oct 2009 14:53:31 +0000 (08:53 -0600)]
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>
14 years agoCRDA and cross-compilation
Pavel Roskin [Thu, 6 Aug 2009 17:45:07 +0000 (13:45 -0400)]
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>
15 years agobreak lines nicer in 64-bit openssl keys v1.1.0
Johannes Berg [Fri, 17 Apr 2009 21:49:45 +0000 (23:49 +0200)]
break lines nicer in 64-bit openssl keys

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
15 years agomake openssl keys 64-bit safe
Johannes Berg [Fri, 17 Apr 2009 21:27:20 +0000 (23:27 +0200)]
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>
15 years agomake openssl verification safe for multiple keys
Johannes Berg [Fri, 17 Apr 2009 21:26:17 +0000 (23:26 +0200)]
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>
15 years agoAllow distributions to specify a custom pubkeys dir v1.0.2
Luis R. Rodriguez [Fri, 17 Apr 2009 19:26:23 +0000 (12:26 -0700)]
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>
15 years agoDoh, forgot to add crda after SBINDIR
Luis R. Rodriguez [Fri, 6 Mar 2009 01:30:41 +0000 (17:30 -0800)]
Doh, forgot to add crda after SBINDIR

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoAdd comments to explain paths
Luis R. Rodriguez [Tue, 24 Feb 2009 19:47:13 +0000 (11:47 -0800)]
Add comments to explain paths

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoAdd /usr/local/lib/crda/regulatory.bin as first in path
Luis R. Rodriguez [Tue, 24 Feb 2009 19:43:38 +0000 (11:43 -0800)]
Add /usr/local/lib/crda/regulatory.bin as first in path

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agocrda: allow loading of regulatory.bin from /lib/crda in addition to /usr/lib/crda
Helmut Schaa [Tue, 24 Feb 2009 14:31:50 +0000 (15:31 +0100)]
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>
15 years agoFix Makefile to not overwrite udev/regulatory.rules for SBINDIR changes
Luis R. Rodriguez [Tue, 24 Feb 2009 19:41:49 +0000 (11:41 -0800)]
Fix Makefile to not overwrite udev/regulatory.rules for SBINDIR changes

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoalso replace the SBINDIR used in the rules file
Daniel Mierswa [Wed, 11 Feb 2009 07:39:55 +0000 (08:39 +0100)]
also replace the SBINDIR used in the rules file

15 years agouse SBINDIR in install target of CRDA
Daniel Mierswa [Fri, 6 Feb 2009 14:00:35 +0000 (15:00 +0100)]
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.