platform/upstream/crda.git
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>
13 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>
13 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>
13 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>
13 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>
13 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>
15 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>
15 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.

15 years agocrda: rename nl_handle to nl_sock for libnl-2.0
Pat Erley [Mon, 2 Feb 2009 23:16:42 +0000 (15:16 -0800)]
crda: rename nl_handle to nl_sock for libnl-2.0

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>
15 years agocrda: report if no supported version of libnl is found
Pavel Roskin [Fri, 30 Jan 2009 22:33:06 +0000 (14:33 -0800)]
crda: report if no supported version of libnl is found

Otherwise, the error messase would be very confusing.

15 years agoUpdate debian example changelog
Luis R. Rodriguez [Sun, 25 Jan 2009 03:22:51 +0000 (19:22 -0800)]
Update debian example changelog

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoUpdates spec file version
Luis R. Rodriguez [Sat, 24 Jan 2009 23:17:50 +0000 (15:17 -0800)]
Updates spec file version

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agocrda: Fix --as-needed usage v1.0.1
Diego E. 'Flameeyes' Pettenò [Sat, 24 Jan 2009 21:39:26 +0000 (13:39 -0800)]
crda: Fix --as-needed usage

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>
15 years agoAdds example debian package directory to help maintainers v1.0.0
Luis R. Rodriguez [Fri, 23 Jan 2009 23:36:13 +0000 (15:36 -0800)]
Adds example debian package directory to help maintainers

This one uses cdbs to make debian/rules smaller.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoAdds example RPM spec file (assumes 1.0.0 which I will mark shortly).
Luis R. Rodriguez [Fri, 23 Jan 2009 23:17:16 +0000 (15:17 -0800)]
Adds example RPM spec file (assumes 1.0.0 which I will mark shortly).

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoSmall makefile fix
Luis R. Rodriguez [Fri, 23 Jan 2009 23:03:08 +0000 (15:03 -0800)]
Small makefile fix

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoAdd regdbdump.8 man page and update Makefile
Luis R. Rodriguez [Fri, 23 Jan 2009 22:12:48 +0000 (14:12 -0800)]
Add regdbdump.8 man page and update Makefile

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>
15 years agoFix typo on man page regarding udev rule path
Luis R. Rodriguez [Fri, 23 Jan 2009 21:05:10 +0000 (13:05 -0800)]
Fix typo on man page regarding udev rule path

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoAdds a crda man page, update Makefile for distributions
Luis R. Rodriguez [Fri, 23 Jan 2009 20:54:18 +0000 (12:54 -0800)]
Adds a crda man page, update Makefile for distributions

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>
15 years agocrda: Throw verbose error message if M2Crypto is missing
Michael Buesch [Sun, 18 Jan 2009 13:59:25 +0000 (05:59 -0800)]
crda: Throw verbose error message if M2Crypto is missing

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>
15 years agocrda: prevent key2pub.py from generating bogus output on failure
Pavel Roskin [Sat, 10 Jan 2009 00:16:50 +0000 (19:16 -0500)]
crda: prevent key2pub.py from generating bogus output on failure

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>
15 years agoAdd a checker for REG_BIN and easy instructions on how to add it
Luis R. Rodriguez [Mon, 22 Dec 2008 20:18:19 +0000 (12:18 -0800)]
Add a checker for REG_BIN and easy instructions on how to add it

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoAllow CRDA to use new libnl2
Pat Erley [Mon, 22 Dec 2008 18:37:52 +0000 (10:37 -0800)]
Allow CRDA to use new libnl2

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>
15 years agocrda: fix two bugs
Johannes Berg [Wed, 10 Dec 2008 10:19:34 +0000 (11:19 +0100)]
crda: fix two bugs

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>
15 years agoSync nl80211.h - a few updates and now under the ISC license
Luis R. Rodriguez [Thu, 4 Dec 2008 03:01:54 +0000 (19:01 -0800)]
Sync nl80211.h - a few updates and now under the ISC license

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>
15 years agoUse Makefile dependency information for linking. l- v0.9.5
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 12:27:11 +0000 (13:27 +0100)]
Use Makefile dependency information for linking.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoSplit printing functions to their own translation unit.
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 12:27:04 +0000 (13:27 +0100)]
Split printing functions to their own translation unit.

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>
15 years agoMove is_valid_reg_rule() in intersect.c.
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 12:26:57 +0000 (13:26 +0100)]
Move is_valid_reg_rule() in intersect.c.

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>
15 years agoAvoid implicit declaration of memset() with OpenSSL.
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 11:11:31 +0000 (12:11 +0100)]
Avoid implicit declaration of memset() with OpenSSL.

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>
15 years agoMark constant the generated key tables for libgcrypt.
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 11:11:23 +0000 (12:11 +0100)]
Mark constant the generated key tables for libgcrypt.

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>
15 years agoMark functions static when not used outside their translation unit.
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 11:11:15 +0000 (12:11 +0100)]
Mark functions static when not used outside their translation unit.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoIgnore built files.
Diego E. 'Flameeyes' Pettenò [Mon, 1 Dec 2008 22:20:33 +0000 (14:20 -0800)]
Ignore built files.

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoDon't use recursive make for verify target
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 22:19:25 +0000 (14:19 -0800)]
Don't use recursive make for verify target

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>
15 years agoMake it possible to switch gcrypt/openssl via knob
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 22:17:46 +0000 (14:17 -0800)]
Make it possible to switch gcrypt/openssl via knob

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>
15 years agoFix dependencies for parallel make and others
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 22:04:36 +0000 (14:04 -0800)]
Fix dependencies for parallel make and others

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>
15 years agoFix building with --as-needed LD flag
Diego 'Flameeyes' Pettenò [Mon, 1 Dec 2008 22:01:43 +0000 (14:01 -0800)]
Fix building with --as-needed LD flag

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>
15 years agoInstall regdbdump v0.9.4
Luis R. Rodriguez [Mon, 24 Nov 2008 17:58:23 +0000 (09:58 -0800)]
Install regdbdump

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
15 years agoRename dump to regdbdump, update README v0.9.3
Luis R. Rodriguez [Mon, 24 Nov 2008 17:55:23 +0000 (09:55 -0800)]
Rename dump to regdbdump, update README

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoWe ship our own nl80211.h so remove KLIB stuff v0.9.2
Luis R. Rodriguez [Mon, 17 Nov 2008 22:13:37 +0000 (14:13 -0800)]
We ship our own nl80211.h so remove KLIB stuff

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoUpdate README and remove utils/web that the wireless-regdb.git sucked in.
Luis R. Rodriguez [Mon, 17 Nov 2008 21:56:08 +0000 (13:56 -0800)]
Update README and remove utils/web that the wireless-regdb.git sucked in.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoAdd linville's public key and use it, also do rely
Luis R. Rodriguez [Mon, 17 Nov 2008 21:39:56 +0000 (13:39 -0800)]
Add linville's public key and use it, also do rely
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>
16 years agoWhoops, forgot to git-mv regulatory.rules :)
Luis R. Rodriguez [Mon, 17 Nov 2008 19:43:11 +0000 (11:43 -0800)]
Whoops, forgot to git-mv regulatory.rules :)

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoMove regulatory.rules to its own dir
Luis R. Rodriguez [Mon, 17 Nov 2008 19:37:45 +0000 (11:37 -0800)]
Move regulatory.rules to its own dir

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoSeparate db.txt authorship from this package, also rely on
Luis R. Rodriguez [Mon, 17 Nov 2008 19:35:51 +0000 (11:35 -0800)]
Separate db.txt authorship from this package, also rely on
external URLs to retrieve the regulatory.bin and public keys.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoShip nl80211.h and use it v0.9.1
Luis R. Rodriguez [Thu, 30 Oct 2008 19:36:19 +0000 (12:36 -0700)]
Ship nl80211.h and use it

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoRemove some comments that no longer apply on intersect v0.9
Luis R. Rodriguez [Wed, 29 Oct 2008 10:41:55 +0000 (03:41 -0700)]
Remove some comments that no longer apply on intersect

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoThis fixes SIGSEGV and incorrect free() calls
Luis R. Rodriguez [Wed, 29 Oct 2008 10:33:43 +0000 (03:33 -0700)]
This fixes SIGSEGV and incorrect free() calls

