Sync from SUSE:SLFO:Main crda revision e3cce2fb3fa2da9db017e6c79fba536a

This commit is contained in:
Adrian Schröter 2024-05-03 11:54:00 +02:00
commit 4893ee0821
10 changed files with 769 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
crda-4.14.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,31 @@
commit 67f1e6ddbdfade357e234c9d58a30fe0a283fe60
Author: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Fri Nov 9 17:23:23 2018 +0100
crda: add URLs to README
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>
diff --git a/README b/README
index 5d89b83..88f2623 100644
--- a/README
+++ b/README
@@ -1,5 +1,6 @@
Central Regulatory Domain Agent (CRDA)
========================================
+<https://wireless.wiki.kernel.org/en/developers/regulatory/crda>
This is the Central Regulatory Domain Agent for Linux. It serves one
purpose: tell Linux kernel what to enforce. In essence it is a udev
@@ -46,6 +47,7 @@ with this package as regulatory.rules
OVERVIEW
==========
+<https://wireless.wiki.kernel.org/en/developers/regulatory>
The database is maintained on the wireless-regdb.git tree. This git
tree maintains a binary regulatory database file which is produced

103
crda-default.patch Normal file
View File

@ -0,0 +1,103 @@
Provide an option to specify a reg code in /etc/default/crda
and also try a distribution configuration /usr/etc/default/crda.
This solves bug boo#1179308
---
crda.8 | 17 ++++++++++++++++-
crda.c | 43 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/crda.8 b/crda.8
--- a/crda.8
+++ b/crda.8
@@ -68,7 +68,22 @@ An example udev rule which can be used (
.B /lib/udev/rules.d/85-regulatory.rules
):
-.I KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/crda"
+.I KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/usr/sbin/crda"
+
+.SS
+.SH Standard configuration
+in the file
+.I /usr/etc/default/crda
+the variable
+.B REGDOMAIN
+is set to the global WLAN default code
+.BR 00 .
+The local administrator might copy this file to
+.I /etc/default/crda
+and set the ISO / IEC 3166 alpha2 country code of the local area. Then
+any execution of
+.B crda
+will then send this as regulatory domain for that alpha2 to the kernel.
.SS
.SH Environment variable
diff --git a/crda.c b/crda.c
--- a/crda.c
+++ b/crda.c
@@ -4,6 +4,7 @@
* Userspace helper which sends regulatory domains to Linux via nl80211
*/
+#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
@@ -156,6 +157,11 @@ int main(int argc, char **argv)
struct nlattr *nl_reg_rules;
const struct ieee80211_regdomain *rd = NULL;
+ const char *default_paths[] = {
+ "/etc/default/crda", /* Users configuration if COUNTRY is not set */
+ "/usr/etc/default/crda", /* General configuration if COUNTRY is not set */
+ NULL
+ };
const char *regdb_paths[] = {
"/usr/local/lib/crda/regulatory.bin", /* Users/preloads can override */
"/usr/lib/crda/regulatory.bin", /* General distribution package usage */
@@ -171,8 +177,41 @@ int main(int argc, char **argv)
env_country = getenv("COUNTRY");
if (!env_country) {
- fprintf(stderr, "COUNTRY environment variable not set.\n");
- return -EINVAL;
+ const char **conf = default_paths;
+ while (*conf != NULL) {
+ fd = open(*conf, O_RDONLY);
+ if (fd >= 0)
+ break;
+ conf++;
+ }
+ if (fd >= 0) {
+ FILE *reg = fdopen(fd, "r");
+ if (reg) {
+ char *line = NULL;
+ ssize_t nread;
+ size_t len = 0;
+ while ((nread = getline(&line, &len, reg)) != -1) {
+ char *ptr = line;
+ if (*ptr == '#' || *ptr == '\n')
+ continue;
+ while (isspace(*ptr))
+ line++;
+ if (strncmp("REGDOMAIN=", ptr, 10) == 0) {
+ ptr += 10;
+ env_country = strndup(ptr, 2);
+ break;
+ }
+ }
+ if (line)
+ free(line);
+ fclose(reg);
+ } else
+ close(fd);
+ }
+ if (!env_country) {
+ fprintf(stderr, "COUNTRY environment variable not set.\n");
+ return -EINVAL;
+ }
}
if (!reglib_is_valid_regdom(env_country)) {

View File

@ -0,0 +1,38 @@
commit f4ef2531698fb9ba006e8b31a223b3269be8bc7c
Author: Luis Chamberlain <mcgrof@kernel.org>
Date: Wed Nov 21 17:07:45 2018 -0800
README: add legacy notice
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>
diff --git a/README b/README
index 88f2623..7d39891 100644
--- a/README
+++ b/README
@@ -3,11 +3,17 @@
<https://wireless.wiki.kernel.org/en/developers/regulatory/crda>
This is the Central Regulatory Domain Agent for Linux. It serves one
-purpose: tell Linux kernel what to enforce. In essence it is a udev
-helper for communication between the kernel and userspace. You only
-need to run this manually for debugging purposes. For manual changing
-of regulatory domains use iw (iw reg set) or wpa_supplicant (feature
-yet to be added).
+purpose: tell Linux kernel what regulatory ruels to enforce for 802.11.
+
+CRDA is no longer needed as of kernel v4.15 since commit 007f6c5e6eb45
+("cfg80211: support loading regulatory database as firmware file") added
+support to use the kernel's firmware request API which looks for the
+firmware on /lib/firmware. Because of this CRDA is legacy software for
+older kernels. It will continue to be maintained.
+
+CRDA is a udev helper for communication between the kernel and userspace. You
+only need to run this manually for debugging purposes. For manual changing of
+regulatory domains use iw (iw reg set) or wpa_supplicant.
HOST REQUIREMENTS
===================

259
crda-python3.patch Normal file
View File

@ -0,0 +1,259 @@
From: Taahir Ahmed <ahmed.taahir@xxxxxxxxx>
utils/key2pub.py can now be run under either python 2.7 or python 3.x.
This required some minor syntactical changes as well as switching from
M2Crypto to pycrypto, since M2Crypto doesn't support python 3.x.
In addition, some errors in the generated source file keys-ssl.h are
fixed:
* The correct OpenSSL header for BN_ULONG is included.
* The generated constants are given the 'ull' suffix to prevent
warnings about constants that are too large.
---
Makefile | 2 +-
utils/key2pub.py | 146 ++++++++++++++++++++++++++++---------------------------
2 files changed, 75 insertions(+), 73 deletions(-)
diff --git a/Makefile b/Makefile
index a3ead30..65fc780 100644
--- a/Makefile
+++ b/Makefile
@@ -112,7 +112,7 @@ $(REG_BIN):
keys-%.c: utils/key2pub.py $(wildcard $(PUBKEY_DIR)/*.pem)
$(NQ) ' GEN ' $@
$(NQ) ' Trusted pubkeys:' $(wildcard $(PUBKEY_DIR)/*.pem)
- $(Q)./utils/key2pub.py --$* $(wildcard $(PUBKEY_DIR)/*.pem) $@
+ $(Q) python3 ./utils/key2pub.py --$* $(wildcard $(PUBKEY_DIR)/*.pem) $@
$(LIBREG): regdb.h reglib.h reglib.c
$(NQ) ' CC ' $@
diff --git a/utils/key2pub.py b/utils/key2pub.py
index 3e84cd2..ff92748 100755
--- a/utils/key2pub.py
+++ b/utils/key2pub.py
@@ -1,126 +1,128 @@
#!/usr/bin/env python
+import io
import sys
try:
- from M2Crypto import RSA
-except ImportError, e:
- sys.stderr.write('ERROR: Failed to import the "M2Crypto" module: %s\n' % e.message)
- sys.stderr.write('Please install the "M2Crypto" Python module.\n')
- sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n')
- sys.exit(1)
+ from Crypto.PublicKey import RSA
+except ImportError as e:
+ sys.stderr.write('ERROR: Failed to import the "Crypto.PublicKey" module: %s\n' % e.message)
+ sys.stderr.write('Please install the "Crypto.PublicKey" Python module.\n')
+ sys.stderr.write('On Debian GNU/Linux the package is called "python-crypto".\n')
+ sys.exit(1)
+
+def bitwise_collect(value, radix_bits):
+ words = []
+ radix_mask = (1 << radix_bits) - 1
+ while value != 0:
+ words.append(value & radix_mask)
+ value >>= radix_bits
+ return words
def print_ssl_64(output, name, val):
- while val[0] == '\0':
- val = val[1:]
- while len(val) % 8:
- val = '\0' + val
- vnew = []
- while len(val):
- vnew.append((val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]))
- val = val[8:]
- vnew.reverse()
- output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew)))
+ # OpenSSL expects 64-bit words given least-significant-word first.
+ vwords = bitwise_collect(val, 64)
+
+ output.write(u'static BN_ULONG {}[] = {{\n'.format(name))
idx = 0
- for v1, v2, v3, v4, v5, v6, v7, v8 in vnew:
+ for vword in vwords:
if not idx:
- output.write('\t')
- output.write('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4), ord(v5), ord(v6), ord(v7), ord(v8)))
+ output.write(u'\t')
+ output.write(u'0x{:016x}ULL, '.format(vword))
idx += 1
if idx == 2:
idx = 0
- output.write('\n')
+ output.write(u'\n')
if idx:
- output.write('\n')
- output.write('};\n\n')
+ output.write(u'\n')
+ output.write(u'};\n\n')
def print_ssl_32(output, name, val):
- while val[0] == '\0':
- val = val[1:]
- while len(val) % 4:
- val = '\0' + val
- vnew = []
- while len(val):
- vnew.append((val[0], val[1], val[2], val[3], ))
- val = val[4:]
- vnew.reverse()
- output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew)))
+ # OpenSSL expects 32-bit words given least-significant-word first.
+ vwords = bitwise_collect(val, 32)
+
+ output.write(u'static BN_ULONG {}[] = {{\n'.format(name))
idx = 0
- for v1, v2, v3, v4 in vnew:
+ for vword in vwords:
if not idx:
- output.write('\t')
- output.write('0x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4)))
+ output.write(u'\t')
+ output.write(u'0x{:08x}, '.format(vword))
idx += 1
if idx == 4:
idx = 0
- output.write('\n')
+ output.write(u'\n')
if idx:
- output.write('\n')
- output.write('};\n\n')
+ output.write(u'\n')
+ output.write(u'};\n\n')
def print_ssl(output, name, val):
+
+ output.write(u'#include <stdint.h>\n')
+ output.write(u'#include <openssl/bn.h>\n')
+
import struct
- output.write('#include <stdint.h>\n')
if len(struct.pack('@L', 0)) == 8:
return print_ssl_64(output, name, val)
else:
return print_ssl_32(output, name, val)
def print_ssl_keys(output, n):
- output.write(r'''
+ output.write(u'''
struct pubkey {
struct bignum_st e, n;
};
-#define KEY(data) { \
- .d = data, \
- .top = sizeof(data)/sizeof(data[0]), \
+#define KEY(data) { \\
+ .d = data, \\
+ .top = sizeof(data)/sizeof(data[0]), \\
}
-#define KEYS(e,n) { KEY(e), KEY(n), }
+#define KEYS(e,n) { KEY(e), KEY(n), }
static struct pubkey keys[] = {
''')
for n in xrange(n + 1):
- output.write(' KEYS(e_%d, n_%d),\n' % (n, n))
- output.write('};\n')
+ output.write(u' KEYS(e_{0}, n_{0}),\n'.format(n))
+ output.write(u'};\n')
pass
def print_gcrypt(output, name, val):
- output.write('#include <stdint.h>\n')
- while val[0] == '\0':
- val = val[1:]
- output.write('static const uint8_t %s[%d] = {\n' % (name, len(val)))
+ # gcrypt expects 8-bit words most-significant-word first
+ vwords = bitwise_collect(val, 8)
+ vwords.reverse()
+
+ output.write(u'#include <stdint.h>\n')
+ output.write(u'static const uint8_t %s[%d] = {\n' % (name, len(vwords)))
idx = 0
- for v in val:
+ for vword in vwords:
if not idx:
- output.write('\t')
- output.write('0x%.2x, ' % ord(v))
+ output.write(u'\t')
+ output.write(u'0x{:02x}, '.format(vword))
idx += 1
if idx == 8:
idx = 0
- output.write('\n')
+ output.write(u'\n')
if idx:
- output.write('\n')
- output.write('};\n\n')
+ output.write(u'\n')
+ output.write(u'};\n\n')
def print_gcrypt_keys(output, n):
- output.write(r'''
+ output.write(u'''
struct key_params {
const uint8_t *e, *n;
uint32_t len_e, len_n;
};
-#define KEYS(_e, _n) { \
- .e = _e, .len_e = sizeof(_e), \
- .n = _n, .len_n = sizeof(_n), \
+#define KEYS(_e, _n) { \\
+ .e = _e, .len_e = sizeof(_e), \\
+ .n = _n, .len_n = sizeof(_n), \\
}
static const struct key_params __attribute__ ((unused)) keys[] = {
''')
- for n in xrange(n + 1):
- output.write(' KEYS(e_%d, n_%d),\n' % (n, n))
- output.write('};\n')
-
+ for n in range(n + 1):
+ output.write(u' KEYS(e_{0}, n_{0}),\n'.format(n))
+ output.write(u'};\n')
+
modes = {
'--ssl': (print_ssl, print_ssl_keys),
@@ -135,21 +137,21 @@ except IndexError:
mode = None
if not mode in modes:
- print 'Usage: %s [%s] input-file... output-file' % (sys.argv[0], '|'.join(modes.keys()))
+ print('Usage: {} [{}] input-file... output-file'.format(sys.argv[0], '|'.join(modes.keys())))
sys.exit(2)
-output = open(outfile, 'w')
+output = io.open(outfile, 'w')
# load key
idx = 0
for f in files:
- try:
- key = RSA.load_pub_key(f)
- except RSA.RSAError:
- key = RSA.load_key(f)
- modes[mode][0](output, 'e_%d' % idx, key.e[4:])
- modes[mode][0](output, 'n_%d' % idx, key.n[4:])
+ key_contents = io.open(f, 'rb').read()
+ key = RSA.importKey(key_contents)
+
+ modes[mode][0](output, 'e_{}'.format(idx), key.e)
+ modes[mode][0](output, 'n_{}'.format(idx), key.n)
+
idx += 1
modes[mode][1](output, idx - 1)

157
crda.changes Normal file
View File

@ -0,0 +1,157 @@
-------------------------------------------------------------------
Tue Dec 27 10:29:57 UTC 2022 - Ludwig Nussel <lnussel@suse.com>
- Replace transitional %usrmerged macro with regular version check (boo#1206798)
-------------------------------------------------------------------
Tue Dec 1 14:56:43 UTC 2020 - Dr. Werner Fink <werner@suse.de>
- Correct upstream URL and upstream release URL
-------------------------------------------------------------------
Mon Nov 30 13:40:28 UTC 2020 - Dr. Werner Fink <werner@suse.de>
- Add patch crda-default.patch as well as template file crda.default
for /usr/etc/default/crda to support WLAN USB dongles as well as
mostly raspberry WLAN drivers not knowing about kernel builtin
support for WLAN regular country domains (boo#1179308)
-------------------------------------------------------------------
Tue Nov 17 13:43:31 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
- prepare usrmerge (boo#1029961)
-------------------------------------------------------------------
Mon Aug 17 17:34:41 CEST 2020 - ro@suse.de
- update to 4.14 and update home URL to use the github project
- fix keys defined but not used error
- add patch from upstream
crda-67f1e6ddbdfade357e234c9d58a30fe0a283fe60.patch
- add URLs to README
- add patch from upstream
crda-f4ef2531698fb9ba006e8b31a223b3269be8bc7c.patch
- add legacy note to README
- ## CRDA is no longer needed as of kernel v4.15
-------------------------------------------------------------------
Thu Mar 12 11:34:19 CET 2020 - ro@suse.de
- add patch crda-python3.patch to build using python3
it is actually only used for a small helper script splitting
pem files to individual keys
-------------------------------------------------------------------
Sat Jun 3 09:30:42 UTC 2017 - meissner@suse.com
- adjust Makefile patch to not include CFLAGS on linker line,
this indirectly enables PIE support.
-------------------------------------------------------------------
Wed May 25 09:27:14 UTC 2016 - martin.liska@suse.com
- Add gcc6-fix-errors.patch to remove errors seen by GCC6.
-------------------------------------------------------------------
Sun Jun 28 10:57:08 UTC 2015 - seife+obs@b1-systems.com
- update to version 3.18:
* user visible: add pubkey of new wireless-regdb maintainer to
make crda work at all with newer wireless-regdb
* synchronize code with latest kernel changes
* crda: add AUTO-BW rule flag support
* crda: parse/print CAC time
* code restructuring and bug fixes
*** License is now copyleft-next-0.3.0 ***
- packaging:
* add V=1 to make calls for rpmlint happiness
* use %%optflags for compilation
* shared library libreg.so is now used by the tools
-------------------------------------------------------------------
Sun Nov 24 20:21:37 UTC 2013 - crrodriguez@opensuse.org
- use libnl3 which is now supported
-------------------------------------------------------------------
Sat Nov 23 05:17:29 UTC 2013 - crrodriguez@opensuse.org
- update to 1.1.3 release (no changelog)
- run %udev_rules_update in %post if defined
- Correct _udevrulesdir definition for old distros
-------------------------------------------------------------------
Fri Mar 22 08:29:25 UTC 2013 - mmeister@suse.com
- Added url as source.
Please see http://en.opensuse.org/SourceUrls
-------------------------------------------------------------------
Wed Oct 17 11:19:13 UTC 2012 - fcrozat@suse.com
- Fix build with udev rules directory new location.
-------------------------------------------------------------------
Thu Sep 13 11:11:28 UTC 2012 - cfarrell@suse.com
- license update: ISC
License is ISC, not BSD-3-Clause
-------------------------------------------------------------------
Sun Sep 9 18:28:40 UTC 2012 - p.drouand@gmail.com
- update to 1.1.2 release
-------------------------------------------------------------------
Tue Feb 28 14:39:33 UTC 2012 - pcerny@suse.com
- use correct filepath in udev rule
-------------------------------------------------------------------
Sat Feb 4 15:37:28 UTC 2012 - rschweikert@suse.com
- put files in /usr tree (UsrMerge project)
-------------------------------------------------------------------
Sat Sep 17 23:59:07 UTC 2011 - jengelh@medozas.de
- Remove redundant tags/sections from specfile
- Use %_smp_mflags for parallel build
-------------------------------------------------------------------
Fri Sep 16 12:02:37 UTC 2011 - jengelh@medozas.de
- Select libnl-1_1-devel
-------------------------------------------------------------------
Fri Mar 5 01:35:46 CET 2010 - ro@suse.de
- update to 1.1.1 release
-------------------------------------------------------------------
Sat Oct 10 16:04:31 UTC 2009 - crrodriguez@opensuse.org
- update to git200910101747, fix build
-------------------------------------------------------------------
Tue Jul 28 21:29:47 CEST 2009 - aj@suse.de
- Update to crda 1.1.0:
* make openssl keys 64-bit safe
-------------------------------------------------------------------
Mon Mar 2 10:58:57 CET 2009 - hschaa@suse.de
- Add "Supplements: kernel" and "Requires: wireless-regdb"
-------------------------------------------------------------------
Mon Feb 9 12:27:04 CET 2009 - hschaa@suse.de
- Update to 1.0.1
- Needed for fate#305301
-------------------------------------------------------------------
Sat Jan 24 13:00:00 CET 2007 - helmut.schaa@googlemail.com
- Initial package

8
crda.default Normal file
View File

@ -0,0 +1,8 @@
#
# Used by the crda(8) helper to set the country code for the WLAN
# location. Outside the US or without self-managed WLAN devices
# it is helpful to copy this file to /etc/default/ and set the
# two letter specific ISO / IEC 3166 alpha2 country code.
#
REGDOMAIN=00

105
crda.spec Normal file
View File

@ -0,0 +1,105 @@
#
# spec file for package crda
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{!?_udevrulesdir: %global _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d }
%define skip_python2 1
Name: crda
Summary: 802.11 central regulatory domain agent
License: SUSE-Copyleft-Next-0.3.0
Group: Hardware/Wifi
URL: https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA
Version: 4.14
Release: 0
Source0: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git/snapshot/crda-%{version}.tar.gz
Source1: crda.default
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libgcrypt-devel
BuildRequires: pkg-config
BuildRequires: python3
BuildRequires: python3-pycrypto
BuildRequires: wireless-regdb
BuildRequires: pkgconfig(libnl-3.0)
BuildRequires: pkgconfig(udev)
Requires: wireless-regdb
Supplements: kernel >= 2.6.29
# PATCH-FIX-OPENSUSE gcc6-fix-errors.patch -- Fix errors seen by GCC6.
Patch0: gcc6-fix-errors.patch
# PATCH-FIX-OPENSUSE python2 is gone, port to python3
Patch1: crda-python3.patch
# PATCH-FIX-UPSTREAM crda-67f1e6ddbdfade357e234c9d58a30fe0a283fe60.patch
Patch2: crda-67f1e6ddbdfade357e234c9d58a30fe0a283fe60.patch
# PATCH-FIX-UPSTREAM crda-f4ef2531698fb9ba006e8b31a223b3269be8bc7c.patch
Patch3: crda-f4ef2531698fb9ba006e8b31a223b3269be8bc7c.patch
# PATCH-FIX-SUSE crda-default.patch
Patch4: crda-default.patch
%description
The crda binary provides access to the wireless-regdb to the kernel
through udev.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
# make install calls 'ldconfig' and fails if it cannot run it...
ln -s /bin/true ldconfig
%build
export CFLAGS="%{optflags}"
make all_noverify %{?_smp_mflags} V=1
%install
# to find ldconfig...
export PATH=.:$PATH
make DESTDIR=$RPM_BUILD_ROOT SBINDIR=%{_sbindir}/ UDEV_RULE_DIR=%{_udevrulesdir} LIBDIR=%{_libdir} install
mkdir -p %{buildroot}%{_prefix}%{_sysconfdir}/default
install -m 644 %{S:1} %{buildroot}%{_prefix}%{_sysconfdir}/default/%{name}
%if 0%{?suse_version} < 1550
mkdir $RPM_BUILD_ROOT/sbin
ln -sf %{_sbindir}/{crda,regdbdump} $RPM_BUILD_ROOT/sbin
%endif
# clean up unneeded stuff...
rm -r %{buildroot}/usr/include/reglib
%files
%defattr(-,root,root)
%_sbindir/crda
%_sbindir/regdbdump
%_libdir/libreg.so
%if 0%{?suse_version} < 1550
/sbin/crda
/sbin/regdbdump
%endif
%if 0%{?suse_version} < 1550
%dir %{_prefix}%{_sysconfdir}/
%dir %{_prefix}%{_sysconfdir}/default/
%endif
%{_prefix}%{_sysconfdir}/default/%{name}
%{_udevrulesdir}/85-regulatory.rules
%{_mandir}/man8/crda.8.gz
%{_mandir}/man8/regdbdump.8.gz
%post
%{?udev_rules_update:%udev_rules_update}
%changelog

42
gcc6-fix-errors.patch Normal file
View File

@ -0,0 +1,42 @@
Index: crda-3.18/Makefile
===================================================================
--- crda-3.18.orig/Makefile
+++ crda-3.18/Makefile
@@ -26,7 +26,7 @@ PUBKEY_DIR?=pubkeys
RUNTIME_PUBKEY_DIR?=/etc/wireless-regdb/pubkeys
CFLAGS += -O2 -fpic
-CFLAGS += -std=gnu99 -Wall -Werror -pedantic
+CFLAGS += -std=gnu99 -Wall -Werror -Wno-unused-const-variable -pedantic
CFLAGS += -Wall -g
LDLIBREG += -lreg
LDLIBS += $(LDLIBREG)
@@ -135,23 +135,23 @@ install-libreg:
crda: crda.o
$(NQ) ' LD ' $@
- $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(NLLIBS)
+ $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(NLLIBS)
regdbdump: regdbdump.o
$(NQ) ' LD ' $@
- $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+ $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
intersect: intersect.o
$(NQ) ' LD ' $@
- $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+ $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
db2rd: db2rd.o
$(NQ) ' LD ' $@
- $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+ $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
optimize: optimize.o
$(NQ) ' LD ' $@
- $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+ $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
verify: $(REG_BIN) regdbdump
$(NQ) ' CHK $(REG_BIN)'