Change in osmo-mgw[master]: protocol: do not change LCO, when no LCO are present

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jun 6 15:32:43 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9472 )

Change subject: protocol: do not change LCO, when no LCO are present
......................................................................

protocol: do not change LCO, when no LCO are present

In the current implementation the LCO parameters are reset. This means
that an MDCX without LCO will reset the LCO that have previously set
via CRCX. But according to RFC 3435 6.8 LocalConnectionOptions, the
LCO parameters should be preserved or left at their defaults if missing.

- Make sure LCO are retained if no LCO string is present.
- Also preserve the values of individual parameters if missing.

Change-Id: Ia0d73f61516618317dcd1d49384818fd8de27aa6
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 8 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index b403be0..ded1552 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -405,10 +405,12 @@
 	char *p_opt, *a_opt;
 	char codec[9];
 
+	if (!options)
+		return 0;
+	if (strlen(options) == 0)
+		return 0;
+
 	talloc_free(lco->string);
-	talloc_free(lco->codec);
-	lco->codec = NULL;
-	lco->pkt_period_min = lco->pkt_period_max = 0;
 	lco->string = talloc_strdup(ctx, options ? options : "");
 
 	p_opt = strstr(lco->string, "p:");
@@ -417,8 +419,10 @@
 		lco->pkt_period_max = lco->pkt_period_min;
 
 	a_opt = strstr(lco->string, "a:");
-	if (a_opt && sscanf(a_opt, "a:%8[^,]", codec) == 1)
+	if (a_opt && sscanf(a_opt, "a:%8[^,]", codec) == 1) {
+		talloc_free(lco->codec);
 		lco->codec = talloc_strdup(ctx, codec);
+	}
 
 	LOGP(DLMGCP, LOGL_DEBUG,
 	     "local CX options: lco->pkt_period_max: %i, lco->codec: %s\n",

-- 
To view, visit https://gerrit.osmocom.org/9472
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0d73f61516618317dcd1d49384818fd8de27aa6
Gerrit-Change-Number: 9472
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180606/6e597cc8/attachment.htm>


More information about the gerrit-log mailing list