This needs some more review...

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoMake intersection logic a bit more readable
Luis R. Rodriguez [Wed, 29 Oct 2008 10:32:07 +0000 (03:32 -0700)]
Make intersection logic a bit more readable

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoAdd intersection code, not working yet :(
Luis R. Rodriguez [Wed, 29 Oct 2008 09:41:22 +0000 (02:41 -0700)]
Add intersection code, not working yet :(

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoDouble pointers obfuscate code, die
Luis R. Rodriguez [Wed, 29 Oct 2008 08:53:13 +0000 (01:53 -0700)]
Double pointers obfuscate code, die

Lets make country2rd() easier to read by not using
double pointers.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agois_valid_reg_rule() is false when freq_diff is 0
Luis R. Rodriguez [Wed, 29 Oct 2008 08:45:03 +0000 (01:45 -0700)]
is_valid_reg_rule() is false when freq_diff is 0

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoAdd conversion utitlies, standardize printing
Luis R. Rodriguez [Tue, 28 Oct 2008 22:44:37 +0000 (15:44 -0700)]
Add conversion utitlies, standardize printing

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>
16 years agoShare common routines into a reg lib, other objects will later reuse.
Luis R. Rodriguez [Tue, 28 Oct 2008 22:15:36 +0000 (15:15 -0700)]
Share common routines into a reg lib, other objects will later reuse.

renamed:    regdb.c -> reglib.c
renamed:    crda.h -> reglib.h

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoMove last helpers to crda.h, forgot to add crda.h to git too
Luis R. Rodriguez [Tue, 28 Oct 2008 00:41:54 +0000 (17:41 -0700)]
Move last helpers to crda.h, forgot to add crda.h to git too

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoAvoid stdlib, this saves 145 bytes
Luis R. Rodriguez [Tue, 28 Oct 2008 00:39:38 +0000 (17:39 -0700)]
Avoid stdlib, this saves 145 bytes

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoMove common helpers and functions into crda.h
Luis R. Rodriguez [Tue, 28 Oct 2008 00:06:21 +0000 (17:06 -0700)]
Move common helpers and functions into crda.h

We keep regdb.h clean specifically for file regdb data structures.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoMakefile improvements.
Davide Pesavento [Thu, 23 Oct 2008 23:07:42 +0000 (01:07 +0200)]
Makefile improvements.

  * 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>
16 years agoFix some trivial warnings.
Davide Pesavento [Thu, 23 Oct 2008 23:07:16 +0000 (01:07 +0200)]
Fix some trivial warnings.

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>
16 years agoUse the correct index when iterating over the array of public keys.
Davide Pesavento [Thu, 23 Oct 2008 23:06:35 +0000 (01:06 +0200)]
Use the correct index when iterating over the array of public keys.

Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoUnify and share get_file_ptr() too.
Davide Pesavento [Thu, 23 Oct 2008 23:06:06 +0000 (01:06 +0200)]
Unify and share get_file_ptr() too.

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>
16 years agoIgnore more binary files.
Davide Pesavento [Thu, 23 Oct 2008 23:05:35 +0000 (01:05 +0200)]
Ignore more binary files.

Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoConsolidate db signature validation in one function.
Davide Pesavento [Thu, 23 Oct 2008 23:04:59 +0000 (01:04 +0200)]
Consolidate db signature validation in one function.

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>
16 years agocrda: Fix the keys-gcrypt.c target and remove key.priv.pem on clean
Evgeni Golov [Mon, 20 Oct 2008 15:47:32 +0000 (17:47 +0200)]
crda: Fix the keys-gcrypt.c target and remove key.priv.pem on clean

  * 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>
16 years agoFixed an inconsistency in OFDM and CCK flags definition
Benoit PAPILLAULT [Thu, 9 Oct 2008 20:16:42 +0000 (22:16 +0200)]
Fixed an inconsistency in OFDM and CCK flags definition

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>
16 years agoUse const and add is_valid_regdom() check
Benoit PAPILLAULT [Mon, 20 Oct 2008 16:03:30 +0000 (09:03 -0700)]
Use const and add is_valid_regdom() check

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Singed-off-by: Benoit PAPILLAULT <benoit.papillault@free.fr>
16 years agoAdded documentation on the file format
Benoit PAPILLAULT [Thu, 9 Oct 2008 20:16:39 +0000 (22:16 +0200)]
Added documentation on the file format

Signed-off-by: Benoit PAPILLAULT <benoit.papillault@free.fr>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoAdded libnl dependency
Benoit PAPILLAULT [Thu, 9 Oct 2008 20:16:38 +0000 (22:16 +0200)]
Added libnl dependency

Signed-off-by: Benoit PAPILLAULT <benoit.papillault@free.fr>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoRemove silly debug print from reg_handler()
Luis R. Rodriguez [Tue, 30 Sep 2008 15:10:17 +0000 (08:10 -0700)]
Remove silly debug print from reg_handler()

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoInitialize gcrypt in dump.c
Luis R. Rodriguez [Tue, 30 Sep 2008 15:08:58 +0000 (08:08 -0700)]
Initialize gcrypt in dump.c

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoMakefile: add support for DESTDIR.
Davide Pesavento [Sun, 28 Sep 2008 20:09:04 +0000 (22:09 +0200)]
Makefile: add support for DESTDIR.

Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoUse char literals in comparisons, instead of their ASCII codes.
Davide Pesavento [Sun, 28 Sep 2008 20:08:21 +0000 (22:08 +0200)]
Use char literals in comparisons, instead of their ASCII codes.

Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoDelay netlink initialization and cache allocation.
Davide Pesavento [Sun, 28 Sep 2008 20:07:27 +0000 (22:07 +0200)]
Delay netlink initialization and cache allocation.

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>
16 years agoDo not initialize gcrypt twice.
Davide Pesavento [Sun, 28 Sep 2008 20:06:36 +0000 (22:06 +0200)]
Do not initialize gcrypt twice.

Signed-off-by: Davide Pesavento <davidepesa@gmail.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoFix gcrypt initialization
Johannes Berg [Wed, 17 Sep 2008 22:56:30 +0000 (15:56 -0700)]
Fix gcrypt initialization

This seems to fix to get this to work on some versions of gcrypt.

16 years agoForgot once more place to remov NO-HT40
Luis R. Rodriguez [Fri, 5 Sep 2008 19:42:27 +0000 (12:42 -0700)]
Forgot once more place to remov NO-HT40

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoNo need for NO-HT20 or NO-HT40, remove them as this code isn't used yet
Luis R. Rodriguez [Fri, 5 Sep 2008 19:40:28 +0000 (12:40 -0700)]
No need for NO-HT20 or NO-HT40, remove them as this code isn't used yet
in userspace anywhere and kernel support hasn't been merged yet.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
16 years agoInstall regulatory.rules into udev directory.
Luis R. Rodriguez [Wed, 13 Aug 2008 00:33:48 +0000 (17:33 -0700)]
Install regulatory.rules into udev directory.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>