summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2000-06-09 23:20:03 +0000
committerwtc%netscape.com <devnull@localhost>2000-06-09 23:20:03 +0000
commite032c85271c308538426373d89ca279976d2b996 (patch)
treea1537d602e306a48ac9a395c6228370fba79d11a
parentb9a309b3cedbef4d8ea77e401c203de5a67ab746 (diff)
downloadnspr-hg-SeaMonkey_M16_BRANCH.tar.gz
Bugzilla bug #40542: pass the correct size of struct sockaddr_in8 toSeaMonkey_M16_RELEASESeaMonkey_M16_BRANCH
native socket functions on Solaris 8 for Intel/x86. r=larryh@netscape.com. a=leaf. Thanks to dcran@us.ibm.com (Donnie Cranford) for the bug report. Modified files: _solaris.h, primpl.h (SeaMonkey_M16_BRANCH)
-rw-r--r--pr/include/md/_solaris.h18
-rw-r--r--pr/include/private/primpl.h33
2 files changed, 51 insertions, 0 deletions
diff --git a/pr/include/md/_solaris.h b/pr/include/md/_solaris.h
index 5a16750c..88c5a44e 100644
--- a/pr/include/md/_solaris.h
+++ b/pr/include/md/_solaris.h
@@ -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"
diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h
index a0378650..4b68a2b1 100644
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -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)