From 25dda4a082b6b2927cbe16039bf1ef96b955a1ff Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Wed, 8 Jan 2020 10:35:24 +0100 Subject: [PATCH] dns.cgi: Only perform reverse lookups if the system is online Signed-off-by: Stefan Schantl --- html/cgi-bin/dns.cgi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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'}; } -- 2.39.5