Wireless-regdb Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: rusty@rustcorp.com.au, dhowells@redhat.com,
	ming.lei@canonical.com, seth.forshee@canonical.com,
	kyle@kernel.org
Cc: mjg59@srcf.ucam.org, wireless-regdb@lists.infradead.org,
	keescook@chromium.org, tiwai@suse.de, gregkh@linuxfoundation.org,
	"Luis R. Rodriguez" <mcgrof@suse.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	jlee@suse.com, casey@schaufler-ca.com, akpm@linux-foundation.org
Subject: [wireless-regdb] [RFC v1 12/12] cfg80211: request for regulatory system data file
Date: Tue,  5 May 2015 17:44:30 -0700	[thread overview]
Message-ID: <1430873070-7290-13-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1430873070-7290-1-git-send-email-mcgrof@do-not-panic.com>

From: "Luis R. Rodriguez" <mcgrof@suse.com>

With sysdata_file_request_*() helpers in places we
don't need CRDA anymore, we can just request for the
regulatory file we need from within the kernel with
the kernel's configuration preferences for
cryptographic requirements.

-- this patch is incomplete still, it doesn't have
   any optional key preferences yet. This needs
   discussion.

Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 net/wireless/Kconfig | 20 +++++++++++++
 net/wireless/reg.c   | 85 ++++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 89 insertions(+), 16 deletions(-)

diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 29c8675..1610d30 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -152,6 +152,26 @@ config CFG80211_DEBUGFS
 
 	  If unsure, say N.
 
+config CFG80211_REGDB_SYSDATA
+	default y
+	bool "Request binary regulatory database from userspace"
+	depends on CFG80211
+	---help---
+	  This allows cfg80211 to look for updates to the regulatory
+	  database from /lib/firmware/ without needing a userspace
+	  agent such as CRDA.
+
+	  You should say y.
+
+config CFG80211_REGDB_SYSDATA_SIGNED
+	default y
+	bool "Require the regulatory database to be digitally signed"
+	depends on CFG80211 && CFG80211_REGDB_SYSDATA
+	---help---
+	  This makes cfg80211 only trust signed regulatory database files.
+
+	  You should say y.
+
 config CFG80211_INTERNAL_REGDB
 	bool "use statically compiled regulatory rules database" if EXPERT
 	default n
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 48dfc7b..70a1be8 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1,21 +1,39 @@
 /*
- * Copyright 2002-2005, Instant802 Networks, Inc.
- * Copyright 2005-2006, Devicescape Software, Inc.
- * Copyright 2007	Johannes Berg <johannes@sipsolutions.net>
- * Copyright 2008-2011	Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
- * Copyright 2013-2014  Intel Mobile Communications GmbH
+ * Linux 802.11 regulatory
  *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
+ * Copyright 2015 Luis R. Rodriguez <mcgrof@do-not-panic.com>
  *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, see
+ * http://www.gnu.org/licenses/.
+ *
+ * This file was previously licensed under the following license:
+ *    Copyright 2002-2005, Instant802 Networks, Inc.
+ *    Copyright 2005-2006, Devicescape Software, Inc.
+ *    Copyright 2007       Johannes Berg <johannes@sipsolutions.net>
+ *    Copyright 2008-2011  Luis R. Rodriguez <mcgrof@do-not-panic.com>
+ *    Copyright 2013-2014  Intel Mobile Communications GmbH
+ *
+ *    Permission to use, copy, modify, and/or distribute this software for any
+ *    purpose with or without fee is hereby granted, provided that the above
+ *    copyright notice and this permission notice appear in all copies.
+ *
+ *    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ *    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ *    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ *    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ *    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ *    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ *    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 
@@ -53,6 +71,7 @@
 #include <linux/nl80211.h>
 #include <linux/platform_device.h>
 #include <linux/moduleparam.h>
+#include <linux/sysdata.h>
 #include <net/cfg80211.h>
 #include "core.h"
 #include "reg.h"
@@ -73,6 +92,8 @@
  */
 #define REG_ENFORCE_GRACE_MS 60000
 
