* [PATCH] wireless: fixup genregdb.awk for remove of antenna gain from wireless-regd
@ 2014-07-14 21:19 Luis R. Rodriguez
2014-07-15 11:21 ` Krishna Chaitanya
2014-07-21 10:24 ` Johannes Berg
0 siblings, 2 replies; 3+ messages in thread
From: Luis R. Rodriguez @ 2014-07-14 21:19 UTC (permalink / raw)
To: johannes
Cc: linux-kernel, linux-wireless, john, chaitanya.mgit, linville,
gregkh, tiwai, keescook, nbd, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@suse.com>
Since "wireless-regdb: remove antenna gain" was merged in the
wireless-regdb tree, the awk script parser has been incompatible
with the 'official' regulatory database. This fixes that up.
Without this change the max EIRP is set to 0 making 802.11 devices
useless.
The fragile nature of the awk parser must be replaced, but ideas
over how to do that in the most scalable way are being reviewed.
In the meantime update the documentation for CFG80211_INTERNAL_REGDB
so folks are aware of expectations for now.
Reported-by: John Walker <john@x109.net>
Reported-by: Krishna Chaitanya <chaitanya.mgit@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
!!! Note !!!
This means older kernels that upgrade wireless-regdb and use
CFG80211_INTERNAL_REGDB are bust too and they should then merge
the latest updates to the awk script if they want to synch the
wireless-regdb files with the kernel builds. The affected Linux
distributions would be the users of CFG80211_INTERNAL_REGDB which
should consists of OpenWrt which is reported to have this fixed
already and mobile platforms.
We are looking at a way to not have to deal with parsers all together
at build time, for that discussion see:
https://lkml.org/lkml/2014/7/14/706
net/wireless/Kconfig | 6 ++++++
net/wireless/genregdb.awk | 35 ++++++++++++++++++++++-------------
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 405f3c4..29c8675 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -162,6 +162,12 @@ config CFG80211_INTERNAL_REGDB
and includes code to query that database. This is an alternative
to using CRDA for defining regulatory rules for the kernel.
+ Using this option requires some parsing of the db.txt at build time,
+ the parser will be upkept with the latest wireless-regdb updates but
+ older wireless-regdb formats will be ignored. The parser may later
+ be replaced to avoid issues with conflicts on versions of
+ wireless-regdb.
+
For details see:
http://wireless.kernel.org/en/developers/Regulatory
diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk
index 40c37fc..baf2426 100644
--- a/net/wireless/genregdb.awk
+++ b/net/wireless/genregdb.awk
@@ -51,32 +51,41 @@ function parse_country_head() {
function parse_reg_rule()
{
+ flag_starts_at = 7
+
start = $1
sub(/\(/, "", start)
end = $3
bw = $5
sub(/\),/, "", bw)
- gain = $6
- sub(/\(/, "", gain)
- sub(/,/, "", gain)
- power = $7
- sub(/\)/, "", power)
- sub(/,/, "", power)
+ gain = 0
+ power = $6
# power might be in mW...
- units = $8
+ units = $7
+ dfs_cac = 0
+
+ sub(/\(/, "", power)
+ sub(/\),/, "", power)
+ sub(/\),/, "", units)
sub(/\)/, "", units)
- sub(/,/, "", units)
- dfs_cac = $9
+
if (units == "mW") {
+ flag_starts_at = 8
power = 10 * log(power)/log(10)
+ if ($8 ~ /[[:digit:]]/) {
+ flag_starts_at = 9
+ dfs_cac = $8
+ }
} else {
- dfs_cac = $8
+ if ($7 ~ /[[:digit:]]/) {
+ flag_starts_at = 8
+ dfs_cac = $7
+ }
}
- sub(/,/, "", dfs_cac)
sub(/\(/, "", dfs_cac)
- sub(/\)/, "", dfs_cac)
+ sub(/\),/, "", dfs_cac)
flagstr = ""
- for (i=8; i<=NF; i++)
+ for (i=flag_starts_at; i<=NF; i++)
flagstr = flagstr $i
split(flagstr, flagarray, ",")
flags = ""
--
2.0.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] wireless: fixup genregdb.awk for remove of antenna gain from wireless-regd
2014-07-14 21:19 [PATCH] wireless: fixup genregdb.awk for remove of antenna gain from wireless-regd Luis R. Rodriguez
@ 2014-07-15 11:21 ` Krishna Chaitanya
2014-07-21 10:24 ` Johannes Berg
1 sibling, 0 replies; 3+ messages in thread
From: Krishna Chaitanya @ 2014-07-15 11:21 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: Johannes Berg, linux-kernel, linux-wireless, John Walker,
John Linville, Greg Kroah-Hartman, tiwai, keescook,
Felix Fietkau, Luis R. Rodriguez
On Tue, Jul 15, 2014 at 2:49 AM, Luis R. Rodriguez
<mcgrof@do-not-panic.com> wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
>
> Since "wireless-regdb: remove antenna gain" was merged in the
> wireless-regdb tree, the awk script parser has been incompatible
> with the 'official' regulatory database. This fixes that up.
> Without this change the max EIRP is set to 0 making 802.11 devices
> useless.
>
> The fragile nature of the awk parser must be replaced, but ideas
> over how to do that in the most scalable way are being reviewed.
> In the meantime update the documentation for CFG80211_INTERNAL_REGDB
> so folks are aware of expectations for now.
>
> Reported-by: John Walker <john@x109.net>
> Reported-by: Krishna Chaitanya <chaitanya.mgit@gmail.com>
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---
>
> !!! Note !!!
>
> This means older kernels that upgrade wireless-regdb and use
> CFG80211_INTERNAL_REGDB are bust too and they should then merge
> the latest updates to the awk script if they want to synch the
> wireless-regdb files with the kernel builds. The affected Linux
> distributions would be the users of CFG80211_INTERNAL_REGDB which
> should consists of OpenWrt which is reported to have this fixed
> already and mobile platforms.
>
> We are looking at a way to not have to deal with parsers all together
> at build time, for that discussion see:
>
> https://lkml.org/lkml/2014/7/14/706
>
> net/wireless/Kconfig | 6 ++++++
> net/wireless/genregdb.awk | 35 ++++++++++++++++++++++-------------
> 2 files changed, 28 insertions(+), 13 deletions(-)
>
> diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
> index 405f3c4..29c8675 100644
> --- a/net/wireless/Kconfig
> +++ b/net/wireless/Kconfig
> @@ -162,6 +162,12 @@ config CFG80211_INTERNAL_REGDB
> and includes code to query that database. This is an alternative
> to using CRDA for defining regulatory rules for the kernel.
>
> + Using this option requires some parsing of the db.txt at build time,
> + the parser will be upkept with the latest wireless-regdb updates but
> + older wireless-regdb formats will be ignored. The parser may later
> + be replaced to avoid issues with conflicts on versions of
> + wireless-regdb.
> +
> For details see:
>
> http://wireless.kernel.org/en/developers/Regulatory
> diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk
> index 40c37fc..baf2426 100644
> --- a/net/wireless/genregdb.awk
> +++ b/net/wireless/genregdb.awk
> @@ -51,32 +51,41 @@ function parse_country_head() {
>
> function parse_reg_rule()
> {
> + flag_starts_at = 7
> +
> start = $1
> sub(/\(/, "", start)
> end = $3
> bw = $5
> sub(/\),/, "", bw)
> - gain = $6
> - sub(/\(/, "", gain)
> - sub(/,/, "", gain)
> - power = $7
> - sub(/\)/, "", power)
> - sub(/,/, "", power)
> + gain = 0
> + power = $6
> # power might be in mW...
> - units = $8
> + units = $7
> + dfs_cac = 0
> +
> + sub(/\(/, "", power)
> + sub(/\),/, "", power)
> + sub(/\),/, "", units)
> sub(/\)/, "", units)
> - sub(/,/, "", units)
> - dfs_cac = $9
> +
> if (units == "mW") {
> + flag_starts_at = 8
> power = 10 * log(power)/log(10)
> + if ($8 ~ /[[:digit:]]/) {
> + flag_starts_at = 9
> + dfs_cac = $8
> + }
> } else {
> - dfs_cac = $8
> + if ($7 ~ /[[:digit:]]/) {
> + flag_starts_at = 8
> + dfs_cac = $7
> + }
> }
> - sub(/,/, "", dfs_cac)
> sub(/\(/, "", dfs_cac)
> - sub(/\)/, "", dfs_cac)
> + sub(/\),/, "", dfs_cac)
> flagstr = ""
> - for (i=8; i<=NF; i++)
> + for (i=flag_starts_at; i<=NF; i++)
> flagstr = flagstr $i
> split(flagstr, flagarray, ",")
> flags = ""
Acked-by:Krishna Chaitanya <chaitanya.mgit@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] wireless: fixup genregdb.awk for remove of antenna gain from wireless-regd
2014-07-14 21:19 [PATCH] wireless: fixup genregdb.awk for remove of antenna gain from wireless-regd Luis R. Rodriguez
2014-07-15 11:21 ` Krishna Chaitanya
@ 2014-07-21 10:24 ` Johannes Berg
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2014-07-21 10:24 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: linux-kernel, linux-wireless, john, chaitanya.mgit, linville,
gregkh, tiwai, keescook, nbd, Luis R. Rodriguez
On Mon, 2014-07-14 at 14:19 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
>
> Since "wireless-regdb: remove antenna gain" was merged in the
> wireless-regdb tree, the awk script parser has been incompatible
> with the 'official' regulatory database. This fixes that up.
> Without this change the max EIRP is set to 0 making 802.11 devices
> useless.
>
> The fragile nature of the awk parser must be replaced, but ideas
> over how to do that in the most scalable way are being reviewed.
> In the meantime update the documentation for CFG80211_INTERNAL_REGDB
> so folks are aware of expectations for now.
Applied.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-21 10:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-14 21:19 [PATCH] wireless: fixup genregdb.awk for remove of antenna gain from wireless-regd Luis R. Rodriguez
2014-07-15 11:21 ` Krishna Chaitanya
2014-07-21 10:24 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®