Skip to contentSkip to conversation

cfg80211: a few genregdb.awk updates

PATCH Applied Luis R. Rodriguez 3 participants 6 messages Oct 28, 2013 – Nov 11, 2013 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

cover cfg80211: a few genregdb.awk updates

A few updates while toying with genregdb.awk for small regulatory domains. This depends on the antenna gain removal patch.

Luis R. Rodriguez (2):
cfg80211: add function helpers to genregdb.awk
cfg80211: fix parsing when db.txt ends on a rule

 net/wireless/genregdb.awk | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.4.rc3
#1 lore raw

PATCH 1/2 cfg80211: add function helpers to genregdb.awk

This has no functional change, this just lets us reuse helpers at a later time.

---
 net/wireless/genregdb.awk | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)
net/wireless/genregdb.awk +25 -11
index 3e241e4e..95baf61 100755
@@ -33,15 +33,7 @@ BEGIN {
 	regdb = "const struct ieee80211_regdomain *reg_regdb[] = {\n"
 }
 
-/^[ \t]*#/ {
-	# Ignore
-}
-
-!active && /^[ \t]*$/ {
-	# Ignore
-}
-
-!active && /country/ {
+function parse_country_head() {
 	country=$2
 	sub(/:/, "", country)
 	printf "static const struct ieee80211_regdomain regdom_%s = {\n", country
@@ -57,7 +49,8 @@ BEGIN {
 	regdb = regdb "\t&regdom_" country ",\n"
 }
 
-active && /^[ \t]*\(/ {
+function parse_reg_rule()
+{
 	start = $1
 	sub(/\(/, "", start)
 	end = $3
@@ -117,7 +110,8 @@ active && /^[ \t]*\(/ {
 	rules++
 }
 
-active && /^[ \t]*$/ {
+function print_tail_country()
+{
 	active = 0
 	printf "\t},\n"
 	printf "\t.n_reg_rules = %d\n", rules
@@ -125,6 +119,26 @@ active && /^[ \t]*$/ {
 	rules = 0;
 }
 
+/^[ \t]*#/ {
+	# Ignore
+}
+
+!active && /^[ \t]*$/ {
+	# Ignore
+}
+
+!active && /country/ {
+	parse_country_head()
+}
+
+active && /^[ \t]*\(/ {
+	parse_reg_rule()
+}
+
+active && /^[ \t]*$/ {
+	print_tail_country()
+}
+
 END {
 	print regdb "};"
 	print ""
Signature · 1 line
1.8.4.rc3
#2 lore raw

PATCH 2/2 cfg80211: fix parsing when db.txt ends on a rule

In reply to Luis R. Rodriguez

If genregdb.awk assumes the file will end with an
extra empty line or a comment line. This is could
not be true so just address this.

---
 net/wireless/genregdb.awk | 2 ++
 1 file changed, 2 insertions(+)
net/wireless/genregdb.awk +2 -0
index 95baf61..13b982d 100755
@@ -140,6 +140,8 @@ active && /^[ \t]*$/ {
 }
 
 END {
+	if (active)
+		print_tail_country()
 	print regdb "};"
 	print ""
 	print "int reg_regdb_size = ARRAY_SIZE(reg_regdb);"
Signature · 1 line
1.8.4.rc3
maintainer Applied
#5 lore raw
In reply to Luis R. Rodriguez
Quoted 3 lines · Luis R. Rodriguez

A few updates while toying with genregdb.awk for small regulatory domains. This depends on the antenna gain removal patch.

Applied, thanks.

johannes