Change in osmo-mgw[master]: libosmo-mgcp: do not use the default msgb talloc context

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/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Sep 13 19:05:52 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/25423 )

Change subject: libosmo-mgcp: do not use the default msgb talloc context
......................................................................

libosmo-mgcp: do not use the default msgb talloc context

Trunk is safe, since it will not disappear sooner than the endpoints or
connections.

osmux still missing!

Change-Id: I15b01085f31e9a10a1ad381713ca2275356ca20c
---
M src/libosmo-mgcp/mgcp_e1.c
M src/libosmo-mgcp/mgcp_network.c
2 files changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Jenkins Builder: Verified
  dexter: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/src/libosmo-mgcp/mgcp_e1.c b/src/libosmo-mgcp/mgcp_e1.c
index effbe77..e88b8c5 100644
--- a/src/libosmo-mgcp/mgcp_e1.c
+++ b/src/libosmo-mgcp/mgcp_e1.c
@@ -192,7 +192,7 @@
 {
 	struct mgcp_endpoint *endp = user_data;
 	struct rate_ctr_group *rate_ctrs = endp->trunk->ratectr.e1_stats;
-	struct msgb *msg = msgb_alloc(E1_TRAU_BITS_MSGB, "E1-I.460-IDLE-TX-TRAU-frame");
+	struct msgb *msg = msgb_alloc_c(endp->trunk, E1_TRAU_BITS_MSGB, "E1-I.460-IDLE-TX-TRAU-frame");
 	uint8_t *ptr;
 	const uint8_t *ptr_ft;
 	enum osmo_trau_frame_type ft;
@@ -238,9 +238,9 @@
  * (the resulting frame will be prepended with an all-zero (12-byte) rtp header) */
 static void sync_frame_out_cb(void *user_data, const ubit_t *bits, unsigned int num_bits)
 {
-	struct msgb *msg = msgb_alloc(RTP_BUF_SIZE, "RTP-rx-from-E1");
 	unsigned int rtp_hdr_len = sizeof(struct rtp_hdr);
 	struct mgcp_endpoint *endp = user_data;
+	struct msgb *msg = msgb_alloc_c(endp->trunk, RTP_BUF_SIZE, "RTP-rx-from-E1");
 	struct rate_ctr_group *rate_ctrs = endp->trunk->ratectr.e1_stats;
 	struct mgcp_conn *conn_dst;
 	struct osmo_trau_frame fr;
@@ -312,7 +312,7 @@
 /* Function to handle outgoing E1 traffic */
 static void e1_send(struct e1inp_ts *ts, struct mgcp_trunk *trunk)
 {
-	struct msgb *msg = msgb_alloc(E1_TS_BYTES, "E1-TX-timeslot-bytes");
+	struct msgb *msg = msgb_alloc_c(trunk, E1_TS_BYTES, "E1-TX-timeslot-bytes");
 	uint8_t *ptr;
 
 	/* Get E1 frame from I.460 multiplexer */
@@ -622,7 +622,7 @@
  *  \returns 0 on success, -1 on ERROR. */
 int mgcp_e1_send_rtp(struct mgcp_endpoint *endp, struct mgcp_rtp_codec *codec, struct msgb *msg)
 {
-	struct msgb *msg_tf = msgb_alloc(E1_TRAU_BITS_MSGB, "E1-I.460-TX-TRAU-frame");
+	struct msgb *msg_tf = msgb_alloc_c(endp->trunk, E1_TRAU_BITS_MSGB, "E1-I.460-TX-TRAU-frame");
 	struct rate_ctr_group *rate_ctrs = endp->trunk->ratectr.e1_stats;
 	unsigned int rtp_hdr_len = sizeof(struct rtp_hdr);
 	struct osmo_trau_frame tf;
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index cb82137..86b0d06 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1448,13 +1448,14 @@
 	int ret;
 	enum rtp_proto proto;
 	struct osmo_rtp_msg_ctx *mc;
-	struct msgb *msg = msgb_alloc(RTP_BUF_SIZE, "RTP-rx");
+	struct msgb *msg;
 	int rc;
 
 	conn_src = (struct mgcp_conn_rtp *)fd->data;
 	OSMO_ASSERT(conn_src);
 	endp = conn_src->conn->endp;
 	OSMO_ASSERT(endp);
+	msg = msgb_alloc_c(endp->trunk, RTP_BUF_SIZE, "RTP-rx");
 
 	proto = (fd == &conn_src->end.rtp)? MGCP_PROTO_RTP : MGCP_PROTO_RTCP;
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/25423
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I15b01085f31e9a10a1ad381713ca2275356ca20c
Gerrit-Change-Number: 25423
Gerrit-PatchSet: 9
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210913/0f4617cd/attachment.htm>


More information about the gerrit-log mailing list