Changeset 5403


Ignore:
Timestamp:
Aug 2, 2016 8:35:28 AM (8 years ago)
Author:
ming
Message:

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.

Location:
pjproject/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/aconfigure

    r5393 r5403  
    752752oldincludedir 
    753753includedir 
    754 runstatedir 
    755754localstatedir 
    756755sharedstatedir 
     
    875874sharedstatedir='${prefix}/com' 
    876875localstatedir='${prefix}/var' 
    877 runstatedir='${localstatedir}/run' 
    878876includedir='${prefix}/include' 
    879877oldincludedir='/usr/include' 
     
    11281126    silent=yes ;; 
    11291127 
    1130   -runstatedir | --runstatedir | --runstatedi | --runstated \ 
    1131   | --runstate | --runstat | --runsta | --runst | --runs \ 
    1132   | --run | --ru | --r) 
    1133     ac_prev=runstatedir ;; 
    1134   -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ 
    1135   | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ 
    1136   | --run=* | --ru=* | --r=*) 
    1137     runstatedir=$ac_optarg ;; 
    1138  
    11391128  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) 
    11401129    ac_prev=sbindir ;; 
     
    12741263                datadir sysconfdir sharedstatedir localstatedir includedir \ 
    12751264                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ 
    1276                 libdir localedir mandir runstatedir 
     1265                libdir localedir mandir 
    12771266do 
    12781267  eval ac_val=\$$ac_var 
     
    14271416  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com] 
    14281417  --localstatedir=DIR     modifiable single-machine data [PREFIX/var] 
    1429   --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run] 
    14301418  --libdir=DIR            object code libraries [EPREFIX/lib] 
    14311419  --includedir=DIR        C header files [PREFIX/include] 
     
    56075595rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
    56085596 
     5597{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if IPV6_V6ONLY is available" >&5 
     5598$as_echo_n "checking if IPV6_V6ONLY is available... " >&6; } 
     5599cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     5600/* end confdefs.h.  */ 
     5601#include <sys/socket.h> 
     5602                                     #include <netinet/in.h> 
     5603int 
     5604main () 
     5605{ 
     5606int opt = IPV6_V6ONLY; 
     5607  ; 
     5608  return 0; 
     5609} 
     5610_ACEOF 
     5611if ac_fn_c_try_compile "$LINENO"; then : 
     5612  $as_echo "#define PJ_SOCK_HAS_IPV6_V6ONLY 1" >>confdefs.h 
     5613 
     5614                   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 
     5615$as_echo "yes" >&6; } 
     5616else 
     5617  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 
     5618$as_echo "no" >&6; } 
     5619fi 
     5620rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     5621 
    56095622{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if SO_ERROR is available" >&5 
    56105623$as_echo_n "checking if SO_ERROR is available... " >&6; } 
  • pjproject/trunk/aconfigure.ac

    r5393 r5403  
    341341                                   [socklen_t xxx = 0;])], 
    342342                  [AC_DEFINE(PJ_HAS_SOCKLEN_T,1) 
     343                   AC_MSG_RESULT(yes)], 
     344                  AC_MSG_RESULT(no)) 
     345 
     346dnl # Determine if IPV6_V6ONLY is available 
     347AC_MSG_CHECKING([if IPV6_V6ONLY is available]) 
     348AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h> 
     349                                     #include <netinet/in.h>]], 
     350                                   [int opt = IPV6_V6ONLY;])], 
     351                  [AC_DEFINE(PJ_SOCK_HAS_IPV6_V6ONLY,1) 
    343352                   AC_MSG_RESULT(yes)], 
    344353                  AC_MSG_RESULT(no)) 
  • pjproject/trunk/pjlib/include/pj/compat/os_auto.h.in

    r5247 r5403  
    8484#undef PJ_HAS_WS2TCPIP_H 
    8585 
     86#undef PJ_SOCK_HAS_IPV6_V6ONLY 
    8687#undef PJ_SOCK_HAS_INET_ATON 
    8788#undef PJ_SOCK_HAS_INET_PTON 
  • pjproject/trunk/pjlib/src/pj/sock_bsd.c

    r4860 r5403  
    540540                               &val, sizeof(val)); 
    541541        } 
     542#if defined(PJ_SOCK_HAS_IPV6_V6ONLY) && PJ_SOCK_HAS_IPV6_V6ONLY != 0 
     543        if (af == PJ_AF_INET6) { 
     544            pj_sock_setsockopt(*sock, PJ_SOL_IPV6, IPV6_V6ONLY, 
     545                               &val, sizeof(val)); 
     546        } 
     547#endif 
    542548#if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \ 
    543549    PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0 
Note: See TracChangeset for help on using the changeset viewer.