Bugzilla bug #40542: pass the correct size of struct sockaddr_in8 to

native socket functions on Solaris 8 for Intel/x86. r=larryh@netscape.com.
a=pdt. Thanks to dcran@us.ibm.com (Donnie Cranford) for the bug report.
Modified files: _solaris.h, primpl.h
(NSPRPUB_CLIENT_BRANCH)


git-svn-id: svn://10.0.0.236/branches/NSPRPUB_CLIENT_BRANCH@71895 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtc%netscape.com
2000-06-09 13:44:08 +00:00
parent fd48b8c578
commit 9968bfa7b2
2 changed files with 51 additions and 0 deletions

View File

@@ -86,6 +86,24 @@
#define AI_V4MAPPED 0x0001
#define AI_ALL 0x0002
#define AI_ADDRCONFIG 0x0004
#define _PR_HAVE_MD_SOCKADDR_IN6
/* isomorphic to struct in6_addr on Solaris 8 */
struct _md_in6_addr {
union {
PRUint8 _S6_u8[16];
PRUint32 _S6_u32[4];
PRUint32 __S6_align;
} _S6_un;
};
/* isomorphic to struct sockaddr_in6 on Solaris 8 */
struct _md_sockaddr_in6 {
PRUint16 sin6_family;
PRUint16 sin6_port;
PRUint32 sin6_flowinfo;
struct _md_in6_addr sin6_addr;
PRUint32 sin6_scope_id;
PRUint32 __sin6_src_id;
};
#endif
#include "prinrval.h"

View File

@@ -1280,6 +1280,39 @@ extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr);
#define PR_NETADDR_SIZE(_addr) _PR_NetAddrSize(_addr)
#elif defined(_PR_HAVE_MD_SOCKADDR_IN6)
/*
** Under the following conditions:
** 1. _PR_INET6 is not defined;
** 2. _PR_INET6_PROBE is defined;
** 3. struct sockaddr_in6 has nonstandard fields at the end
** (e.g., on Solaris 8),
** (_addr)->ipv6 is smaller than struct sockaddr_in6, and
** hence we can't pass sizeof((_addr)->ipv6) to socket
** functions such as connect because they would fail with
** EINVAL.
**
** To pass the correct socket address length to socket
** functions, define the macro _PR_HAVE_MD_SOCKADDR_IN6 and
** define struct _md_sockaddr_in6 to be isomorphic to
** struct sockaddr_in6.
*/
#if defined(XP_UNIX)
#define PR_NETADDR_SIZE(_addr) \
((_addr)->raw.family == PR_AF_INET \
? sizeof((_addr)->inet) \
: ((_addr)->raw.family == PR_AF_INET6 \
? sizeof(struct _md_sockaddr_in6) \
: sizeof((_addr)->local)))
#else
#define PR_NETADDR_SIZE(_addr) \
((_addr)->raw.family == PR_AF_INET \
? sizeof((_addr)->inet) \
: sizeof(struct _md_sockaddr_in6)
#endif /* defined(XP_UNIX) */
#else
#if defined(XP_UNIX)