[v3,8/8] wlanap.cgi: Access db.txt in place of using regdbdump on regulatory.bin

Message ID 20210805102122.3484023-8-adolf.belka@ipfire.org
State Superseded
Headers
Series [v3,1/8] make.sh: Remove crda and remaining python2 modules |

Commit Message

Adolf Belka Aug. 5, 2021, 10:21 a.m. UTC
  - wlanap.cgi was using regdbdump from crda to create a text based list of the
   wireless settings by country database.
- With the removal of crda as part of the removal of python2 this option could not be
   used.
- wireless-regdb also has a text based database list in the source tarball and this
   patch makes wlanap.cgi read this list into the @countrylist_cmd variable
- This needs to be tested by someone that has an IPFire system with wifi that can access
   and evaluate wlanap.cgi to confirm that this change functions as expected.
- This version changes the name of the stored text file from db.txt to regulatorydb.txt
- The command to read the data from regulatorydb.txt into @countrylist_cmd has been
   corrected

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 html/cgi-bin/wlanap.cgi | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Bernhard Bitsch Aug. 5, 2021, 10:40 a.m. UTC | #1
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>

Am 05.08.2021 um 12:21 schrieb Adolf Belka:
> - wlanap.cgi was using regdbdump from crda to create a text based list of the
>     wireless settings by country database.
> - With the removal of crda as part of the removal of python2 this option could not be
>     used.
> - wireless-regdb also has a text based database list in the source tarball and this
>     patch makes wlanap.cgi read this list into the @countrylist_cmd variable
> - This needs to be tested by someone that has an IPFire system with wifi that can access
>     and evaluate wlanap.cgi to confirm that this change functions as expected.
> - This version changes the name of the stored text file from db.txt to regulatorydb.txt
> - The command to read the data from regulatorydb.txt into @countrylist_cmd has been
>     corrected
> 
> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
> ---
>   html/cgi-bin/wlanap.cgi | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/html/cgi-bin/wlanap.cgi b/html/cgi-bin/wlanap.cgi
> index eba5fe774..3024257db 100644
> --- a/html/cgi-bin/wlanap.cgi
> +++ b/html/cgi-bin/wlanap.cgi
> @@ -312,8 +312,11 @@ if ( $channel =~ /\d+/ ){push(@temp,$channel + 0);}
>   push(@channellist, @temp);
>   }
>   
> -my @countrylist_cmd = `regdbdump /usr/lib/crda/regulatory.bin 2>/dev/null`;
>   # get available country codes
> +open(FILE, “</lib/firmware/firmwaredb.txt”);
Should read:
+open(FILE, “</lib/firmware/regulatorydb.txt”);

 > +my @countrylist_cmd = <FILE>;
> +close(FILE);
> +
>   
>   my @temp = "00";
>   foreach (@countrylist_cmd){
>
  
Adolf Belka Aug. 5, 2021, 10:55 a.m. UTC | #2
Hi Bernhard,

On 05/08/2021 12:40, Bernhard Bitsch wrote:
> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>
> 
> Am 05.08.2021 um 12:21 schrieb Adolf Belka:
>> - wlanap.cgi was using regdbdump from crda to create a text based list of the
>>     wireless settings by country database.
>> - With the removal of crda as part of the removal of python2 this option could not be
>>     used.
>> - wireless-regdb also has a text based database list in the source tarball and this
>>     patch makes wlanap.cgi read this list into the @countrylist_cmd variable
>> - This needs to be tested by someone that has an IPFire system with wifi that can access
>>     and evaluate wlanap.cgi to confirm that this change functions as expected.
>> - This version changes the name of the stored text file from db.txt to regulatorydb.txt
>> - The command to read the data from regulatorydb.txt into @countrylist_cmd has been
>>     corrected
>>
>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>> ---
>>   html/cgi-bin/wlanap.cgi | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/html/cgi-bin/wlanap.cgi b/html/cgi-bin/wlanap.cgi
>> index eba5fe774..3024257db 100644
>> --- a/html/cgi-bin/wlanap.cgi
>> +++ b/html/cgi-bin/wlanap.cgi
>> @@ -312,8 +312,11 @@ if ( $channel =~ /\d+/ ){push(@temp,$channel + 0);}
>>   push(@channellist, @temp);
>>   }
>> -my @countrylist_cmd = `regdbdump /usr/lib/crda/regulatory.bin 2>/dev/null`;
>>   # get available country codes
>> +open(FILE, “</lib/firmware/firmwaredb.txt”);
> Should read:
> +open(FILE, “</lib/firmware/regulatorydb.txt”);
Thanks so much for spotting this. The power of the review process. I will re-issue the patches.

