pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39715?usp=email )
Change subject: mgw: Validate CallID before updating endp->x_osmo_ign
......................................................................
mgw: Validate CallID before updating endp->x_osmo_ign
This allows already starting to mark a clear line in CRCX handling
function between *read-only parsing + validation* and *read-write
allocation and update* of objects.
This in turn will allow further clean up on the second mentioned step.
Change-Id: Ia41f7383171bb24f48297456935c633536aa7b05
---
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_protocol.c
2 files changed, 22 insertions(+), 11 deletions(-)
Approvals:
pespin: Looks good to me, approved
daniel: Looks good to me, but someone else must approve
Jenkins Builder: Verified
osmith: Looks good to me, but someone else must approve
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index ebaa32a..2269a66 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -276,10 +276,6 @@
if (!endp)
return -1;
- /* Accept any CallID for "X-Osmo-IGN: C" */
- if (endp->x_osmo_ign & MGCP_X_OSMO_IGN_CALLID)
- return 0;
-
if (!callid)
return -1;
if (!endp->callid)
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index ce397c8..b985a1b 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -928,12 +928,14 @@
}
}
- /* Update endp->x_osmo_ign: */
- endp->x_osmo_ign |= hpars->x_osmo_ign;
-
/* Check if this endpoint already serves a call, if so, check if the
- * callids match up so that we are sure that this is our call */
- if (endp->callid && mgcp_verify_call_id(endp, hpars->callid)) {
+ * callids match up so that we are sure that this is our call.
+ * Do check only if endpoint was (or is by current CRCX) configured
+ * to explicitly ignore it ("X-Osmo-IGN: C").
+ */
+ if (endp->callid &&
+ !((endp->x_osmo_ign | hpars->x_osmo_ign) & MGCP_X_OSMO_IGN_CALLID) &&
+ mgcp_verify_call_id(endp, hpars->callid)) {
LOGPENDP(endp, DLMGCP, LOGL_ERROR,
"CRCX: already seized by other call (%s)\n",
endp->callid);
@@ -949,6 +951,14 @@
}
}
+ /*******************************************************************
+ * Allocate and update endpoint and conn.
+ * From here on below we start updating endpoing and creating conn:
+ *******************************************************************/
+
+ /* Update endp->x_osmo_ign: */
+ endp->x_osmo_ign |= hpars->x_osmo_ign;
+
if (!endp->callid) {
/* Claim endpoint resources. This will also set the callid,
* creating additional connections will only be possible if
@@ -1122,7 +1132,11 @@
return create_err_response(rq->trunk, NULL, -rc, "MDCX", pdata->trans);
}
- if (hpars->callid && mgcp_verify_call_id(endp, hpars->callid) < 0) {
+ /* If a CallID is provided during MDCX, validate (unless endp was explicitly configured to ignore it
+ * through "X-Osmo-IGN: C") that it matches the one previously set. */
+ if (hpars->callid &&
+ !(endp->x_osmo_ign & MGCP_X_OSMO_IGN_CALLID) &&
+ mgcp_verify_call_id(endp, hpars->callid) < 0) {
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_MDCX_FAIL_INVALID_CALLID));
return create_err_response(endp, endp, 516, "MDCX", pdata->trans);
}
@@ -1328,7 +1342,8 @@
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_DLCX_FAIL_UNHANDLED_PARAM));
return create_err_response(rq->trunk, NULL, 539, "DLCX", pdata->trans);
}
- if (mgcp_verify_call_id(endp, hpars->callid) != 0) {
+ if (!(endp->x_osmo_ign & MGCP_X_OSMO_IGN_CALLID) &&
+ mgcp_verify_call_id(endp, hpars->callid) != 0) {
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_DLCX_FAIL_INVALID_CALLID));
return create_err_response(endp, endp, 516, "DLCX", pdata->trans);
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39715?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: Ia41f7383171bb24f48297456935c633536aa7b05
Gerrit-Change-Number: 39715
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
pespin 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+2
--
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: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Mar 2025 12:17:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
pespin 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+2
--
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: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Mar 2025 12:17:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
pespin 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+2
--
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: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Mar 2025 12:17:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Attention is currently required from: fixeria.
neels has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/pysim/+/39742?usp=email )
Change subject: [2/7] personalization: refactor ConfigurableParameter, Iccid, Imsi
......................................................................
Patch Set 4:
(1 comment)
File pySim/esim/saip/personalization.py:
https://gerrit.osmocom.org/c/pysim/+/39742/comment/ade6f2a3_1c874123?usp=em… :
PS4, Line 42: Subclasses have to implement the apply_val() classmethods
> when i tried to detect whether a class is abstract, it didn't work. […]
(re "it didn't work": in two ways: i could not get is_abstract() to return True, and also it turned out that what i planned to probe the abstract-ness for will not work out, because some "abstract" classes actually implement the function with generic parts that subclasses call. So the "semantic" abstractness concept in the end actually needs to be a boolean flag. Simplest, easiest.)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39742?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I6522be4c463e34897ca9bff2309b3706a88b3ce8
Gerrit-Change-Number: 39742
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Mar 2025 12:08:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria.
neels has posted comments on this change by neels. ( https://gerrit.osmocom.org/c/pysim/+/39742?usp=email )
Change subject: [2/7] personalization: refactor ConfigurableParameter, Iccid, Imsi
......................................................................
Patch Set 4:
(2 comments)
File pySim/esim/saip/personalization.py:
https://gerrit.osmocom.org/c/pysim/+/39742/comment/02568da7_49ca10eb?usp=em… :
PS4, Line 40: This class is abstract, you will only use subclasses in practice.
> This is exactly what `abc.ABC` is for. […]
(let's keep one of the two conversations; closing this one)
https://gerrit.osmocom.org/c/pysim/+/39742/comment/c0e6db77_0254e4db?usp=em… :
PS4, Line 42: Subclasses have to implement the apply_val() classmethods
> ... and this would have been obvious if you just defined it as follows: […]
when i tried to detect whether a class is abstract, it didn't work.
I think i tried introspect.isabstract() or similar.
There is no need to enforce the abstractness. It's fine to call the abstract method, even. it is only "semantically" abstract, not in the strict language sense, like in C++ where a function pointer is actually NULL.
In the code I'm working with, there are tons of abstract methods, but i see no abc.
If I don't need enforcing, it doesn't work as is_abstract(), and i can just write "abstract" in the comment, then i can reduce this code cruft without any disadvantage.
right?
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39742?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I6522be4c463e34897ca9bff2309b3706a88b3ce8
Gerrit-Change-Number: 39742
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Mar 2025 11:59:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: pespin.
daniel 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: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 10 Mar 2025 10:42:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes