#790 ipv4 adress as ipv6 adress

open
nobody
5
2012-10-11
2008-12-04
johannes
No

My http daemon outputs ipv4 adresses in the form ::ffff:127.0.0.1 . Unfortenely neither awstats, nor the librarys awstats uses (at least geoipfree and Net::DNS), do not recognize these as ipv4 adresses.

I am not sure if this is realy a awstats matter, as the librarys should be fixed. But it doesn't hurt to do in also in awstats.

I created patches for the geoipfree and ipv6 plugins, I am not sure if this should be done in the awstats core, instead of the plugins.

geoipfree.pm:
# <-----
my $res=$TmpDomainLookup{$param}||'';
if (! $res) {

  if ($param =~ /^::ffff:[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) {
      $param =~ s/^::ffff://;
  }
    ($res,undef)=$gi->LookUp($param);
    if ($res !~ /\w\w/) { $res='ip'; }
    else { $res=lc($res); }

ipv6.pm:
sub GetResolvedIP_ipv6 {
# <-----

my $param= $[0];
if ($param =~ /^::ffff:[0-9]+.[0-9]+.[0-9]+.[0-9]+$/) {
$param =~ s/^::ffff://;
}
< my $ip = new Net::IP($
[0]);
my $ip = new Net::IP($param);
my $reverseip= $ip->reverse_ip();
my $query = $resolver->query($reverseip, "PTR");
if (! defined($query)) { return; }

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks