rtpproxy: fix RTP crypto setup 464/head
authorSebastian Kemper <sebastian_ml@gmx.net>
Sat, 5 Oct 2019 08:20:27 +0000 (10:20 +0200)
committerSebastian Kemper <sebastian_ml@gmx.net>
Sat, 5 Oct 2019 08:20:29 +0000 (10:20 +0200)
Compile fails when both libsrtp and libsrtp2 are available. Patch sent
upstream.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/rtpproxy/Makefile
net/rtpproxy/patches/103-fix-rtp-crypto-setup.patch [new file with mode: 0644]

index aef54ac660359adbc34184f0aebb2aae15516222..ff3b96d2bbfd9512162be6f8fc9b84e27eaa3f1d 100644 (file)
@@ -14,7 +14,7 @@ PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/sippy/rtpproxy.git
 PKG_SOURCE_DATE=2019-10-02
 PKG_SOURCE_VERSION:=aa1f179e09097f467bc4726e3300014c1e35246f
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_MIRROR_HASH:=7acc5f5bf2d4be23e9a2fad0c4e7576f172191c9f1b37104aee4d05dbdcac8fd
 
 PKG_BUILD_PARALLEL:=1
diff --git a/net/rtpproxy/patches/103-fix-rtp-crypto-setup.patch b/net/rtpproxy/patches/103-fix-rtp-crypto-setup.patch
new file mode 100644 (file)
index 0000000..5437151
--- /dev/null
@@ -0,0 +1,78 @@
+commit aa43d358634ab9bf66250babab743a846e2bd689
+Author: Sebastian Kemper <sebastian_ml@gmx.net>
+Date:   Thu Oct 3 19:58:08 2019 +0200
+
+    Fix RTP crypto setup
+    
+    RTPProxy's configure script checks for both libsrtp and libsrtp2. When
+    both are available the configure script ends up setting
+    
+    LIBS_SRTP="-lsrtp2"
+    
+    and defining both ENABLE_SRTP and ENABLE_SRTP2. But the below
+    preprocessor macro in extractaudio/eaud_crypto.c can only deal with one
+    or the other, not both:
+    
+      #if ENABLE_SRTP
+      #       include <srtp/srtp.h>
+      #       define srtp_crypto_policy_set_rtp_default crypto_policy_set_rtp_default
+      #       define srtp_crypto_policy_set_rtcp_default crypto_policy_set_rtcp_default
+      #       define srtp_sec_serv_t sec_serv_t
+      #       define srtp_err_status_ok err_status_ok
+      #elif ENABLE_SRTP2
+      #       include <srtp2/srtp.h>
+      #else
+      #       error "One of srtp or srtp2 must be configured."
+      #endif
+    
+    So it chooses a setup which would be valid for libsrtp and not libsrtp2.
+    But afterward the build system tries to link against libsrtp2 (because
+    of LIBS_SRTP="-lsrtp2") and the compile fails:
+    
+    /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':
+    eaud_crypto.c:(.text+0xc8): undefined reference to `crypto_policy_set_rtp_default'
+    /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'
+    collect2: error: ld returned 1 exit status
+    make[4]: *** [Makefile:567: extractaudio] Error 1
+    
+    Fix this by checking for libsrtp only if libsrtp2 is not found.
+    
+    Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
+
+diff --git a/configure.ac b/configure.ac
+index 6e680c63..fe3216b6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -140,22 +140,22 @@ then
+    AC_DEFINE([ENABLE_SNDFILE], 1, [Define if you have libsndfile library installed]))
+ fi
+-# libsrtp
+-AC_CHECK_HEADER(srtp/srtp.h, found_libsrtp=yes)
+-if test "$found_libsrtp" = yes
+-then
+-  AC_CHECK_LIB(srtp, srtp_init,
+-   LIBS_SRTP="-lsrtp"
+-   AC_DEFINE([ENABLE_SRTP], 1, [Define if you have libsrtp library installed]))
+-fi
+-
+-# libsrtp2
++# libsrtp2 (preferred)
+ AC_CHECK_HEADER(srtp2/srtp.h, found_libsrtp2=yes)
+ if test "$found_libsrtp2" = yes
+ then
+   AC_CHECK_LIB(srtp2, srtp_init,
+    LIBS_SRTP="-lsrtp2"
+    AC_DEFINE([ENABLE_SRTP2], 1, [Define if you have libsrtp2 library installed]))
++else
++  # libsrtp
++  AC_CHECK_HEADER(srtp/srtp.h, found_libsrtp=yes)
++  if test "$found_libsrtp" = yes
++  then
++    AC_CHECK_LIB(srtp, srtp_init,
++     LIBS_SRTP="-lsrtp"
++     AC_DEFINE([ENABLE_SRTP], 1, [Define if you have libsrtp library installed]))
++  fi
+ fi
+ # libelperiodic