use vars qw/
$reader
/;
+use Data::Validate::IP 0.25 qw( is_private_ip );
# ----->
$address = inet_ntoa(inet_aton($param));
if ($Debug) { debug(" Plugin $PluginName: ShowInfoHost_geoip2 $param resolved to $address",5); }
# Now do the same lookup from the IP
+ # GeoIP2::Reader doesn't support private IP addresses
+ if (!is_private_ip($address)){
if (!$res){$res=lc($reader->country( ip => $address )->country()->iso_code()) if $reader;}
if ($Debug) { debug(" Plugin $PluginName: ShowInfoHost_geoip2 for $param: [$res]",5); }
if ($res) { print $DomainsHashIDLib{$res}?$DomainsHashIDLib{$res}:"<span style=\"color: #$color_other\">$Message[0]</span>"; }
else { print "<span style=\"color: #$color_other\">$Message[0]</span>"; }
- }
+ }}
print "</td>";
}
else {
%_city_l
$MAXNBOFSECTIONGIR
/;
+use Data::Validate::IP 0.25 qw( is_private_ip );
# ----->
$address = inet_ntoa(inet_aton($param));
if ($Debug) { debug(" Plugin $PluginName: ShowInfoHost_geoip2_city $param resolved to $address",5); }
# Now do the same lookup from the IP
+ # GeoIP2::Reader doesn't support lookups for Private IPs
+ if (!is_private_ip($address)){
$record=$geoip2_city->city(ip=>$address) if $geoip2_city;
if ($Debug) { debug(" Plugin $PluginName: ShowInfoHost_geoip2_city for $param: [$record]",5); }
$country=$record->country()->iso_code() if $record;
$city=$record->city()->name() if $record;
- }
+ }}
# print "<td>";
# if ($country) { print $DomainsHashIDLib{$country}?$DomainsHashIDLib{$country}:"<span style=\"color: #$color_other\">$Message[0]</span>"; }
# else { print "<span style=\"color: #$color_other\">$Message[0]</span>"; }