mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Fix to always prefer displaying external IP address #1184
https://github.com/webmin/webmin/issues/1184#issuecomment-1446340234
This commit is contained in:
@@ -35,9 +35,16 @@ push(@rv, $table);
|
||||
|
||||
if (&show_section('host')) {
|
||||
# Hostname
|
||||
my $ip = $info && $info->{'ips'} ? $info->{'ips'}->[0]->[0]
|
||||
: &to_ipaddress(get_system_hostname());
|
||||
$ip = $ip ? " ($ip)" : "";
|
||||
my @ips_all = &to_ipaddress(get_system_hostname());
|
||||
my (@ips_noloop, @ips_noloc, $ip_detect);
|
||||
if (@ips_all) {
|
||||
@ips_noloop = grep { $_ !~ /^127\./} @ips_all;
|
||||
@ips_noloc = grep { $_ !~ /^(10\.|192\.168\.)/} @ips_noloop;
|
||||
$ip_detect = @ips_noloc ? $ips_noloc[0] :
|
||||
@ips_noloop ? $ips_noloop[0] : $ips_all[0];
|
||||
}
|
||||
my $ip = $info && $info->{'ips'} ? $info->{'ips'}->[0]->[0] : $ip_detect;
|
||||
$ip = " ($ip)" if ($ip);
|
||||
push(@table, { 'desc' => $text{'right_host'},
|
||||
'value' => &get_system_hostname().$ip });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user