[Pdns-users] PDNS && Solaris && Recursor setting not working

Norbert Sendetzky norbert at linuxnetworks.de
Wed Feb 25 08:45:51 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 24 February 2004 21:32, Remco Post wrote:
> + #ifdef WORDS_BIGENDIAN
> +       // d.id is network-endian at this point and must be made
> into a 'native'-endian u_int16_t
> +       // on little-endian systems, network-endian is native so we
> don't need to do anything

That's not correct. Big-endian architectures use network byte order - 
little-endian systems do not.

> +       d.id = ( 256 * (u_int16_t)buffer[1] ) +(u_int16_t)buffer[0]; 
> + #endif

It seems that the id sent by the recursor is in little endian format, 
so line setting the id must be changed in pdns_recursor too.

Simply use the ntohs() and htons() macros. They do conversion 
automatically dependent on your machine:

pdns_recursor: ((u_int16_t*) buffer)[0] = htons( d.id );
pdns_server: d.id = ntohs( ((u_int16_t*) buffer)[0] );


Norbert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAkA8YMQACgkQxMLs5v5/7eAv/QCfdBXrGdYCdcAB4bVYBP7jl/PA
ZjwAoITb1jXyrV+SSagPp2mMriwB9hII
=yFON
-----END PGP SIGNATURE-----


More information about the Pdns-users mailing list