Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 685424 - net-wireless/iwd should depend on net-wireless/crda
Summary: net-wireless/iwd should depend on net-wireless/crda
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ben Kohler
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-09 04:09 UTC by Gino McCarty
Modified: 2019-05-13 13:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
net-wirless/iwd-0.17-r2: crda added (iwd-0.17-r2.ebuild,3.16 KB, text/plain)
2019-05-09 20:44 UTC, Gino McCarty
Details
net-wirless/iwd-0.17-r2 (iwd-0.17-r2.ebuild,3.14 KB, text/plain)
2019-05-09 20:53 UTC, Gino McCarty
Details
Proposed ebuild change (ebuild.patch,1.75 KB, patch)
2019-05-10 12:59 UTC, Ben Kohler
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gino McCarty 2019-05-09 04:09:44 UTC
On a pure iwd system, crda is never pulled in, and the regulatory domain for the wireless card is never set.
This can be bad / annoying for non-US and 5Ghz bands.

iwd should really do just like wpa_supplicant does and add a dependency for this package.

I see no documentation stating that iwd will now or in the future offer this functionality internally.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2019-05-09 05:54:41 UTC
(In reply to Gino McCarty from comment #0)
> On a pure iwd system, crda is never pulled in, and the regulatory domain for
> the wireless card is never set.
> This can be bad / annoying for non-US and 5Ghz bands.

Or an in-kernel regdb does the job just fine - for those people who use that, pulling in crda would be pointless. For those who need it, `emerge crda` would do the job just as well as pulling it in as if iwd requires it.
Comment 2 Gino McCarty 2019-05-09 05:57:12 UTC
if you feel iwd should require regdb in kernel then perhaps CONFIG_CHECK should be updated to reflect that
Comment 3 Gino McCarty 2019-05-09 06:10:06 UTC
Honestly I had not heard of in-kernel crda until you mentioned it.
But looks like wireless team at kernel.org recommends against it. And thinks crda should be handled in userspace
https://wireless.wiki.kernel.org/en/developers/regulatory/crda

I also asked this question to iwd team in their irc room, though i doubt i'll see a response there.
Comment 4 Ben Kohler gentoo-dev 2019-05-09 13:13:33 UTC
(In reply to Gino McCarty from comment #3)
> Honestly I had not heard of in-kernel crda until you mentioned it.
> But looks like wireless team at kernel.org recommends against it. And thinks
> crda should be handled in userspace
> https://wireless.wiki.kernel.org/en/developers/regulatory/crda
> 
> I also asked this question to iwd team in their irc room, though i doubt
> i'll see a response there.

That doc refers to the old in-kernel method, the newer method loads a regulatory.db file from /lib/firmware when the cfg80211 module loads.

See https://www.kernel.org/doc/Documentation/networking/regulatory.txt and https://wireless.wiki.kernel.org/en/developers/Regulatory for more up to date information.
Comment 5 Ben Kohler gentoo-dev 2019-05-09 13:19:26 UTC
(In reply to Gino McCarty from comment #2)
> if you feel iwd should require regdb in kernel then perhaps CONFIG_CHECK
> should be updated to reflect that

I've wanted to address this for a while but I'm not entirely sure of how to best accomplish it.

I'm thinking IUSE=+crda to pull in crda dep by default, then for USE=-crda do some CONFIG_* checks.

But the CONFIG_* checks aren't easy to get right.  The cfg80211 module looks for the regulatory.db file in /lib/firwmare when it initializes, similar to how (eg) iwlwifi needs firmware at module load time.

So we'd need to either check for CONFIG_CFG80211=m + installed linux-firmware, or CONFIG_CFG80211=y + CONFIG_EXTRA_FIRMWARE="regulatory.db".

It might be easier to just explain in text what the correct setup looks like, with einfo.  Suggestions welcome.
Comment 6 Gino McCarty 2019-05-09 20:44:52 UTC
Created attachment 575620 [details]
net-wirless/iwd-0.17-r2: crda added

OK, Here is my initial draft based on your comments, however I'm not sure as to which 

CFG80211_CERTIFICATION_ONUS seemed best

also EXTRA_FIRMWARE isn't needed, as long as wireless-regdb is installed the files are put into the appropriate place automatically

we could also include CFG80211_USE_KERNEL_REGDB_KEYS, but it seems excessive since we don't actually care if the db package is signed or not
Comment 7 Gino McCarty 2019-05-09 20:53:35 UTC
Created attachment 575622 [details]
net-wirless/iwd-0.17-r2

fixed some typos
Comment 8 Ben Kohler gentoo-dev 2019-05-09 21:05:14 UTC
Can you use an ebuild diff for further attachments so we can see what you're adding at a glance?

I am unsure if we should be checking for or messing with CFG80211_CERTIFICATION_ONUS at all.  I will have to read up on that.

EXTRA_FIRMWARE *is* needed if the user has CONFIG_CFG80211=y (aka <*>, built-in)... and I suspect most gentoo users will have that.  Otherwise /lib/firmware/regulatory.db won't be available yet when cfg80211 initializes.

Please test your ebuild, as it looks to me like you've still got several typos & outright invalid code.

I think for USE=crda we need to check for CFG80211_CRDA_SUPPORT, and for USE=-crda we either need to find a way to check for CFG80211=m (not =y), or allow CFG80211=y + EXTRA_FIRMWARE="regulatory.db".
Comment 9 Gino McCarty 2019-05-10 04:28:07 UTC
--- /usr/portage/net-wireless/iwd/iwd-0.17-r1.ebuild    2019-04-13 18:31:20.942851832 -0700
+++ iwd-0.17-r2.ebuild  2019-05-09 21:27:28.715245812 -0700
@@ -17,11 +17,13 @@
 
 LICENSE="GPL-2"
 SLOT="0"
-IUSE="+client +monitor ofono wired cpu_flags_x86_aes cpu_flags_x86_ssse3"
+IUSE="+client +crda +monitor ofono wired cpu_flags_x86_aes cpu_flags_x86_ssse3"
 
 RDEPEND=">=dev-libs/ell-0.18
        sys-apps/dbus
-       client? ( sys-libs/readline:0= )"
+       client? ( sys-libs/readline:0= )
+       crda? ( net-wireless/crda )
+       net-wireless/wireless-regdb"

 DEPEND="${RDEPEND}
        virtual/pkgconfig"
@@ -48,7 +50,13 @@
                ~KEY_DH_OPERATIONS
                ~PKCS7_MESSAGE_PARSER
                ~X509_CERTIFICATE_PARSER
+               crda? ( ~CFG80211_CRDA_SUPPORT )
+               !crda? ( ~CFG80211_CERTIFICATION_ONUS )
        "
+       if ! use crda;then
+               WARNING_CFG80211_CERTIFICATION_ONUS="CFG80211_CERTIFICATION_ONUS: enable to setup WiFi regulatory domain"
+       fi
+
        if use amd64;then
                CONFIG_CHECK="${CONFIG_CHECK} ~CRYPTO_AES_X86_64 ~CRYPTO_DES3_EDE_X86_64"
                WARNING_CRYPTO_AES_X86_64="CRYPTO_AES_X86_64: enable for increased performance"
@@ -107,6 +115,10 @@

        newinitd "${FILESDIR}/iwd.initd" iwd

+       if use wired;then
+               newinitd "${FILESDIR}/ead.initd" ead
+       fi
+
        if [[ ${PV} == "9999" ]] ; then
                exeinto /usr/share/iwd/scripts/
                doexe test/*
Comment 10 Gino McCarty 2019-05-10 04:30:40 UTC
Maybe its best if we just ewarn people about -crda option for FIRMWARE_EXTRAS, and not require that regulatory.db exists in the config
Comment 11 Ben Kohler gentoo-dev 2019-05-10 12:59:27 UTC
Created attachment 575644 [details, diff]
Proposed ebuild change

See how this looks.  This default-enables a dep on crda, but allows disabling it.  When disabled, it checks for a suitable CFG80211 + regulatory.db loading setup.

Big fat warning if the checks show regulatory domain loading may be broken.
Comment 12 Ben Kohler gentoo-dev 2019-05-10 13:10:27 UTC
Can you also open a new bug for eap.initd?
Comment 13 Gino McCarty 2019-05-10 18:02:16 UTC
that looks good to me, I'll open a bug for ead
Comment 14 Larry the Git Cow gentoo-dev 2019-05-13 13:32:36 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8489d20fb0be0a64eaf4ef0f646b676eef824467

commit 8489d20fb0be0a64eaf4ef0f646b676eef824467
Author:     Ben Kohler <bkohler@gentoo.org>
AuthorDate: 2019-05-13 13:18:44 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2019-05-13 13:20:33 +0000

    net-wireless/iwd: bump to 0.18 & add regulatory domain checks
    
    Added new default-on dep on crda.  One can disable this flag & dep, to
    depend on the new in-kernel support, if so desired.  This requires the
    cfg80211 module to load firmware files when it initializes, so the
    usual firmware-loading requirements apply.
    
    I am not currently checking for the regulatory.db.p7s file that's
    required if CFG80211_REQUIRE_SIGNED_REGDB=y is set, that will be
    improved in the future.
    
    Closes: https://bugs.gentoo.org/683060
    Closes: https://bugs.gentoo.org/685424
    Closes: https://bugs.gentoo.org/685588
    Package-Manager: Portage-2.3.66, Repoman-2.3.12
    RepoMan-Options: --force
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 net-wireless/iwd/Manifest        |   1 +
 net-wireless/iwd/files/ead.initd |  12 ++++
 net-wireless/iwd/iwd-0.18.ebuild | 139 +++++++++++++++++++++++++++++++++++++++
 net-wireless/iwd/metadata.xml    |   1 +
 4 files changed, 153 insertions(+)