rtpproxy: add build fix
[feed/telephony.git] / net / rtpproxy / patches / 103-fix-rtp-crypto-setup.patch
1 commit aa43d358634ab9bf66250babab743a846e2bd689
2 Author: Sebastian Kemper <sebastian_ml@gmx.net>
3 Date: Thu Oct 3 19:58:08 2019 +0200
4
5 Fix RTP crypto setup
6
7 RTPProxy's configure script checks for both libsrtp and libsrtp2. When
8 both are available the configure script ends up setting
9
10 LIBS_SRTP="-lsrtp2"
11
12 and defining both ENABLE_SRTP and ENABLE_SRTP2. But the below
13 preprocessor macro in extractaudio/eaud_crypto.c can only deal with one
14 or the other, not both:
15
16 #if ENABLE_SRTP
17 # include <srtp/srtp.h>
18 # define srtp_crypto_policy_set_rtp_default crypto_policy_set_rtp_default
19 # define srtp_crypto_policy_set_rtcp_default crypto_policy_set_rtcp_default
20 # define srtp_sec_serv_t sec_serv_t
21 # define srtp_err_status_ok err_status_ok
22 #elif ENABLE_SRTP2
23 # include <srtp2/srtp.h>
24 #else
25 # error "One of srtp or srtp2 must be configured."
26 #endif
27
28 So it chooses a setup which would be valid for libsrtp and not libsrtp2.
29 But afterward the build system tries to link against libsrtp2 (because
30 of LIBS_SRTP="-lsrtp2") and the compile fails:
31
32 /home/sk/tmp/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/lib/gcc/mips-openwrt-linux-musl/7.4.0/../../../../mips-openwrt-linux-musl/bin/ld: extractaudio-eaud_crypto.o: in function `eaud_crypto_getopt_parse':
33 eaud_crypto.c:(.text+0xc8): undefined reference to `crypto_policy_set_rtp_default'
34 /home/sk/tmp/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/lib/gcc/mips-openwrt-linux-musl/7.4.0/../../../../mips-openwrt-linux-musl/bin/ld: eaud_crypto.c:(.text+0xd0): undefined reference to `crypto_policy_set_rtcp_default'
35 collect2: error: ld returned 1 exit status
36 make[4]: *** [Makefile:567: extractaudio] Error 1
37
38 Fix this by checking for libsrtp only if libsrtp2 is not found.
39
40 Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
41
42 --- a/configure.ac
43 +++ b/configure.ac
44 @@ -140,22 +140,22 @@ then
45 AC_DEFINE([ENABLE_SNDFILE], 1, [Define if you have libsndfile library installed]))
46 fi
47
48 -# libsrtp
49 -AC_CHECK_HEADER(srtp/srtp.h, found_libsrtp=yes)
50 -if test "$found_libsrtp" = yes
51 -then
52 - AC_CHECK_LIB(srtp, srtp_init,
53 - LIBS_SRTP="-lsrtp"
54 - AC_DEFINE([ENABLE_SRTP], 1, [Define if you have libsrtp library installed]))
55 -fi
56 -
57 -# libsrtp2
58 +# libsrtp2 (preferred)
59 AC_CHECK_HEADER(srtp2/srtp.h, found_libsrtp2=yes)
60 if test "$found_libsrtp2" = yes
61 then
62 AC_CHECK_LIB(srtp2, srtp_init,
63 LIBS_SRTP="-lsrtp2"
64 AC_DEFINE([ENABLE_SRTP2], 1, [Define if you have libsrtp2 library installed]))
65 +else
66 + # libsrtp
67 + AC_CHECK_HEADER(srtp/srtp.h, found_libsrtp=yes)
68 + if test "$found_libsrtp" = yes
69 + then
70 + AC_CHECK_LIB(srtp, srtp_init,
71 + LIBS_SRTP="-lsrtp"
72 + AC_DEFINE([ENABLE_SRTP], 1, [Define if you have libsrtp library installed]))
73 + fi
74 fi
75
76 # libelperiodic