Solaris gethostbyaddr() strangeness?

Mark_Andrews at isc.org Mark_Andrews at isc.org
Tue Nov 4 21:37:23 UTC 2003


> Am I correct in concluding that gethostbyaddr() works differently in
> Solaris from eg. Linux?  Green is a Solaris, Tigger is a Linux:
> 
> green:~% perl -e 'use Socket; foreach(@ARGV) { my(@a)=gethostbyaddr(pack('C4'
> ,split(/\./)),AF_INET); print @a?"<$a[0]>\n":"failed\n"; }' 194.197.197.10 19
> 2.89.123.25 ; uname -a
> failed
> <smtp.tele.fi>
> SunOS green 5.8 Generic_108528-14 sun4u sparc SUNW,Ultra-5_10
> 
> tigger:~% perl -e 'use Socket; foreach(@ARGV) { my(@a)=gethostbyaddr(pack('C4
> ',split(/\./)),AF_INET); print @a?"<$a[0]>\n":"failed\n"; }' 194.197.197.10 1
> 92.89.123.25 ; uname -a
> <groupware.masterplanet.fi>
> <smtp.tele.fi>
> Linux tigger.otto.net 2.4.18-27.8.0smp #1 SMP Fri Mar 14 05:47:33 EST 2003 i6
> 86 i686 i386 GNU/Linux
> 
> Perl versions are v5.6.1 and v5.8.0, respectively.
> 
> This seems to hinge on the fact that 194.197.197.10 returns two PTRs:
> 
> tigger:~% host 194.197.197.10
> 10.197.197.194.in-addr.arpa domain name pointer groupware.masterplanet.fi.
> 10.197.197.194.in-addr.arpa domain name pointer test.masterplanet.fi.
> 
> I know, this is at best a questionable practice:
> 	http://www.isc.org/ml-archives/bind-users/1999/02/msg00283.html
> -- 
>    /* * * Otto J. Makela <om at iki.fi> * * * * * * * * * * * * * * * */
>   /* Phone: +358 40 765 5772, FAX: +358 42 7655772, ICBM: 60N 25E */
>  /* Mail: Mechelininkatu 26 B 27,  FIN-00100  Helsinki,  FINLAND */
> /* * * Computers Rule 01001111 01001011 * * * * * * * * * * * * */
> 

	Solaris does forward anti spoof checks on the PTR records
	returned.

	It takes the names (maybe only the first) returned by the
	reverse lookup and performs a forward lookup using that name.
	If the original address is not in the set of addresses returned
	by the forward lookup gethostbyaddr fails.

	Mark
--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark.Andrews at isc.org


More information about the bind-users mailing list