diff --git a/crda-3.18.tar.xz b/crda-3.18.tar.xz deleted file mode 100644 index eee0108..0000000 --- a/crda-3.18.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:43fcb9679f8b75ed87ad10944a506292def13e4afb194afa7aa921b01e8ecdbf -size 61516 diff --git a/crda-4.14.tar.gz b/crda-4.14.tar.gz new file mode 100644 index 0000000..62d5548 --- /dev/null +++ b/crda-4.14.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a8f35bb8b27474f466b0e75d451ba917433d8aab1889678a64d9c4e72a8b8c2 +size 72753 diff --git a/crda-67f1e6ddbdfade357e234c9d58a30fe0a283fe60.patch b/crda-67f1e6ddbdfade357e234c9d58a30fe0a283fe60.patch new file mode 100644 index 0000000..2c6234d --- /dev/null +++ b/crda-67f1e6ddbdfade357e234c9d58a30fe0a283fe60.patch @@ -0,0 +1,31 @@ +commit 67f1e6ddbdfade357e234c9d58a30fe0a283fe60 +Author: Xose Vazquez Perez +Date: Fri Nov 9 17:23:23 2018 +0100 + + crda: add URLs to README + + Cc: Luis R. Rodriguez + Cc: WIRELESS ML + Cc: REGDB ML + Signed-off-by: Xose Vazquez Perez + Signed-off-by: Luis Chamberlain + +diff --git a/README b/README +index 5d89b83..88f2623 100644 +--- a/README ++++ b/README +@@ -1,5 +1,6 @@ + Central Regulatory Domain Agent (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 + ========== ++ + + The database is maintained on the wireless-regdb.git tree. This git + tree maintains a binary regulatory database file which is produced diff --git a/crda-default.patch b/crda-default.patch new file mode 100644 index 0000000..cca5ed9 --- /dev/null +++ b/crda-default.patch @@ -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 + #include + #include + #include +@@ -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)) { diff --git a/crda-f4ef2531698fb9ba006e8b31a223b3269be8bc7c.patch b/crda-f4ef2531698fb9ba006e8b31a223b3269be8bc7c.patch new file mode 100644 index 0000000..143483e --- /dev/null +++ b/crda-f4ef2531698fb9ba006e8b31a223b3269be8bc7c.patch @@ -0,0 +1,38 @@ +commit f4ef2531698fb9ba006e8b31a223b3269be8bc7c +Author: Luis Chamberlain +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 + +diff --git a/README b/README +index 88f2623..7d39891 100644 +--- a/README ++++ b/README +@@ -3,11 +3,17 @@ + + + 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 + =================== diff --git a/crda-python3.patch b/crda-python3.patch index c93569c..b3b02ae 100644 --- a/crda-python3.patch +++ b/crda-python3.patch @@ -213,7 +213,7 @@ index 3e84cd2..ff92748 100755 + .n = _n, .len_n = sizeof(_n), \\ } - static const struct key_params keys[] = { + static const struct key_params __attribute__ ((unused)) keys[] = { ''') - for n in xrange(n + 1): - output.write(' KEYS(e_%d, n_%d),\n' % (n, n)) diff --git a/crda.changes b/crda.changes index 1d601c4..c624d8d 100644 --- a/crda.changes +++ b/crda.changes @@ -1,3 +1,34 @@ +------------------------------------------------------------------- +Tue Dec 1 14:56:43 UTC 2020 - Dr. Werner Fink + +- Correct upstream URL and upstream release URL + +------------------------------------------------------------------- +Mon Nov 30 13:40:28 UTC 2020 - Dr. Werner Fink + +- 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 + +- 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 diff --git a/crda.default b/crda.default new file mode 100644 index 0000000..0e19935 --- /dev/null +++ b/crda.default @@ -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 diff --git a/crda.spec b/crda.spec index 76ffdd7..5b93e55 100644 --- a/crda.spec +++ b/crda.spec @@ -23,10 +23,11 @@ Name: crda Summary: 802.11 central regulatory domain agent License: SUSE-Copyleft-Next-0.3.0 Group: Hardware/Wifi -URL: http://linuxwireless.org/en/developers/Regulatory/CRDA -Version: 3.18 +URL: https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA +Version: 4.14 Release: 0 -Source: http://kernel.org/pub/software/network/crda/crda-%{version}.tar.xz +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 @@ -39,7 +40,14 @@ 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 @@ -49,6 +57,9 @@ through udev. %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 @@ -60,10 +71,12 @@ make all_noverify %{?_smp_mflags} V=1 # to find ldconfig... export PATH=.:$PATH make DESTDIR=$RPM_BUILD_ROOT SBINDIR=%{_sbindir}/ UDEV_RULE_DIR=%{_udevrulesdir} LIBDIR=%{_libdir} install -#UsrMerge +mkdir -p %{buildroot}%{_prefix}%{_sysconfdir}/default +install -m 644 %{S:1} %{buildroot}%{_prefix}%{_sysconfdir}/default/%{name} +%if !0%{?usrmerged} mkdir $RPM_BUILD_ROOT/sbin ln -sf %{_sbindir}/{crda,regdbdump} $RPM_BUILD_ROOT/sbin -#EndUserMerge +%endif # clean up unneeded stuff... rm -r %{buildroot}/usr/include/reglib @@ -73,10 +86,15 @@ rm -r %{buildroot}/usr/include/reglib %_sbindir/crda %_sbindir/regdbdump %_libdir/libreg.so -#UsrMerge +%if !0%{?usrmerged} /sbin/crda /sbin/regdbdump -#EndUserMerge +%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