Search Linux Wireless

[PATCH] cfg80211: warn if db.txt is empty with CONFIG_CFG80211_INTERNAL_REGDB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxxxxxxx>

It has happened twice now where elaborate troubleshooting has
undergone on systems where CONFIG_CFG80211_INTERNAL_REGDB [0]
has been set but yet net/wireless/db.txt was not updated.

Despite the documentation on this it seems system integrators could
use some more help with this, so throw out a kernel warning at boot time
when their database is empty, and if they enabled cfg80211 regulatory
debugging (CONFIG_CFG80211_REG_DEBUG), simply fail at build time. If
they didn't enable cfg80211 regulatory debugging then we'll just warn
at boot time. This does mean that the error-prone system integrator
won't likely realize the issue until they boot the machine but -- it
does not seem to make sense to enable a build bug unless someone
really is debugging.

[0] http://wireless.kernel.org/en/developers/Regulatory/CRDA#CONFIG_CFG80211_INTERNAL_REGDB

Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Cc: Youngsin Lee <youngsin@xxxxxxxxxxxx>
Cc: Raja Mani <rmani@xxxxxxxxxxxxxxxx>
Cc: Senthil Kumar Balasubramanian <senthilb@xxxxxxxxxxxxxxxx>
Cc: Vipin Mehta <vipimeht@xxxxxxxxxxxxxxxx>
Cc: yahuan@xxxxxxxxxxxxxxxx
Cc: jjan@xxxxxxxxxxxxxxxx
Cc: vthiagar@xxxxxxxxxxxxxxxx
Cc: henrykim@xxxxxxxxxxxx
Cc: jouni@xxxxxxxxxxxxxxxx
Cc: athiruve@xxxxxxxxxxxxxxxx
Cc: cjkim@xxxxxxxxxxxx
Cc: philipk@xxxxxxxxxxxxxxxx
Cc: sunnykim@xxxxxxxxxxxx
Cc: sskwak@xxxxxxxxxxxx
Cc: kkim@xxxxxxxxxxxx
Cc: mattbyun@xxxxxxxxxxxx
Cc: ryanlee@xxxxxxxxxxxx
Cc: simbap@xxxxxxxxxxxx
Cc: krislee@xxxxxxxxxxxx
Cc: conner@xxxxxxxxxxxx
Cc: hojinkim@xxxxxxxxxxxx
Cc: honglee@xxxxxxxxxxxx
Cc: johnwkim@xxxxxxxxxxxx
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxx>
---

Stephen, John, not sure what is best to address this since I know we shouldn't
be failing to build kernels easily. This will only fail to build if both
CONFIG_CFG80211_REG_DEBUG and CONFIG_CFG80211_INTERNAL_REGDB are enabled.
We could get rid of the build bug check completely but this just means
system integrators will likley fail to fix the issue early. Experience
shows this is a common issue so far and a lot of time is going into debugging
this. I'd like to avoid this in the future. Let me know what you guys think.

 net/wireless/reg.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index e9a0ac8..85f51b3 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -388,7 +388,18 @@ static void reg_regdb_query(const char *alpha2)
 
 	schedule_work(&reg_regdb_work);
 }
+
+/* Feel free to add any other sanity checks here */
+static void reg_regdb_size_check(void)
+{
+#ifdef CONFIG_CFG80211_REG_DEBUG
+	BUILD_BUG_ON(!reg_regdb_size);
+#else
+	WARN_ONCE(!reg_regdb_size, "db.txt is empty, you should update it...");
+#endif
+}
 #else
+static inline void reg_regdb_size_check(void) {}
 static inline void reg_regdb_query(const char *alpha2) {}
 #endif /* CONFIG_CFG80211_INTERNAL_REGDB */
 
@@ -2367,6 +2378,7 @@ void /* __init_or_exit */ regulatory_exit(void)
 	mutex_lock(&cfg80211_mutex);
 	mutex_lock(&reg_mutex);
 
+	reg_regdb_size_check();
 	reset_regdomains(true);
 
 	dev_set_uevent_suppress(&reg_pdev->dev, true);
-- 
1.7.10.rc1.22.gf5241

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux