diff options
author | ume <ume@FreeBSD.org> | 2005-05-15 20:15:15 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2005-05-15 20:15:15 +0000 |
commit | 7a6cd620d08df24bc7c27e2a13017a1f63f004b2 (patch) | |
tree | 309b5291b90b8bac584d010fde9db8ed4db9a767 /lib/libc/net/getaddrinfo.c | |
parent | dd14237cdafb5e0124ab3277ac0ac8f9eaf03aa0 (diff) | |
download | FreeBSD-src-7a6cd620d08df24bc7c27e2a13017a1f63f004b2.zip FreeBSD-src-7a6cd620d08df24bc7c27e2a13017a1f63f004b2.tar.gz |
- The ai_addrlen of a struct addrinfo used to be a size_t, per
RFC 2553. In XNS5.2, and subsequently in POSIX-2001 and RFC
3493, it was changed to a socklen_t. And, the n_net of a
struct netent used to be an unsigned long integer. In XNS5,
and subsequently in POSIX-2001, it was changed to an uint32_t.
To accomodate for this while preserving ABI compatibility with
the old interface, we need to prepend or append 32 bits of
padding, depending on the (LP64) architecture's endianness.
- Correct 1st argument of getnetbyaddr() to uint32_t on 32
bit arch. Stay as is on 64 bit arch for ABI backward
compatibility for now.
Reviewed by: das, peter
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index a7ab128..5d6ca2f 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -135,7 +135,7 @@ TAILQ_HEAD(policyhead, policyqueue); static const struct afd { int a_af; int a_addrlen; - int a_socklen; + socklen_t a_socklen; int a_off; const char *a_addrany; const char *a_loopback; @@ -1352,6 +1352,9 @@ get_ai(pai, afd, addr) memset(ai->ai_addr, 0, (size_t)afd->a_socklen); ai->ai_addr->sa_len = afd->a_socklen; ai->ai_addrlen = afd->a_socklen; +#if __LONG_BIT == 64 + ai->__ai_pad0 = 0; /* ABI compatibility */ +#endif ai->ai_addr->sa_family = ai->ai_family = afd->a_af; p = (char *)(void *)(ai->ai_addr); #ifdef FAITH |