Commit d1c6ebbe authored by Francesc Guasch's avatar Francesc Guasch
Browse files

Search hostname with FQDN of Net::Domain

parent 656de3dd
...@@ -14,7 +14,6 @@ use POSIX qw(WNOHANG); ...@@ -14,7 +14,6 @@ use POSIX qw(WNOHANG);
use YAML; use YAML;
use Socket qw( inet_aton inet_ntoa ); use Socket qw( inet_aton inet_ntoa );
use Sys::Hostname;
use Ravada::Auth; use Ravada::Auth;
use Ravada::Request; use Ravada::Request;
...@@ -110,6 +109,7 @@ Returns the default display IP read from the config file ...@@ -110,6 +109,7 @@ Returns the default display IP read from the config file
=cut =cut
sub display_ip { sub display_ip {
my $ip = $CONFIG->{display_ip}; my $ip = $CONFIG->{display_ip};
return $ip if $ip; return $ip if $ip;
......
...@@ -10,7 +10,7 @@ use Moose::Role; ...@@ -10,7 +10,7 @@ use Moose::Role;
use Net::DNS; use Net::DNS;
use IO::Socket; use IO::Socket;
use IO::Interface; use IO::Interface;
use Sys::Hostname; use Net::Domain qw(hostfqdn);
requires 'connect'; requires 'connect';
...@@ -198,7 +198,9 @@ sub ip { ...@@ -198,7 +198,9 @@ sub ip {
sub _ip_from_hostname { sub _ip_from_hostname {
my $res = Net::DNS::Resolver->new(); my $res = Net::DNS::Resolver->new();
my $reply = $res->search(hostname());
my $name = hostfqdn();
my $reply = $res->search($name);
return if !$reply; return if !$reply;
for my $rr ($reply->answer) { for my $rr ($reply->answer) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment