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 <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to