From: Stefan Schantl Date: Wed, 8 Jan 2020 09:35:24 +0000 (+0100) Subject: dns.cgi: Only perform reverse lookups if the system is online X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25dda4a082b6b2927cbe16039bf1ef96b955a1ff;p=people%2Fstevee%2Fipfire-2.x.git dns.cgi: Only perform reverse lookups if the system is online Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index 6ec295dea7..7d80b4eaa5 100755 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -519,8 +519,13 @@ END my $ccode = &GeoIP::lookup($nameserver); my $flag_icon = &GeoIP::get_flag_icon($ccode); - my $iaddr = inet_aton($nameserver); - my $rdns = gethostbyaddr($iaddr, AF_INET); + my $rdns; + + # Only do the reverse lookup if the system is online. + if ( -f "/var/ipfire/red/active") { + my $iaddr = inet_aton($nameserver); + $rdns = gethostbyaddr($iaddr, AF_INET); + } if (!$rdns) { $rdns = $Lang::tr{'lookup failed'}; }