dexter has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34498?usp=email )
Change subject: PCUIF_Components: ensure clean IMSI string
......................................................................
PCUIF_Components: ensure clean IMSI string
When receiving an IMSI from PCUIF (see type record PCUIF_pch), it is
represented as a null terminated string. The field is set to be 17
characters wide with a pdding of zeros at the end (as it ought to be
for a null terminated string). Unfortunately TTCN3 will not chop off
the trailing zeros, and also include them when the string length is
determined using lengthof(). This means we must take care of this
ourselves.
Let's use a regular expression to make sure any non numerical digits
are trimmed off before passing the IMSI string on to higher layers.
Related: OS#5927
Change-Id: I7bfea59a306e75211856e4e80985ebf000c42224
---
M pcu/PCUIF_Components.ttcn
1 file changed, 24 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/98/34498/1
diff --git a/pcu/PCUIF_Components.ttcn b/pcu/PCUIF_Components.ttcn
index 01638b1..b297de6 100644
--- a/pcu/PCUIF_Components.ttcn
+++ b/pcu/PCUIF_Components.ttcn
@@ -542,6 +542,8 @@
var octetstring data;
var PCUIF_pch pch;
var PCUIF_agch agch;
+ var charstring imsi_filter_regexp := "(\d*)" /* numbers only */
+
/* On PCH the payload is prefixed with paging group (3 octets): skip it.
* TODO: add an additional template parameter, so we can match it. */
if (pcu_msg.u.data_req.sapi == PCU_IF_SAPI_PCH) {
@@ -555,7 +557,7 @@
if (pcu_msg_rr.raw.sapi == PCU_IF_SAPI_PCH_2) {
pch := dec_PCUIF_pch(pcu_msg_rr.raw.data);
pcu_msg_rr.msg_id := pch.msg_id;
- pcu_msg_rr.imsi := pch.imsi;
+ pcu_msg_rr.imsi := regexp(pch.imsi, imsi_filter_regexp, 0);
pcu_msg_rr.rr_msg := dec_GsmRrMessage(pch.data);
pcu_msg_rr.confirm := pch.confirm;
} else if (pcu_msg_rr.raw.sapi == PCU_IF_SAPI_AGCH_2) {
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34498?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7bfea59a306e75211856e4e80985ebf000c42224
Gerrit-Change-Number: 34498
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange