]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
logs.cgi/*: Use new location lookup method.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 6 Dec 2019 13:30:39 +0000 (14:30 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Fri, 6 Dec 2019 13:30:39 +0000 (14:30 +0100)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/logs.cgi/firewalllog.dat
html/cgi-bin/logs.cgi/firewalllogcountry.dat
html/cgi-bin/logs.cgi/firewalllogip.dat
html/cgi-bin/logs.cgi/showrequestfromcountry.dat

index e67a40a9f506d4712c3ac1255c38b4e54f5938aa..6d07b62844e72c0259733540e3ccfe8bb26decf7 100644 (file)
@@ -24,6 +24,9 @@ require "${General::swroot}/geoip-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
+# Libloc database handle.
+my $libloc_db_handle = &GeoIP::init();
+
 my %color = ();
 my %mainsettings = ();
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
@@ -351,7 +354,7 @@ foreach $_ (@log)
        $srcport=$1 if $packet =~ /SPT=(\d+)/;
        $dstport=$1 if $packet =~ /DPT=(\d+)/;
 
-       my $ccode = &GeoIP::lookup($srcaddr);
+       my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $srcaddr);
 
        my $servi = uc(getservbyport($srcport, lc($proto)));
        if ($servi ne '' && $srcport < 1024) {
index 949f2599daade08aa40d9285a3c754bccf419c95..c241b032054e6fdfecb44b3c65b9f93647872c97 100644 (file)
@@ -22,6 +22,9 @@ require "${General::swroot}/geoip-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
+# Libloc database handle.
+my $libloc_db_handle = &GeoIP::init();
+
 use POSIX();
 
 my %cgiparams=();
@@ -308,7 +311,7 @@ foreach $_ (@log)
                # Traffic from red
                if($srcaddr ne '') {
                        # srcaddr is set
-                       my $ccode = &GeoIP::lookup($srcaddr);
+                       my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $srcaddr);
                        if ($ccode eq '') {
                                $ccode = 'unknown';
                        }
index c73d24fd663fee6af86ff0cc31e669f7acf217b0..7b117deabec36e225f7f18d0e350b194ecae68b1 100644 (file)
@@ -22,6 +22,9 @@ require "${General::swroot}/geoip-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
+# Libloc database handle.
+my $libloc_db_handle = &GeoIP::init();
+
 use POSIX();
 
 my %cgiparams=();
@@ -435,7 +438,7 @@ for($s=0;$s<$lines;$s++)
        $col="bgcolor='$color{\"color$colorIndex\"}'";
        print "<tr>";
 
-       my $ccode = &GeoIP::lookup($key[$s]);
+       my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $key[$s]);
   
        $color++;
        print "<td align='center' $col><form method='post' action='showrequestfromip.dat'><input type='hidden' name='MONTH' value='$cgiparams{'MONTH'}'> <input type='hidden' name='DAY' value='$cgiparams{'DAY'}'> <input type='hidden' name='ip' value='$key[$s]'> <input type='submit' value='$Lang::tr{'details'}'></form></td>";
index 69835370b154acdaf8676bbd28640726497e70d4..2754830752a5dcbe084c0c29ebc0814338f45462 100644 (file)
@@ -19,6 +19,9 @@ require "${General::swroot}/geoip-functions.pl";
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
+# Libloc database handle.
+my $libloc_db_handle = &GeoIP::init();
+
 use POSIX();
 
 #workaround to suppress a warning when a variable is used only once
@@ -178,7 +181,7 @@ if (!$skip)
                        }
                        elsif($srcaddr ne '') {
                                # or srcaddr matches country code
-                               my $ccode = &GeoIP::lookup($srcaddr);
+                               my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $srcaddr);
                                if($ccode eq uc($country)){
                                        $log[$lines] = $_;
                                        $lines++;