J
j.greg.k
I have checked the dns ptr records for the example below and the
records exists. also when doing an nslookup from the console on the
system in which perl is installed I get the correct name
$ nslookup a.b.c.d
Server: a.b.c.2
Address: a.b.c.2#53
d.c.b.a.in-addr.arpa name = ccc_dddd_ddddddd_ddd_cc.dom.ain.
Where c = character and d = digit. It's a common naming convention we
use on our internal dns servers:
building_model_serialtag_other-tag_type
I am not allowed to post the ip address or name but since it is
internal and the world cannot resolve the address anyhow it would not
do much good even if I could.
Next is the output when I run the perl program
$ ./hostname.pl
SUB:GETHOSTNAME: Got ccc_dddd_ddddddd_ddd
It truncates the last _ccc for some reason. Here is the code. It works
for all but the cases above in which the last few characters are _sw
and the length of the return value is at or more than 20 places ( I
have about 5 cases so far out of 1200 nodes)
#!/usr/bin/perl
use Socket;
#####################################
# Sub: GetHostname
#####################################
sub gethostname
{
my $target = shift;
$dname = gethostbyaddr(inet_aton($target),AF_INET) or $dname =
'noresolve';
print " SUB:GETHOSTNAME: Got $dname\n";
}
my $target = 'a.b.c.d';
gethostname ($target);
I am running this on an intel system RHES 4
perl -v
This is perl, v5.8.5 built for i386-linux-thread-mult
any ideas?
records exists. also when doing an nslookup from the console on the
system in which perl is installed I get the correct name
$ nslookup a.b.c.d
Server: a.b.c.2
Address: a.b.c.2#53
d.c.b.a.in-addr.arpa name = ccc_dddd_ddddddd_ddd_cc.dom.ain.
Where c = character and d = digit. It's a common naming convention we
use on our internal dns servers:
building_model_serialtag_other-tag_type
I am not allowed to post the ip address or name but since it is
internal and the world cannot resolve the address anyhow it would not
do much good even if I could.
Next is the output when I run the perl program
$ ./hostname.pl
SUB:GETHOSTNAME: Got ccc_dddd_ddddddd_ddd
It truncates the last _ccc for some reason. Here is the code. It works
for all but the cases above in which the last few characters are _sw
and the length of the return value is at or more than 20 places ( I
have about 5 cases so far out of 1200 nodes)
#!/usr/bin/perl
use Socket;
#####################################
# Sub: GetHostname
#####################################
sub gethostname
{
my $target = shift;
$dname = gethostbyaddr(inet_aton($target),AF_INET) or $dname =
'noresolve';
print " SUB:GETHOSTNAME: Got $dname\n";
}
my $target = 'a.b.c.d';
gethostname ($target);
I am running this on an intel system RHES 4
perl -v
This is perl, v5.8.5 built for i386-linux-thread-mult
any ideas?