[1/4] location-functions.pl: add functions for fetching AS information

Message ID 8cce16a8-5a92-acbb-28e7-68df2a95d887@ipfire.org
State Superseded
Headers
Series [1/4] location-functions.pl: add functions for fetching AS information |

Commit Message

Peter Müller Nov. 3, 2020, 2:28 p.m. UTC
  Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
 config/cfgroot/location-functions.pl | 68 +++++++++++++++++++---------
 1 file changed, 46 insertions(+), 22 deletions(-)
  

Comments

Michael Tremer Nov. 6, 2020, 10:56 a.m. UTC | #1
Hello,

> On 3 Nov 2020, at 14:28, Peter Müller <peter.mueller@ipfire.org> wrote:
> 
> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
> ---
> config/cfgroot/location-functions.pl | 68 +++++++++++++++++++---------
> 1 file changed, 46 insertions(+), 22 deletions(-)
> 
> diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl
> index 2cfe7f908..ee03a6611 100644
> --- a/config/cfgroot/location-functions.pl
> +++ b/config/cfgroot/location-functions.pl
> @@ -1,25 +1,23 @@
> #!/usr/bin/perl -w
> -############################################################################
> -#                                                                          #
> -# This file is part of the IPFire Firewall.                                #
> -#                                                                          #
> -# IPFire is free software; you can redistribute it and/or modify           #
> -# it under the terms of the GNU General Public License as published by     #
> -# the Free Software Foundation; either version 2 of the License, or        #
> -# (at your option) any later version.                                      #
> -#                                                                          #
> -# IPFire is distributed in the hope that it will be useful,                #
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
> -# GNU General Public License for more details.                             #
> -#                                                                          #
> -# You should have received a copy of the GNU General Public License        #
> -# along with IPFire; if not, write to the Free Software                    #
> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
> -#                                                                          #
> -# Copyright (C) 2015 - 2020 IPFire Team <info@ipfire.org>.                 #
> -#                                                                          #
> -############################################################################
> +###############################################################################
> +#                                                                             #
> +# IPFire.org - A linux based firewall                                         #
> +# Copyright (C) 2007-2020  IPFire Team  <info@ipfire.org>                     #
> +#                                                                             #
> +# This program is free software: you can redistribute it and/or modify        #
> +# it under the terms of the GNU General Public License as published by        #
> +# the Free Software Foundation, either version 3 of the License, or           #
> +# (at your option) any later version.                                         #
> +#                                                                             #
> +# This program is distributed in the hope that it will be useful,             #
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
> +# GNU General Public License for more details.                                #
> +#                                                                             #
> +# You should have received a copy of the GNU General Public License           #
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
> +#                                                                             #
> +###############################################################################

What is the reason for upgrading the license of this file to GPLv3?

