[PATCH v3 1/3] wireless-regdb: allow NO-INDOOR flag in db.txt
Ping-Ke Shih <[email protected]> Wed, 19 Feb 2025 10:34:13 +0800
| Newsgroups | org.infradead.lists.wireless-regdb,org.kernel.vger.linux-wireless |
|---|---|
| Message-ID | <[email protected]> |
From: Ping-Ke Shih <[email protected]> For certain regulations, frequency range is outdoor only, which flag should be NO-INDOOR, but db2fw.py doesn't allow this flag. As suggestion, only fill NO-INDOOR flag in db.txt, but ignore this rule in parsing to binary. Suggested-by: Johannes Berg <[email protected]> Link: https://lore.kernel.org/linux-wireless/[email protected]/T/#t Signed-off-by: Ping-Ke Shih <[email protected]> --- v3: - new introduction by v3 --- dbparse.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dbparse.py b/dbparse.py index cc5012bc05bd..450406ff1b34 100755 --- a/dbparse.py +++ b/dbparse.py @@ -121,6 +121,9 @@ class FlagError(Exception): def __init__(self, flag): self.flag = flag +class IgnoreRule(Exception): + pass + @total_ordering class Permission(object): def __init__(self, freqband, power, flags, wmmrule): @@ -134,6 +137,9 @@ class Permission(object): for flag in flags: if not flag in flag_definitions: raise FlagError(flag) + # skip rule with NO-INDOOR so that kernel doesn't need special deal. + if flag == 'NO-INDOOR': + raise IgnoreRule() self.flags |= flag_definitions[flag] self.textflags = flags @@ -429,6 +435,8 @@ class DBParser(object): perm = Permission(b, p, flags, w) except FlagError as e: self._syntax_error("Invalid flag '%s'" % e.flag) + except IgnoreRule: + return for cname, c in self._current_countries.items(): if perm in c: self._warn('Rule "%s, %s" added to "%s" twice' % ( -- 2.25.1