aboutsummaryrefslogtreecommitdiffstats
path: root/main/rtpproxy
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-04-27 09:40:29 +0300
committerTimo Teräs <timo.teras@iki.fi>2017-04-27 09:40:52 +0300
commita2985c11aa706316f0a71dca6c4a7202deb83b18 (patch)
tree0dddc8858eb82128032958417372018917178406 /main/rtpproxy
parentda4e4e38aff23797e8baf6d0be35d42162af331f (diff)
downloadaports-a2985c11aa706316f0a71dca6c4a7202deb83b18.tar.bz2
aports-a2985c11aa706316f0a71dca6c4a7202deb83b18.tar.xz
main/rtpproxy: cherry-pick upstream fix for possible packet flood issue
Diffstat (limited to 'main/rtpproxy')
-rw-r--r--main/rtpproxy/0001-Fix-overflow-bug-in-the-RTP-traffic-generator-which-.patch106
-rw-r--r--main/rtpproxy/APKBUILD16
2 files changed, 109 insertions, 13 deletions
diff --git a/main/rtpproxy/0001-Fix-overflow-bug-in-the-RTP-traffic-generator-which-.patch b/main/rtpproxy/0001-Fix-overflow-bug-in-the-RTP-traffic-generator-which-.patch
new file mode 100644
index 0000000000..5841c73152
--- /dev/null
+++ b/main/rtpproxy/0001-Fix-overflow-bug-in-the-RTP-traffic-generator-which-.patch
@@ -0,0 +1,106 @@
+From 1a6cbd16da7afa8312bc8f9e9419ea9db42f8bcf Mon Sep 17 00:00:00 2001
+From: Maksym Sobolyev <sobomax@sippysoft.com>
+Date: Mon, 20 Apr 2015 18:53:07 -0700
+Subject: [PATCH] Fix overflow bug in the RTP traffic generator, which uses
+ 32-bit timestamp from the rtp header to track its progress. The problem here
+ is we keep the session for some 6.2 days, that counter overflows and we go
+ into infinite loop spewing packet at the max rate our sender threads can
+ handle them, which is about 100Kpps on our reference hardware. We need to
+ figure out why that session has managed to stay up for so long, but in any
+ case moving to 64-bit counter would provide us wastly more time till overlow.
+
+The separate question is why session managed to stay active for
+so long, but we will probably address that in a separate
+changeset.
+---
+ src/rtp_server.c | 14 +++++++-------
+ src/rtp_server.h | 2 +-
+ src/rtpp_command.c | 2 +-
+ 3 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/rtp_server.c b/src/rtp_server.c
+index 9279a66..3c09e3d 100644
+--- a/src/rtp_server.c
++++ b/src/rtp_server.c
+@@ -49,10 +49,11 @@ struct rtp_server {
+ unsigned char *pload;
+ int fd;
+ int loop;
++ uint64_t dts;
+ };
+
+ struct rtp_server *
+-rtp_server_new(const char *name, rtp_type_t codec, int loop)
++rtp_server_new(const char *name, rtp_type_t codec, int loop, double dtime)
+ {
+ struct rtp_server *rp;
+ int fd;
+@@ -71,7 +72,8 @@ rtp_server_new(const char *name, rtp_type_t codec, int loop)
+
+ memset(rp, 0, sizeof(*rp));
+
+- rp->btime = -1;
++ rp->btime = dtime;
++ rp->dts = 0;
+ rp->fd = fd;
+ rp->loop = (loop > 0) ? loop - 1 : loop;
+
+@@ -106,12 +108,8 @@ rtp_server_get(struct rtp_server *rp, double dtime, int *rval)
+ int rlen, rticks, bytes_per_frame, ticks_per_frame, number_of_frames;
+ int hlen;
+
+- if (rp->btime == -1)
+- rp->btime = dtime;
+
+- ts = ntohl(rp->rtp->ts);
+-
+- if (rp->btime + ((double)ts / RTPS_SRATE) > dtime) {
++ if (rp->btime + ((double)rp->dts / 1000.0) > dtime) {
+ *rval = RTPS_LATER;
+ return (NULL);
+ }
+@@ -157,6 +155,7 @@ rtp_server_get(struct rtp_server *rp, double dtime, int *rval)
+
+ rlen = bytes_per_frame * number_of_frames;
+ rticks = ticks_per_frame * number_of_frames;
++ rp->dts += rticks;
+
+ pkt = rtp_packet_alloc();
+ if (pkt == NULL) {
+@@ -180,6 +179,7 @@ rtp_server_get(struct rtp_server *rp, double dtime, int *rval)
+ rp->rtp->m = 0;
+ }
+
++ ts = ntohl(rp->rtp->ts);
+ rp->rtp->ts = htonl(ts + (RTPS_SRATE * rticks / 1000));
+ rp->rtp->seq = htons(ntohs(rp->rtp->seq) + 1);
+
+diff --git a/src/rtp_server.h b/src/rtp_server.h
+index b12742b..7b5d1fb 100644
+--- a/src/rtp_server.h
++++ b/src/rtp_server.h
+@@ -47,7 +47,7 @@ struct rtp_server;
+ struct rtpp_session;
+ struct cfg;
+
+-struct rtp_server *rtp_server_new(const char *, rtp_type_t, int);
++struct rtp_server *rtp_server_new(const char *, rtp_type_t, int, double);
+ void rtp_server_free(struct rtp_server *);
+ struct rtp_packet *rtp_server_get(struct rtp_server *, double, int *);
+ void append_server(struct cfg *, struct rtpp_session *);
+diff --git a/src/rtpp_command.c b/src/rtpp_command.c
+index 60b1252..298da45 100644
+--- a/src/rtpp_command.c
++++ b/src/rtpp_command.c
+@@ -635,7 +635,7 @@ handle_play(struct cfg *cf, struct rtpp_session *spa, int idx, char *codecs,
+ codecs = cp;
+ if (*codecs != '\0')
+ codecs++;
+- spa->rtps[idx] = rtp_server_new(pname, n, playcount);
++ spa->rtps[idx] = rtp_server_new(pname, n, playcount, cmd->dtime);
+ if (spa->rtps[idx] == NULL)
+ continue;
+ cmd->csp->nplrs_created.cnt++;
+--
+2.12.2
+
diff --git a/main/rtpproxy/APKBUILD b/main/rtpproxy/APKBUILD
index 3e7044d271..10019b2dbb 100644
--- a/main/rtpproxy/APKBUILD
+++ b/main/rtpproxy/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=rtpproxy
pkgver=2.0.0
-pkgrel=3
+pkgrel=4
pkgdesc="RTP proxy"
url="http://www.rtpproxy.org"
arch="all"
@@ -13,6 +13,7 @@ makedepends="$depends_dev libsndfile-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-debug $pkgname-tools"
source="$pkgname-$pkgver.tar.gz::https://github.com/sippy/rtpproxy/archive/v${pkgver}.tar.gz
+ 0001-Fix-overflow-bug-in-the-RTP-traffic-generator-which-.patch
musl-fix-headers.patch
define-byte-order.patch
prevent-pthread-from-running-macro.patch
@@ -64,19 +65,8 @@ package() {
install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}
-md5sums="8d36fcc1dd93994ac5376d145f19ac73 rtpproxy-2.0.0.tar.gz
-620786b8d8460446fc1a59c6b49a1351 musl-fix-headers.patch
-9c915ff8c04976304394febe5fceeccc define-byte-order.patch
-118c66428b994a8340c2bed05355ef0d prevent-pthread-from-running-macro.patch
-aee99ab9f380cd0b43754ae658f26c92 rtpproxy.confd
-339df46a13cce145dfc9f26cd585f695 rtpproxy.initd"
-sha256sums="b52bf2a302a8f08c269217e5d507f3c3ba38f4b627bb7029c8dac8ec268b23c6 rtpproxy-2.0.0.tar.gz
-de8f7bca9ed93e1dab34d3c48f9792be525277a5a6df60a829ba6c6769449ac0 musl-fix-headers.patch
-342d30d1c24fd0b5d2d697591405aefdf4fbc372877bf63a4dc76f60b88ac50b define-byte-order.patch
-1cd9c7794c9da256f0eb69eb7476ab939479111320a664602f6b39c11ef0f50d prevent-pthread-from-running-macro.patch
-0b956e60a4fb27140d88c2182537615f524e167e6b608a9c9782bbf781791e1d rtpproxy.confd
-c499e6bfc3741d34dce67631a071219aefab9c9c5afb951cb645383e8b908019 rtpproxy.initd"
sha512sums="d3991643e1e260890ec284a5cb0bacac012063512667215166551a1d534921caa035ab64452e2be7837b306ce4486cc604a9bb552254913f3a920d7756ad3711 rtpproxy-2.0.0.tar.gz
+316c5af882b7d69085ac041852f81c19487b746638db6607c1312512806e0089df3972fff60c2207ad8f7314855c9ce585928e2d65c119fc82f025af761dc486 0001-Fix-overflow-bug-in-the-RTP-traffic-generator-which-.patch
bd05f24bfa66cd9491135efe341359cc4b16b80fd9c45fbfc880c7a82ba53ad5f2317dd6bfbaecfd0dd42ba0d54a55041403ba6409b8deff568fcb095892956d musl-fix-headers.patch
8ab21c20ee87c0d9ef9a113b436eaecd34d93c596d761b2f4b8d746c34946acb41421ab24be6446dd2ad2c0c3e1cd894637d945e945a90e1af1eda091d91306f define-byte-order.patch
ba54855fd147c8f166939b37a18c0576c55481c762c3f5b9e0ffa45e00eedeeaabb1d3fd4e45fe8f59f43064ecd852d87f83bcc8f746923219e9e3a795cf592e prevent-pthread-from-running-macro.patch