summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2016-08-02 08:35:28 +0000
committerLiong Sauw Ming <ming@teluu.com>2016-08-02 08:35:28 +0000
commit0d94951e856b6f963b75f888eb7aa7428075a6d0 (patch)
tree100520779dd0790fd5d91b08be4723f4f70447e2 /pjlib
parent7e0cba1c76f7086cd636c16f8ff324cb77ebfdef (diff)
Re #1945 (misc): Set IPv6 sockets to be IPv6 only
Auto-detect in configure script if this option is supported, and if yes, Set IPv6 sockets to be IPv6 only. Thanks to Alexander Traud for the patch. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5403 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/include/pj/compat/os_auto.h.in1
-rw-r--r--pjlib/src/pj/sock_bsd.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/pjlib/include/pj/compat/os_auto.h.in b/pjlib/include/pj/compat/os_auto.h.in
index c8e73b20..7eb89562 100644
--- a/pjlib/include/pj/compat/os_auto.h.in
+++ b/pjlib/include/pj/compat/os_auto.h.in
@@ -83,6 +83,7 @@
#undef PJ_HAS_WINSOCK2_H
#undef PJ_HAS_WS2TCPIP_H
+#undef PJ_SOCK_HAS_IPV6_V6ONLY
#undef PJ_SOCK_HAS_INET_ATON
#undef PJ_SOCK_HAS_INET_PTON
#undef PJ_SOCK_HAS_INET_NTOP
diff --git a/pjlib/src/pj/sock_bsd.c b/pjlib/src/pj/sock_bsd.c
index 1688668b..dc015d84 100644
--- a/pjlib/src/pj/sock_bsd.c
+++ b/pjlib/src/pj/sock_bsd.c
@@ -539,6 +539,12 @@ PJ_DEF(pj_status_t) pj_sock_socket(int af,
pj_sock_setsockopt(*sock, pj_SOL_SOCKET(), pj_SO_NOSIGPIPE(),
&val, sizeof(val));
}
+#if defined(PJ_SOCK_HAS_IPV6_V6ONLY) && PJ_SOCK_HAS_IPV6_V6ONLY != 0
+ if (af == PJ_AF_INET6) {
+ pj_sock_setsockopt(*sock, PJ_SOL_IPV6, IPV6_V6ONLY,
+ &val, sizeof(val));
+ }
+#endif
#if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \
PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0
if (type == pj_SOCK_DGRAM()) {