This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has submitted this change and it was merged.
Change subject: osmux: Check batch_factor overflow in osmux_batch_enqueue
......................................................................
osmux: Check batch_factor overflow in osmux_batch_enqueue
This commit should fix a bug present if for instance batch_factor < 8
and osmux_batch_enqueue is called from osmux_replay_lost_packets and
enough packets were lost from last received packet.
Change-Id: I5d643810949aeca4762f0cad05eed534d35087f7
---
M src/osmux.c
1 file changed, 7 insertions(+), 6 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmux.c b/src/osmux.c
index ae0bf26..1dcd04f 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -206,12 +206,13 @@
int dummy;
};
-static int osmux_batch_enqueue(struct msgb *msg, struct osmux_circuit *circuit)
+static int osmux_batch_enqueue(struct msgb *msg, struct osmux_circuit *circuit,
+ uint8_t batch_factor)
{
/* Too many messages per batch, discard it. The counter field of the
* osmux header is just 3 bits long, so make sure it doesn't overflow.
*/
- if (circuit->nmsgs >= 8) {
+ if (circuit->nmsgs >= batch_factor || circuit->nmsgs >= 8) {
struct rtp_hdr *rtph;
rtph = osmo_rtp_get_hdr(msg);
@@ -454,7 +455,7 @@
}
static void osmux_replay_lost_packets(struct osmux_circuit *circuit,
- struct rtp_hdr *cur_rtph)
+ struct rtp_hdr *cur_rtph, int batch_factor)
{
int16_t diff;
struct msgb *last;
@@ -500,7 +501,7 @@
DELTA_RTP_TIMESTAMP);
/* No more room in this batch, skip padding with more clones */
- if (osmux_batch_enqueue(clone, circuit) < 0) {
+ if (osmux_batch_enqueue(clone, circuit, batch_factor) < 0) {
msgb_free(clone);
break;
}
@@ -609,10 +610,10 @@
}
}
/* Handle RTP packet loss scenario */
- osmux_replay_lost_packets(circuit, rtph);
+ osmux_replay_lost_packets(circuit, rtph, batch_factor);
/* This batch is full, force batch delivery */
- if (osmux_batch_enqueue(msg, circuit) < 0)
+ if (osmux_batch_enqueue(msg, circuit, batch_factor) < 0)
return 1;
#ifdef DEBUG_MSG
--
To view, visit https://gerrit.osmocom.org/2403
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5d643810949aeca4762f0cad05eed534d35087f7
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>