pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39714?usp=email )
Change subject: mgw: Early reject CRCX with X-Osmux if disabled by config
......................................................................
mgw: Early reject CRCX with X-Osmux if disabled by config
This new behavior rejects the CRCX before creating a conn, simplifying
the code and also allows getting rid of the remote_osmux_cid local variable.
Change-Id: I0245b6c02bf7a3452532e8bf0d7c33479999ce9f
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 19 insertions(+), 16 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 916a284..ce397c8 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -817,7 +817,6 @@
struct mgcp_parse_hdr_pars *hpars = &pdata->hpars;
struct rate_ctr_group *rate_ctrs;
int error_code = 400;
- int remote_osmux_cid;
struct mgcp_conn *conn = NULL;
struct mgcp_conn_rtp *conn_rtp = NULL;
char conn_name[512];
@@ -892,13 +891,22 @@
}
}
- remote_osmux_cid = hpars->remote_osmux_cid;
- /* If osmux is disabled, just skip setting it up */
- if (trunk->cfg->osmux.usage == OSMUX_USAGE_OFF)
- remote_osmux_cid = MGCP_PARSE_HDR_PARS_OSMUX_CID_UNSET;
+ /* Reject osmux if disabled by config */
+ if (trunk->cfg->osmux.usage == OSMUX_USAGE_OFF &&
+ hpars->remote_osmux_cid != MGCP_PARSE_HDR_PARS_OSMUX_CID_UNSET) {
+ LOGPENDP(endp, DLMGCP, LOGL_ERROR, "CRCX: Request with Osmux but it is disabled by config!\n");
+ rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX));
+ return create_err_response(endp, endp, 511, "CRCX", pdata->trans);
+ }
+ /* Reject non-osmux if required by config */
+ if (trunk->cfg->osmux.usage == OSMUX_USAGE_ONLY &&
+ hpars->remote_osmux_cid == MGCP_PARSE_HDR_PARS_OSMUX_CID_UNSET) {
+ LOGPENDP(endp, DLMGCP, LOGL_ERROR, "CRCX: Request without Osmux but it is required by config!\n");
+ return create_err_response(endp, endp, 517, "CRCX", pdata->trans);
+ }
/* Make sure osmux is setup: */
- if (remote_osmux_cid != MGCP_PARSE_HDR_PARS_OSMUX_CID_UNSET)
+ if (hpars->remote_osmux_cid != MGCP_PARSE_HDR_PARS_OSMUX_CID_UNSET)
mgcp_trunk_osmux_init_if_needed(trunk);
/* Check if we are able to accept the creation of another connection */
@@ -970,21 +978,16 @@
conn_rtp = mgcp_conn_get_conn_rtp(conn);
OSMO_ASSERT(conn_rtp);
- /* If X-Osmux (remote CID) was received (-1 is wilcard), alloc next avail CID as local CID */
- if (remote_osmux_cid >= -1) {
+ /* If X-Osmux (remote CID) was received, alloc next avail CID as local CID */
+ if (hpars->remote_osmux_cid != MGCP_PARSE_HDR_PARS_OSMUX_CID_UNSET) {
if (osmux_init_conn(conn_rtp) < 0) {
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX));
goto error2;
}
- if (remote_osmux_cid >= 0) {
+ if (hpars->remote_osmux_cid >= 0) {
conn_rtp->osmux.remote_cid_present = true;
- conn_rtp->osmux.remote_cid = remote_osmux_cid;
- }
- } else if (endp->trunk->cfg->osmux.usage == OSMUX_USAGE_ONLY) {
- LOGPCONN(conn, DLMGCP, LOGL_ERROR,
- "CRCX: osmux only and no osmux offered\n");
- rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX));
- goto error2;
+ conn_rtp->osmux.remote_cid = hpars->remote_osmux_cid;
+ } /* else: -1 (wildcard) */
}
/* Set local connection options, if present */
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39714?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I0245b6c02bf7a3452532e8bf0d7c33479999ce9f
Gerrit-Change-Number: 39714
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39713?usp=email )
Change subject: cosmetic: Drop incorrect comment
......................................................................
cosmetic: Drop incorrect comment
The writer of this commit wrongly interpreted conn->end to be an
mgcp_endpoint, but it's actually an struct mgcp_rtp_end, hence codecs
are set per connection as expected.
Change-Id: I773065972342b8cedc900e3d194c48775c3adb5a
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 0 insertions(+), 1 deletion(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
osmith: Looks good to me, approved
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 34b0111..916a284 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1009,7 +1009,6 @@
goto error2;
}
/* Upgrade the conn type RTP_DEFAULT->RTP_IUUP if needed based on requested codec: */
- /* TODO: "codec" probably needs to be moved from endp to conn */
if (conn_rtp->type == MGCP_RTP_DEFAULT &&
strcmp(conn_rtp->end.cset.codec->subtype_name, "VND.3GPP.IUFP") == 0) {
rc = mgcp_conn_iuup_init(conn_rtp);
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39713?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I773065972342b8cedc900e3d194c48775c3adb5a
Gerrit-Change-Number: 39713
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39722?usp=email )
Change subject: mgw: Allocate req and pdata with talloc
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39722?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I2b971d0c8268f4c0a30b84b54a2e5f16ada4ecdb
Gerrit-Change-Number: 39722
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 07 Mar 2025 13:55:35 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39721?usp=email )
Change subject: mgw: Use tall_mgw_ctx to allocate struct mgcp_config
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39721?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ib51f1066bb73da4472bd8967cc1b1c44e964e9e5
Gerrit-Change-Number: 39721
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 07 Mar 2025 13:53:28 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39720?usp=email )
Change subject: mgw: Add backpointer from pdata to req to have context available
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39720?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I464258ca1a8817d58ae5c5426dfc3b7cee6763d3
Gerrit-Change-Number: 39720
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 07 Mar 2025 13:52:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39719?usp=email )
Change subject: mgw: Move cfg pointer from pdata to rq
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39719?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ie64fb6250cc84f1e7737b5c1cf5cca314c7020ed
Gerrit-Change-Number: 39719
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 07 Mar 2025 13:50:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39717?usp=email )
Change subject: mgw: Store Command as enum in struct mgcp_request_data
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39717?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I2d4b5ddb93376b59413b34c9668c41157ab05497
Gerrit-Change-Number: 39717
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 07 Mar 2025 13:47:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes