[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Bind failure on OSF4.0 alpha



Randy Kunkee wrote:
> Okay, I found the problem, though I'm pretty sure this is not the right
> way to patch it (see below).  The problem stems from the alpha being
> a 64-bit machine.  Lber-int.h assumes AC_HTONL/AC_NTOHL will work for
> LBER_INT_T, LBER_LEN_T, and LBER_TAG_T.  But, ../../include/ac/socket.h
> actually defines the AC_* macros to operate on longs, and LBER_INT_T
> is actually an int (32 bits).  This should be a problem on any machine
> where sizeof(LBER_INT_T) != sizeof(LBER_TAG_T).


The problem is that we rely on htonl() to convert a whole long
to network byte order.  Many system htonl only works on 32-bit
integers.  AC_HTONL is kludged to byte order a whole 'long'.
No kludges are provided for 'short'.

Basically, we shouldn't use hton{l,s}() and ntoh{l,s} for
LBER types.  They are meant to be used for exact sized types.
LBER types are 'at least' sized types.  We should use our
own conversion routines.

For now, I've forced LBER_INT_T to be 'long' such that we
can use AC_HTONL/AC_NTOHL.  This works on 32-bit systems
and on the Alpha.  It likely does NOT work on other non-32
bit systems.

Kurt