Regards,
Adolf.
> 
>  > +my @countrylist_cmd = <FILE>;
>> +close(FILE);
>> +
>>   my @temp = "00";
>>   foreach (@countrylist_cmd){
>>
  
Michael Tremer Aug. 5, 2021, 8:31 p.m. UTC | #3
Hello,

> On 5 Aug 2021, at 12:55, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> Hi Bernhard,
> 
> On 05/08/2021 12:40, Bernhard Bitsch wrote:
>> Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
>> Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>
>> Am 05.08.2021 um 12:21 schrieb Adolf Belka:
>>> - wlanap.cgi was using regdbdump from crda to create a text based list of the
>>>     wireless settings by country database.
>>> - With the removal of crda as part of the removal of python2 this option could not be
>>>     used.
>>> - wireless-regdb also has a text based database list in the source tarball and this
>>>     patch makes wlanap.cgi read this list into the @countrylist_cmd variable
>>> - This needs to be tested by someone that has an IPFire system with wifi that can access
>>>     and evaluate wlanap.cgi to confirm that this change functions as expected.
>>> - This version changes the name of the stored text file from db.txt to regulatorydb.txt
>>> - The command to read the data from regulatorydb.txt into @countrylist_cmd has been
>>>     corrected
>>> 
>>> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
>>> ---
>>>   html/cgi-bin/wlanap.cgi | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/html/cgi-bin/wlanap.cgi b/html/cgi-bin/wlanap.cgi
>>> index eba5fe774..3024257db 100644
>>> --- a/html/cgi-bin/wlanap.cgi
>>> +++ b/html/cgi-bin/wlanap.cgi
>>> @@ -312,8 +312,11 @@ if ( $channel =~ /\d+/ ){push(@temp,$channel + 0);}
>>>   push(@channellist, @temp);
>>>   }
>>> -my @countrylist_cmd = `regdbdump /usr/lib/crda/regulatory.bin 2>/dev/null`;
>>>   # get available country codes
>>> +open(FILE, “</lib/firmware/firmwaredb.txt”);
>> Should read:
>> +open(FILE, “</lib/firmware/regulatorydb.txt”);
> Thanks so much for spotting this. The power of the review process. I will re-issue the patches.

Exactly :) Great work everyone!

> 
> Regards,
> Adolf.
>> > +my @countrylist_cmd = <FILE>;
>>> +close(FILE);
>>> +
>>>   my @temp = "00";
>>>   foreach (@countrylist_cmd){
  

Patch

diff --git a/html/cgi-bin/wlanap.cgi b/html/cgi-bin/wlanap.cgi
index eba5fe774..3024257db 100644
--- a/html/cgi-bin/wlanap.cgi
+++ b/html/cgi-bin/wlanap.cgi
@@ -312,8 +312,11 @@  if ( $channel =~ /\d+/ ){push(@temp,$channel + 0);}
 push(@channellist, @temp);
 }
 
-my @countrylist_cmd = `regdbdump /usr/lib/crda/regulatory.bin 2>/dev/null`;
 # get available country codes
+open(FILE, “</lib/firmware/firmwaredb.txt”);
+my @countrylist_cmd = <FILE>;
+close(FILE);
+
 
 my @temp = "00";
 foreach (@countrylist_cmd){