> 
> package Location::Functions;
> 
> @@ -83,7 +81,7 @@ sub verify ($) {
> }
> 
> #
> -## Function to the the country code of a given address.
> +## Function to get the country code of a given address.
> #
> sub lookup_country_code($$) {
> 	my ($db_handle, $address) = @_;
> @@ -221,4 +219,30 @@ sub address_has_flags($) {
> 	return @flags;
> }
> 
> +#
> +## Function to get the Autonomous System Number of a given address.
> +#
> +sub lookup_asn($$) {
> +	my ($db_handle, $address) = @_;
> +
> +	# Lookup the given address.
> +	my $asn = &Location::lookup_asn($db_handle, $address);
> +
> +	# Return the number of the Autonomous System
> +	return $asn;
> +}
> +
> +#
> +## Function to get the name of an Autonomous System.
> +#
> +sub get_as_name($$) {
> +	my ($db_handle, $asn) = @_;
> +
> +	# Fetch the name of this AS...
> +	my $as_name = &Location::get_as_name($db_handle, $asn);
> +
> +	# Return the name of the Autonomous System
> +	return $as_name;
> +}
> +
> 1;
> -- 
> 2.26.2
  
Peter Müller Nov. 6, 2020, 1:57 p.m. UTC | #2
Hello Michael,

> What is the reason for upgrading the license of this file to GPLv3?

actually, there is none. Whenever I edit a file containing license information,
I try to update outdated information ("Michael Tremer & Christian Schmidt" et al.)
in order to tidy things up.

It completely slipped my mind that we have a mixture of GPLv3 (some LFS files)
and GPLv2 here... Do you want me to send in an updated patchset?

Thanks, and best regards,
Peter Müller

> Hello,
> 
>> On 3 Nov 2020, at 14:28, Peter Müller <peter.mueller@ipfire.org> wrote:
>>
>> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
>> ---
>> config/cfgroot/location-functions.pl | 68 +++++++++++++++++++---------
>> 1 file changed, 46 insertions(+), 22 deletions(-)
>>
>> diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl
>> index 2cfe7f908..ee03a6611 100644
>> --- a/config/cfgroot/location-functions.pl
>> +++ b/config/cfgroot/location-functions.pl
>> @@ -1,25 +1,23 @@
>> #!/usr/bin/perl -w
>> -############################################################################
>> -#                                                                          #
>> -# This file is part of the IPFire Firewall.                                #
>> -#                                                                          #
>> -# IPFire is free software; you can redistribute it and/or modify           #
>> -# it under the terms of the GNU General Public License as published by     #
>> -# the Free Software Foundation; either version 2 of the License, or        #
>> -# (at your option) any later version.                                      #
>> -#                                                                          #
>> -# IPFire is distributed in the hope that it will be useful,                #
>> -# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
>> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
>> -# GNU General Public License for more details.                             #
>> -#                                                                          #
>> -# You should have received a copy of the GNU General Public License        #
>> -# along with IPFire; if not, write to the Free Software                    #
>> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
>> -#                                                                          #
>> -# Copyright (C) 2015 - 2020 IPFire Team <info@ipfire.org>.                 #
>> -#                                                                          #
>> -############################################################################
>> +###############################################################################
>> +#                                                                             #
>> +# IPFire.org - A linux based firewall                                         #
>> +# Copyright (C) 2007-2020  IPFire Team  <info@ipfire.org>                     #
>> +#                                                                             #
>> +# This program is free software: you can redistribute it and/or modify        #
>> +# it under the terms of the GNU General Public License as published by        #
>> +# the Free Software Foundation, either version 3 of the License, or           #
>> +# (at your option) any later version.                                         #
>> +#                                                                             #
>> +# This program is distributed in the hope that it will be useful,             #
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
>> +# GNU General Public License for more details.                                #
>> +#                                                                             #
>> +# You should have received a copy of the GNU General Public License           #
>> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
>> +#                                                                             #
>> +###############################################################################
> 
> What is the reason for upgrading the license of this file to GPLv3?
> 
>>
>> package Location::Functions;
>>
>> @@ -83,7 +81,7 @@ sub verify ($) {
>> }
>>
>> #
>> -## Function to the the country code of a given address.
>> +## Function to get the country code of a given address.
>> #
>> sub lookup_country_code($$) {
>> 	my ($db_handle, $address) = @_;
>> @@ -221,4 +219,30 @@ sub address_has_flags($) {
>> 	return @flags;
>> }
>>
>> +#
>> +## Function to get the Autonomous System Number of a given address.
>> +#
>> +sub lookup_asn($$) {
>> +	my ($db_handle, $address) = @_;
>> +
>> +	# Lookup the given address.
>> +	my $asn = &Location::lookup_asn($db_handle, $address);
>> +
>> +	# Return the number of the Autonomous System
>> +	return $asn;
>> +}
>> +
>> +#
>> +## Function to get the name of an Autonomous System.
>> +#
>> +sub get_as_name($$) {
>> +	my ($db_handle, $asn) = @_;
>> +
>> +	# Fetch the name of this AS...
>> +	my $as_name = &Location::get_as_name($db_handle, $asn);
>> +
>> +	# Return the name of the Autonomous System
>> +	return $as_name;
>> +}
>> +
>> 1;
>> -- 
>> 2.26.2
>
  
Michael Tremer Nov. 6, 2020, 7:23 p.m. UTC | #3
Hi,

> On 6 Nov 2020, at 13:57, Peter Müller <peter.mueller@ipfire.org> wrote:
> 
> Hello Michael,
> 
>> What is the reason for upgrading the license of this file to GPLv3?
> 
> actually, there is none. Whenever I edit a file containing license information,
> I try to update outdated information ("Michael Tremer & Christian Schmidt" et al.)
> in order to tidy things up.

Yes, that is indeed a bit outdated by now.

Should we not have one big patch fixing that in the whole repository?

> It completely slipped my mind that we have a mixture of GPLv3 (some LFS files)
> and GPLv2 here... Do you want me to send in an updated patchset?

Yes, I think we should keep things under the licenses that they are under.

Otherwise we might need to collect people’s consent and there might be other implications too.

Best,
-Michael

> Thanks, and best regards,
> Peter Müller
> 
>> Hello,
>> 
>>> On 3 Nov 2020, at 14:28, Peter Müller <peter.mueller@ipfire.org> wrote:
>>> 
>>> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
>>> ---
>>> config/cfgroot/location-functions.pl | 68 +++++++++++++++++++---------
>>> 1 file changed, 46 insertions(+), 22 deletions(-)
>>> 
>>> diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl
>>> index 2cfe7f908..ee03a6611 100644
>>> --- a/config/cfgroot/location-functions.pl
>>> +++ b/config/cfgroot/location-functions.pl
>>> @@ -1,25 +1,23 @@
>>> #!/usr/bin/perl -w
>>> -############################################################################
>>> -#                                                                          #
>>> -# This file is part of the IPFire Firewall.                                #
>>> -#                                                                          #
>>> -# IPFire is free software; you can redistribute it and/or modify           #
>>> -# it under the terms of the GNU General Public License as published by     #
>>> -# the Free Software Foundation; either version 2 of the License, or        #
>>> -# (at your option) any later version.                                      #
>>> -#                                                                          #
>>> -# IPFire is distributed in the hope that it will be useful,                #
>>> -# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
>>> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
>>> -# GNU General Public License for more details.                             #
>>> -#                                                                          #
>>> -# You should have received a copy of the GNU General Public License        #
>>> -# along with IPFire; if not, write to the Free Software                    #
>>> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
>>> -#                                                                          #
>>> -# Copyright (C) 2015 - 2020 IPFire Team <info@ipfire.org>.                 #
>>> -#                                                                          #
>>> -############################################################################
>>> +###############################################################################
>>> +#                                                                             #
>>> +# IPFire.org - A linux based firewall                                         #
>>> +# Copyright (C) 2007-2020  IPFire Team  <info@ipfire.org>                     #
>>> +#                                                                             #
>>> +# This program is free software: you can redistribute it and/or modify        #
>>> +# it under the terms of the GNU General Public License as published by        #
>>> +# the Free Software Foundation, either version 3 of the License, or           #
>>> +# (at your option) any later version.                                         #
>>> +#                                                                             #
>>> +# This program is distributed in the hope that it will be useful,             #
>>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
>>> +# GNU General Public License for more details.                                #
>>> +#                                                                             #
>>> +# You should have received a copy of the GNU General Public License           #
>>> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
>>> +#                                                                             #
>>> +###############################################################################
>> 
>> What is the reason for upgrading the license of this file to GPLv3?
>> 
>>> 
>>> package Location::Functions;
>>> 
>>> @@ -83,7 +81,7 @@ sub verify ($) {
>>> }
>>> 
>>> #
>>> -## Function to the the country code of a given address.
>>> +## Function to get the country code of a given address.
>>> #
>>> sub lookup_country_code($$) {
>>> 	my ($db_handle, $address) = @_;
>>> @@ -221,4 +219,30 @@ sub address_has_flags($) {
>>> 	return @flags;
>>> }
>>> 
>>> +#
>>> +## Function to get the Autonomous System Number of a given address.
>>> +#
>>> +sub lookup_asn($$) {
>>> +	my ($db_handle, $address) = @_;
>>> +
>>> +	# Lookup the given address.
>>> +	my $asn = &Location::lookup_asn($db_handle, $address);
>>> +
>>> +	# Return the number of the Autonomous System
>>> +	return $asn;
>>> +}
>>> +
>>> +#
>>> +## Function to get the name of an Autonomous System.
>>> +#
>>> +sub get_as_name($$) {
>>> +	my ($db_handle, $asn) = @_;
>>> +
>>> +	# Fetch the name of this AS...
>>> +	my $as_name = &Location::get_as_name($db_handle, $asn);
>>> +
>>> +	# Return the name of the Autonomous System
>>> +	return $as_name;
>>> +}
>>> +
>>> 1;
>>> -- 
>>> 2.26.2
>>
  
Peter Müller Nov. 11, 2020, 1:53 p.m. UTC | #4
Hello Michael,

sorry for replying late on this.

> Yes, that is indeed a bit outdated by now.
> 
> Should we not have one big patch fixing that in the whole repository?

Yes, that would probably be the better way of doing this. I will take care of it...

> Yes, I think we should keep things under the licenses that they are under.
> 
> Otherwise we might need to collect people’s consent and there might be other implications too.

All right, second version of the patchset is en route... :-)

Thanks, and best regards,
Peter Müller


> Hi,
> 
>> On 6 Nov 2020, at 13:57, Peter Müller <peter.mueller@ipfire.org> wrote:
>>
>> Hello Michael,
>>
>>> What is the reason for upgrading the license of this file to GPLv3?
>>
>> actually, there is none. Whenever I edit a file containing license information,
>> I try to update outdated information ("Michael Tremer & Christian Schmidt" et al.)
>> in order to tidy things up.
> 
> Yes, that is indeed a bit outdated by now.
> 
> Should we not have one big patch fixing that in the whole repository?
> 
>> It completely slipped my mind that we have a mixture of GPLv3 (some LFS files)
>> and GPLv2 here... Do you want me to send in an updated patchset?
> 
> Yes, I think we should keep things under the licenses that they are under.
> 
> Otherwise we might need to collect people’s consent and there might be other implications too.
> 
> Best,
> -Michael
> 
>> Thanks, and best regards,
>> Peter Müller
>>
>>> Hello,
>>>
>>>> On 3 Nov 2020, at 14:28, Peter Müller <peter.mueller@ipfire.org> wrote:
>>>>
>>>> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
>>>> ---
>>>> config/cfgroot/location-functions.pl | 68 +++++++++++++++++++---------
>>>> 1 file changed, 46 insertions(+), 22 deletions(-)
>>>>
>>>> diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl
>>>> index 2cfe7f908..ee03a6611 100644
>>>> --- a/config/cfgroot/location-functions.pl
>>>> +++ b/config/cfgroot/location-functions.pl
>>>> @@ -1,25 +1,23 @@
>>>> #!/usr/bin/perl -w
>>>> -############################################################################
>>>> -#                                                                          #
>>>> -# This file is part of the IPFire Firewall.                                #
>>>> -#                                                                          #
>>>> -# IPFire is free software; you can redistribute it and/or modify           #
>>>> -# it under the terms of the GNU General Public License as published by     #
>>>> -# the Free Software Foundation; either version 2 of the License, or        #
>>>> -# (at your option) any later version.                                      #
>>>> -#                                                                          #
>>>> -# IPFire is distributed in the hope that it will be useful,                #
>>>> -# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
>>>> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
>>>> -# GNU General Public License for more details.                             #
>>>> -#                                                                          #
>>>> -# You should have received a copy of the GNU General Public License        #
>>>> -# along with IPFire; if not, write to the Free Software                    #
>>>> -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
>>>> -#                                                                          #
>>>> -# Copyright (C) 2015 - 2020 IPFire Team <info@ipfire.org>.                 #
>>>> -#                                                                          #
>>>> -############################################################################
>>>> +###############################################################################
>>>> +#                                                                             #
>>>> +# IPFire.org - A linux based firewall                                         #
>>>> +# Copyright (C) 2007-2020  IPFire Team  <info@ipfire.org>                     #
>>>> +#                                                                             #
>>>> +# This program is free software: you can redistribute it and/or modify        #
>>>> +# it under the terms of the GNU General Public License as published by        #
>>>> +# the Free Software Foundation, either version 3 of the License, or           #
>>>> +# (at your option) any later version.                                         #
>>>> +#                                                                             #
>>>> +# This program is distributed in the hope that it will be useful,             #
>>>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
>>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
>>>> +# GNU General Public License for more details.                                #
>>>> +#                                                                             #
>>>> +# You should have received a copy of the GNU General Public License           #
>>>> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
>>>> +#                                                                             #
>>>> +###############################################################################
>>>
>>> What is the reason for upgrading the license of this file to GPLv3?
>>>
>>>>
>>>> package Location::Functions;
>>>>
>>>> @@ -83,7 +81,7 @@ sub verify ($) {
>>>> }
>>>>
>>>> #
>>>> -## Function to the the country code of a given address.
>>>> +## Function to get the country code of a given address.
>>>> #
>>>> sub lookup_country_code($$) {
>>>> 	my ($db_handle, $address) = @_;
>>>> @@ -221,4 +219,30 @@ sub address_has_flags($) {
>>>> 	return @flags;
>>>> }
>>>>
>>>> +#
>>>> +## Function to get the Autonomous System Number of a given address.
>>>> +#
>>>> +sub lookup_asn($$) {
>>>> +	my ($db_handle, $address) = @_;
>>>> +
>>>> +	# Lookup the given address.
>>>> +	my $asn = &Location::lookup_asn($db_handle, $address);
>>>> +
>>>> +	# Return the number of the Autonomous System
>>>> +	return $asn;
>>>> +}
>>>> +
>>>> +#
>>>> +## Function to get the name of an Autonomous System.
>>>> +#
>>>> +sub get_as_name($$) {
>>>> +	my ($db_handle, $asn) = @_;
>>>> +
>>>> +	# Fetch the name of this AS...
>>>> +	my $as_name = &Location::get_as_name($db_handle, $asn);
>>>> +
>>>> +	# Return the name of the Autonomous System
>>>> +	return $as_name;
>>>> +}
>>>> +
>>>> 1;
>>>> -- 
>>>> 2.26.2
>>>
>
  
Peter Müller Nov. 11, 2020, 2:19 p.m. UTC | #5
Hello Michael, hello *,

> All right, second version of the patchset is en route... 

here you are: https://patchwork.ipfire.org/project/ipfire/list/?series=1600 :-)

Thanks, and best regards,
Peter Müller
  

Patch

diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl
index 2cfe7f908..ee03a6611 100644
--- a/config/cfgroot/location-functions.pl
+++ b/config/cfgroot/location-functions.pl
@@ -1,25 +1,23 @@ 
 #!/usr/bin/perl -w
-############################################################################
-#                                                                          #
-# This file is part of the IPFire Firewall.                                #
-#                                                                          #
-# IPFire is free software; you can redistribute it and/or modify           #
-# it under the terms of the GNU General Public License as published by     #
-# the Free Software Foundation; either version 2 of the License, or        #
-# (at your option) any later version.                                      #
-#                                                                          #
-# IPFire is distributed in the hope that it will be useful,                #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
-# GNU General Public License for more details.                             #
-#                                                                          #
-# You should have received a copy of the GNU General Public License        #
-# along with IPFire; if not, write to the Free Software                    #
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
-#                                                                          #
-# Copyright (C) 2015 - 2020 IPFire Team <info@ipfire.org>.                 #
-#                                                                          #
-############################################################################
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007-2020  IPFire Team  <info@ipfire.org>                     #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 package Location::Functions;
 
@@ -83,7 +81,7 @@  sub verify ($) {
 }
 
 #
-## Function to the the country code of a given address.
+## Function to get the country code of a given address.
 #
 sub lookup_country_code($$) {
 	my ($db_handle, $address) = @_;
@@ -221,4 +219,30 @@  sub address_has_flags($) {
 	return @flags;
 }
 
+#
+## Function to get the Autonomous System Number of a given address.
+#
+sub lookup_asn($$) {
+	my ($db_handle, $address) = @_;
+
+	# Lookup the given address.
+	my $asn = &Location::lookup_asn($db_handle, $address);
+
+	# Return the number of the Autonomous System
+	return $asn;
+}
+
+#
+## Function to get the name of an Autonomous System.
+#
+sub get_as_name($$) {
+	my ($db_handle, $asn) = @_;
+
+	# Fetch the name of this AS...
+	my $as_name = &Location::get_as_name($db_handle, $asn);
+
+	# Return the name of the Autonomous System
+	return $as_name;
+}
+
 1;