summaryrefslogtreecommitdiff
path: root/pr/include/private/primpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'pr/include/private/primpl.h')
-rw-r--r--pr/include/private/primpl.h33
1 files changed, 33 insertions, 0 deletions
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)