pespin has uploaded this change for review.

View Change

osmux: osmux_xfrm_input(): Propagate error code to inform caller

This way the caller can log or make statistics based on the return code.
All known implementations simply check the return code to be >0, so we
are fine here.

Change-Id: I981cc7e560cd9c792a8a2a219b3612f9834296ce
---
M src/osmux.c
1 file changed, 8 insertions(+), 6 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/68/29468/1
diff --git a/src/osmux.c b/src/osmux.c
index f54de7f..da826ad 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -754,9 +754,11 @@
* osmux_xfrm_input - add RTP message to OSmux batch
* \param msg: RTP message that you want to batch into one OSmux message
*
- * If 0 is returned, this indicates that the message has been batched or that
- * an error occured and we have skipped the message. If 1 is returned, you
- * have to invoke osmux_xfrm_input_deliver and try again.
+ * If 0 is returned, this indicates that the message has been batched and the
+ * msgb is now owned by the osmux layer.
+ * If negative value is returned, an error occured and the message has been
+ * dropped (and freed).
+ * If 1 is returned, you have to invoke osmux_xfrm_input_deliver and try again.
*
* The function takes care of releasing the messages in case of error and
* when building the batch.
@@ -774,14 +776,14 @@
LOGP(DLMUX, LOGL_NOTICE, "RTP payload too big (%u) for configured batch size (%u)\n",
msg->len, h->batch_size);
msgb_free(msg);
- return 0;
+ return -1;
}

rtph = osmo_rtp_get_hdr(msg);
if (rtph == NULL) {
LOGP(DLMUX, LOGL_NOTICE, "msg not containing an RTP header\n");
msgb_free(msg);
- return 0;
+ return -1;
}

switch(rtph->payload_type) {
@@ -805,7 +807,7 @@
*/
LOGP(DLMUX, LOGL_DEBUG, "Dropping RTP packet instead of adding to batch\n");
msgb_free(msg);
- return 0;
+ return ret;
}

h->stats.input_rtp_msgs++;

To view, visit change 29468. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I981cc7e560cd9c792a8a2a219b3612f9834296ce
Gerrit-Change-Number: 29468
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-MessageType: newchange