mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
Use srtp_shutdown when available
This allows the SRTP library to be shut down properly when the functionality is offered by libsrtp. Review: https://reviewboard.asterisk.org/r/2538/ (closes issue ASTERISK-21719) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
121
configure
vendored
121
configure
vendored
@@ -742,6 +742,10 @@ PBX_OPENSSL
|
|||||||
OPENSSL_DIR
|
OPENSSL_DIR
|
||||||
OPENSSL_INCLUDE
|
OPENSSL_INCLUDE
|
||||||
OPENSSL_LIB
|
OPENSSL_LIB
|
||||||
|
PBX_SRTP_SHUTDOWN
|
||||||
|
SRTP_SHUTDOWN_DIR
|
||||||
|
SRTP_SHUTDOWN_INCLUDE
|
||||||
|
SRTP_SHUTDOWN_LIB
|
||||||
PBX_SRTP
|
PBX_SRTP
|
||||||
SRTP_DIR
|
SRTP_DIR
|
||||||
SRTP_INCLUDE
|
SRTP_INCLUDE
|
||||||
@@ -11187,6 +11191,18 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SRTP_SHUTDOWN_DESCRIP="SRTP Library Shutdown Function"
|
||||||
|
SRTP_SHUTDOWN_OPTION=srtp
|
||||||
|
SRTP_SHUTDOWN_DIR=${SRTP_DIR}
|
||||||
|
|
||||||
|
PBX_SRTP_SHUTDOWN=0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPENSSL_DESCRIP="OpenSSL Secure Sockets Layer"
|
OPENSSL_DESCRIP="OpenSSL Secure Sockets Layer"
|
||||||
OPENSSL_OPTION="ssl"
|
OPENSSL_OPTION="ssl"
|
||||||
PBX_OPENSSL=0
|
PBX_OPENSSL=0
|
||||||
@@ -27548,6 +27564,111 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x${PBX_SRTP_SHUTDOWN}" != "x1" -a "${USE_SRTP_SHUTDOWN}" != "no"; then
|
||||||
|
pbxlibdir=""
|
||||||
|
# if --with-SRTP_SHUTDOWN=DIR has been specified, use it.
|
||||||
|
if test "x${SRTP_SHUTDOWN_DIR}" != "x"; then
|
||||||
|
if test -d ${SRTP_SHUTDOWN_DIR}/lib; then
|
||||||
|
pbxlibdir="-L${SRTP_SHUTDOWN_DIR}/lib"
|
||||||
|
else
|
||||||
|
pbxlibdir="-L${SRTP_SHUTDOWN_DIR}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
pbxfuncname="srtp_shutdown"
|
||||||
|
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
|
||||||
|
AST_SRTP_SHUTDOWN_FOUND=yes
|
||||||
|
else
|
||||||
|
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
|
||||||
|
CFLAGS="${CFLAGS} "
|
||||||
|
as_ac_Lib=`$as_echo "ac_cv_lib_srtp_${pbxfuncname}" | $as_tr_sh`
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsrtp" >&5
|
||||||
|
$as_echo_n "checking for ${pbxfuncname} in -lsrtp... " >&6; }
|
||||||
|
if eval \${$as_ac_Lib+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-lsrtp ${pbxlibdir} $LIBS"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
Use char because int might match the return type of a GCC
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
char ${pbxfuncname} ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return ${pbxfuncname} ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
eval "$as_ac_Lib=yes"
|
||||||
|
else
|
||||||
|
eval "$as_ac_Lib=no"
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
eval ac_res=\$$as_ac_Lib
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||||
|
$as_echo "$ac_res" >&6; }
|
||||||
|
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
|
||||||
|
AST_SRTP_SHUTDOWN_FOUND=yes
|
||||||
|
else
|
||||||
|
AST_SRTP_SHUTDOWN_FOUND=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# now check for the header.
|
||||||
|
if test "${AST_SRTP_SHUTDOWN_FOUND}" = "yes"; then
|
||||||
|
SRTP_SHUTDOWN_LIB="${pbxlibdir} -lsrtp "
|
||||||
|
# if --with-SRTP_SHUTDOWN=DIR has been specified, use it.
|
||||||
|
if test "x${SRTP_SHUTDOWN_DIR}" != "x"; then
|
||||||
|
SRTP_SHUTDOWN_INCLUDE="-I${SRTP_SHUTDOWN_DIR}/include"
|
||||||
|
fi
|
||||||
|
SRTP_SHUTDOWN_INCLUDE="${SRTP_SHUTDOWN_INCLUDE} "
|
||||||
|
if test "xsrtp/srtp.h" = "x" ; then # no header, assume found
|
||||||
|
SRTP_SHUTDOWN_HEADER_FOUND="1"
|
||||||
|
else # check for the header
|
||||||
|
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
|
||||||
|
CPPFLAGS="${CPPFLAGS} ${SRTP_SHUTDOWN_INCLUDE}"
|
||||||
|
ac_fn_c_check_header_mongrel "$LINENO" "srtp/srtp.h" "ac_cv_header_srtp_srtp_h" "$ac_includes_default"
|
||||||
|
if test "x$ac_cv_header_srtp_srtp_h" = xyes; then :
|
||||||
|
SRTP_SHUTDOWN_HEADER_FOUND=1
|
||||||
|
else
|
||||||
|
SRTP_SHUTDOWN_HEADER_FOUND=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
|
||||||
|
fi
|
||||||
|
if test "x${SRTP_SHUTDOWN_HEADER_FOUND}" = "x0" ; then
|
||||||
|
SRTP_SHUTDOWN_LIB=""
|
||||||
|
SRTP_SHUTDOWN_INCLUDE=""
|
||||||
|
else
|
||||||
|
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
|
||||||
|
SRTP_SHUTDOWN_LIB=""
|
||||||
|
fi
|
||||||
|
PBX_SRTP_SHUTDOWN=1
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_SRTP_SHUTDOWN 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
|
if test "x${PBX_GMIME}" != "x1" -a "${USE_GMIME}" != "no"; then
|
||||||
PBX_GMIME=0
|
PBX_GMIME=0
|
||||||
if test -n "$ac_tool_prefix"; then
|
if test -n "$ac_tool_prefix"; then
|
||||||
|
|||||||
@@ -444,6 +444,7 @@ AST_EXT_LIB_SETUP_DEPENDENT([SPEEX_PREPROCESS], [speex_preprocess_ctl], [], [spe
|
|||||||
AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
|
AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
|
||||||
AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
|
AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
|
||||||
AST_EXT_LIB_SETUP([SRTP], [Secure RTP], [srtp])
|
AST_EXT_LIB_SETUP([SRTP], [Secure RTP], [srtp])
|
||||||
|
AST_EXT_LIB_SETUP_OPTIONAL([SRTP_SHUTDOWN], [SRTP Library Shutdown Function], [SRTP], [srtp])
|
||||||
AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
|
AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer], [ssl])
|
||||||
AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
|
AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
|
||||||
AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
|
AST_EXT_LIB_SETUP([FREETDS], [FreeTDS], [tds])
|
||||||
@@ -2066,6 +2067,8 @@ then
|
|||||||
CFLAGS="${saved_cflags}"
|
CFLAGS="${saved_cflags}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AST_EXT_LIB_CHECK([SRTP_SHUTDOWN], [srtp], [srtp_shutdown], [srtp/srtp.h])
|
||||||
|
|
||||||
AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
|
AST_EXT_TOOL_CHECK([GMIME], [gmime-config], [], [], [#include <gmime/gmime.h>], [gboolean q = g_mime_check_version(0,0,0);])
|
||||||
if test "x${PBX_GMIME}" = "x0" -a "${PKGCONFIG}" != "No"; then
|
if test "x${PBX_GMIME}" = "x0" -a "${PKGCONFIG}" != "No"; then
|
||||||
# Later versions of GMime use pkg-config
|
# Later versions of GMime use pkg-config
|
||||||
|
|||||||
@@ -739,6 +739,9 @@
|
|||||||
/* Define to 1 if you have the Secure RTP library. */
|
/* Define to 1 if you have the Secure RTP library. */
|
||||||
#undef HAVE_SRTP
|
#undef HAVE_SRTP
|
||||||
|
|
||||||
|
/* Define to 1 if SRTP has the SRTP Library Shutdown Function feature. */
|
||||||
|
#undef HAVE_SRTP_SHUTDOWN
|
||||||
|
|
||||||
/* Define to 1 if you have the ISDN SS7 library. */
|
/* Define to 1 if you have the ISDN SS7 library. */
|
||||||
#undef HAVE_SS7
|
#undef HAVE_SS7
|
||||||
|
|
||||||
|
|||||||
@@ -546,6 +546,9 @@ static void res_srtp_shutdown(void)
|
|||||||
{
|
{
|
||||||
srtp_install_event_handler(NULL);
|
srtp_install_event_handler(NULL);
|
||||||
ast_rtp_engine_unregister_srtp();
|
ast_rtp_engine_unregister_srtp();
|
||||||
|
#ifdef HAVE_SRTP_SHUTDOWN
|
||||||
|
srtp_shutdown();
|
||||||
|
#endif
|
||||||
g_initialized = 0;
|
g_initialized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user