]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
dns.cgi: Only perform reverse lookups if the system is online
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 8 Jan 2020 09:35:24 +0000 (10:35 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 8 Jan 2020 09:35:24 +0000 (10:35 +0100)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/dns.cgi

index 6ec295dea78d846736b0e8558fd4d263834f48e3..7d80b4eaa536e41a2808db9a453f198bca89826d 100755 (executable)
@@ -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'}; }