+const struct sysdata_file *regulatory_sysdata;
+
 /**
  * enum reg_request_treatment - regulatory request treatment
  *
@@ -3079,9 +3100,33 @@ bool regulatory_indoor_allowed(void)
 	return reg_is_indoor;
 }
 
+static void reg_sysdata_complete(const struct sysdata_file *sysdata,
+				      void *context)
+{
+	const char *reason = context;
+
+	pr_info("Processing regulatory data request from: %s", reason);
+
+	if (!sysdata) {
+		pr_info("no new regulatory data not available\n");
+		return;
+	}
+
+	if (sysdata->data) {
+		pr_info("XXX: sysdata for reguatory present: size: %d\n",
+		       (int) sysdata->size);
+	} else
+		pr_info("XXX: sysdata not present :(\n");
+
+	regulatory_sysdata = sysdata;
+}
+
 int __init regulatory_init(void)
 {
 	int err = 0;
+	const struct sysdata_file_desc sysdata_desc = {
+		SYSDATA_DEFAULT_ASYNC(reg_sysdata_complete, "initial boot"),
+	};
 
 	reg_pdev = platform_device_register_simple("regulatory", 0, NULL, 0);
 	if (IS_ERR(reg_pdev))
@@ -3120,7 +3165,13 @@ int __init regulatory_init(void)
 		regulatory_hint_user(ieee80211_regdom,
 				     NL80211_USER_REG_HINT_USER);
 
-	return 0;
+	err = sysdata_file_request_async("regulatory.bin",
+					 &sysdata_desc,
+					 &reg_pdev->dev);
+	if (err)
+		platform_device_unregister(reg_pdev);
+
+	return err;
 }
 
 void regulatory_exit(void)
@@ -3155,4 +3206,6 @@ void regulatory_exit(void)
 		list_del(&reg_request->list);
 		kfree(reg_request);
 	}
+
+	release_sysdata_file(regulatory_sysdata);
 }
-- 
2.3.2.209.gd67f9d5.dirty


_______________________________________________
wireless-regdb mailing list
wireless-regdb@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/wireless-regdb


  parent reply	other threads:[~2015-05-06  1:13 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06  0:44 [wireless-regdb] [RFC v1 00/12] kernel/firmware/wireless: firmware digital signature checks Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [PATCH v1 01/12] kernel/params.c: export param_ops_bool_enable_only Luis R. Rodriguez
2015-05-08 17:56   ` Rusty Russell
2015-05-06  0:44 ` [wireless-regdb] [PATCH v1 02/12] kernel: generalize module signing as system data signing Luis R. Rodriguez
2015-05-06 12:08   ` David Howells
2015-05-07  1:07   ` Rusty Russell
2015-05-06  0:44 ` [wireless-regdb] [PATCH v1 03/12] crypto: qat - address recursive dependency when fw signing is enabled Luis R. Rodriguez
2015-05-06  3:33   ` Herbert Xu
2015-05-07  8:42     ` Paul Bolle
2015-05-07 18:06       ` Paul Bolle
2015-05-07 18:28         ` Luis R. Rodriguez
2015-05-07 20:14           ` Paul Bolle
2015-05-08 21:53             ` Paul Bolle
2015-05-12 16:08               ` Luis R. Rodriguez
2015-05-18 20:01         ` Luis R. Rodriguez
2015-05-18 20:45           ` Paul Bolle
2015-05-19  0:09             ` Luis R. Rodriguez
2015-05-19  8:02               ` Paul Bolle
2015-05-19 15:46                 ` Luis R. Rodriguez
2015-05-19 22:59                   ` Herbert Xu
2015-05-19 23:03                     ` Herbert Xu
2015-05-19 23:05                       ` Luis R. Rodriguez
2015-05-20  2:49                         ` Herbert Xu
2015-05-20  9:00                           ` Paul Bolle
2015-05-20 21:19                             ` Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [PATCH v1 04/12] firmware: fix possible use after free on name on asynchronous request Luis R. Rodriguez
2015-05-08 19:23   ` Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [RFC v1 05/12] firmware: add firmware signature checking support Luis R. Rodriguez
2015-05-06 16:57   ` David Howells
2015-05-06 17:31     ` Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [RFC v1 06/12] firmware: generalize "firmware" as "system data" helpers Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [RFC v1 07/12] firmware: add generic system data helpers with signature support Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [RFC v1 08/12] p54spi: use sysdata_file_request() for EEPROM optional system data Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [RFC v1 09/12] p54: use sysdata_file_request() and sysdata_file_request_async() Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [RFC v1 10/12] ath9k_htc: " Luis R. Rodriguez
2015-05-06  0:44 ` [wireless-regdb] [RFC v1 11/12] iwlwifi: " Luis R. Rodriguez
2015-05-06  7:03   ` Johannes Berg
2015-05-06 16:44     ` Luis R. Rodriguez
2015-05-06  0:44 ` Luis R. Rodriguez [this message]
2015-05-06 17:55 ` [wireless-regdb] [RFC v1 00/12] kernel/firmware/wireless: firmware digital signature checks Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430873070-7290-13-git-send-email-mcgrof@do-not-panic.com \
    --to=mcgrof@do-not-panic.com \
    --cc=akpm@linux-foundation.org \
    --cc=casey@schaufler-ca.com \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jlee@suse.com \
    --cc=keescook@chromium.org \
    --cc=kyle@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@suse.com \
    --cc=ming.lei@canonical.com \
    --cc=mjg59@srcf.ucam.org \
    --cc=rusty@rustcorp.com.au \
    --cc=seth.forshee@canonical.com \
    --cc=tiwai@suse.de \
    --cc=wireless-regdb@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox