Skip to content

Commit

Permalink
bugfix: nslookup output parsing changes with openwrt 18.06
Browse files Browse the repository at this point in the history
fixes #66
  • Loading branch information
ae6xe committed Jul 15, 2018
1 parent ef05b37 commit eae3e42
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion files/www/cgi-bin/perlfunc.pm
Expand Up @@ -486,9 +486,10 @@ sub ip2hostname
my $host;
return "" unless $ip;
return "" if $ip eq "none";
$reverse_ip=join ".",reverse(split /\./,$ip);
foreach(`nslookup $ip`)
{
next unless ($host) = /Address 1: $ip (\S+)/;
next unless ($host) = /^$reverse_ip\.in-addr\.arpa[ \t]+name[ \t]+=[ \t]+(\S+)/;
return $host;
}
return "";
Expand Down

0 comments on commit eae3e42

Please sign in to comment.