falconia has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39730?usp=email )
Change subject: MGCP extension: add parameters for TW-TS-001 & TW-TS-002
......................................................................
MGCP extension: add parameters for TW-TS-001 & TW-TS-002
TW-TS-001 and TW-TS-002 are enhanced RTP transport formats for
GSM FR/HR/EFR codecs that restore the lost semantics of GSM 08.60
and 08.61 TRAU-UL frames.
TW-TS-003 BSSMAP extension provides a way for a core network to
ask the BSS to use these TRAU-like enhanced RTP formats instead of
those specified in 3GPP TS 48.103; OsmoBSC already supports this
mechanism when the BSS is comprised of IP-native OsmoBTS.
However, in order to achieve the same effect when using E1-based
legacy BTS hardware, the task of generating TW-TS-001/002 RTP
packets for UL and accepting them for DL moves from OsmoBTS to
the E1-Abis-interfacing MGW. osmo_trau2rtp() is already capable
of generating these extended RTP formats on request, but until now
there was no mechanism to signal from OsmoBSC to its associated
E1 Abis MGW whether and when these extensions should be used.
Considering that MGCP as it is used in Osmocom is essentially a
private interface between OsmoBSC or OsmoMSC masters and OsmoMGW
slaves, while the externally defined and generally interoperable
interface is 3GPP TS 48.008, possibly extended with TW-TS-003,
the sensible solution is to make a private extension to the way
FR, EFR and HR codecs are described in SDP in the context of
Osmocom-MGCP.
The SDP extension birthed in the present patch consists of an fmtp
parameter for GSM, GSM-EFR and GSM-HR-08 codecs that is structured
just like the already implemented octet-align parameter for AMR.
TW-TS-001 for FR and EFR shall be described as follows:
m=audio 1234 RTP/AVP 3 110
a=rtpmap:3 GSM/8000/1
a=fmtp:3 tw-ts-001=1
a=rtpmap:110 GSM-EFR/8000/1
a=fmtp:110 tw-ts-001=1
TW-TS-002 for HR codec shall be described as follows:
m=audio 1234 RTP/AVP 111
a=rtpmap:111 GSM-HR-08/8000/1
a=fmtp:111 tw-ts-002=1
The present patch affects two areas:
* Experimental support for the newly defined extension is added to
OsmoMGW-E1. This support is deemed experimental (not for
production use) because even with this extension added, OsmoMGW-E1
is still unable to satisfy ThemWi requirements: neither ThemWi
RTP endpoint library nor the TFO transform of TS 28.062 section
C.3.2.1.1 are currently available in the repertoire of libraries
whose use is allowed in mainline OsmoCNI components, yet both are
required.
* Support is added to libosmo-mgcp-client whereby OsmoBSC will be
able to issue CRCX and MDCX commands to E1 Abis MGW endpoints
with TW-TS-001 and/or TW-TS-002 enabled. Adding the necessary
support to OsmoBSC will allow a complete working system to be
deployed using OsmoBSC plus tw-e1abis-mgw, a replacement for
OsmoMGW-E1 that works by using both Osmocom and ThemWi libraries.
Related: OS#6614
Change-Id: I0d58e6d84418f50670c8ab7cf8490af3bc2f5c26
---
M doc/manuals/chapters/mgcp_extensions.adoc
M include/osmocom/mgcp/mgcp_common.h
M include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp/mgcp_e1.c
M src/libosmo-mgcp/mgcp_sdp.c
6 files changed, 160 insertions(+), 13 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
falconia: Looks good to me, approved
diff --git a/doc/manuals/chapters/mgcp_extensions.adoc b/doc/manuals/chapters/mgcp_extensions.adoc
index df314bc..ebc0696 100644
--- a/doc/manuals/chapters/mgcp_extensions.adoc
+++ b/doc/manuals/chapters/mgcp_extensions.adoc
@@ -70,3 +70,85 @@
=== `X-Osmux`
See <<mgcp-extension-osmux>>
+
+=== Non-standard SDP codec parameters
+
+CRCX command message normally includes an SDP block that specifies the RTP
+address of the connecting peer and the list of codecs accepted by that entity.
+Codec specifications may include optional parameters given via `a=fmtp` lines;
+one well-known parameter is `octet-align`, defined for AMR and AMR-WB codecs.
+
+In addition to standard (RFC-defined) codec parameters (of which the
+just-mentioned `octet-align` parameter is the only one implemented so far),
+OsmoMGW also understands some non-standard (Osmocom-private) codec parameters
+as listed below.
+These Osmocom-private codec parameters are meaningful only in the context
+of OsmoBSC driving an E1 Abis MGW, which may be either OsmoMGW or a specialized
+third-party replacement.
+
+The MGCP extension described in this section is meaningful only for E1
+endpoints - it has absolutely no effect on `rtpbridge` endpoints!
+
+==== `tw-ts-001` parameter for FR and EFR codecs
+
+GSM Full Rate codec is known in SDP as `GSM`; GSM Enhanced Full Rate codec
+is known in SDP as `GSM-EFR`.
+When either codec is to be transported in RTP, there is a choice between
+two different payload formats: RFC 3551 or TW-TS-001.
+RFC 3551 is the standard in non-GSM Internet applications, and it is the
+format specified in later 3GPP releases for IP-based transport of
+compressed speech - however, it exhibits functional regressions compared
+to the original TRAU-UL frame format of GSM 08.60.
+TW-TS-001 is an enhanced alternative payload format for the same codecs
+that restores the original functionality and semantics of TRAU-UL frames.
+
+In the context of CRCX or MDCX command messages from OsmoBSC to an E1 Abis MGW,
+`tw-ts-001` codec parameter (attached to either `GSM` or `GSM-EFR` codec)
+instructs the MGW whether or not it should emit the extended payload format
+of TW-TS-001 for GSM uplink traffic converted to RTP.
+In the absence of this parameter, IETF-standard and 3GPP-standard RFC 3551
+format is emitted; if TW-TS-001 output is desired, please specify
+`tw-ts-001=1` on the appropriate `a=fmtp` line.
+
+.Example: `CRCX` message requesting EFR codec with TW-TS-001 extensions
+----
+CRCX 2 ds/e1-0/s-2/su16-2@mgw MGCP 1.0
+M: recvonly
+C: 2
+L: p:20
+
+v=0
+c=IN IP4 123.12.12.123
+m=audio 1234 RTP/AVP 110
+a=rtpmap:110 GSM-EFR/8000/1
+a=fmtp:110 tw-ts-001=1
+----
+
+==== `tw-ts-002` parameter for HR codec
+
+GSM Half Rate codec is known in SDP as `GSM-HR-08`.
+The same dichotomy that exists between RFC 3551 and TW-TS-001 RTP payload
+formats for FR and EFR codecs also exists for HR codec, except that
+the two opposing alternatives are now RFC 5993 and TW-TS-002.
+
+In the context of CRCX or MDCX command messages from OsmoBSC to an E1 Abis MGW,
+`tw-ts-002` codec parameter (attached to `GSM-HR-08` codec)
+instructs the MGW whether or not it should emit the extended payload format
+of TW-TS-002 for GSM uplink traffic converted to RTP.
+In the absence of this parameter, IETF-standard and 3GPP-standard RFC 5993
+format is emitted; if TW-TS-002 output is desired, please specify
+`tw-ts-002=1` on the appropriate `a=fmtp` line.
+
+.Example: `CRCX` message requesting HR codec with TW-TS-002 extensions
+----
+CRCX 2 ds/e1-0/s-2/su8-2@mgw MGCP 1.0
+M: recvonly
+C: 2
+L: p:20
+
+v=0
+c=IN IP4 123.12.12.123
+m=audio 1234 RTP/AVP 111
+a=rtpmap:111 GSM-HR-08/8000/1
+a=fmtp:111 tw-ts-002=1
+----
diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h
index 05ae95f..14b226f 100644
--- a/include/osmocom/mgcp/mgcp_common.h
+++ b/include/osmocom/mgcp/mgcp_common.h
@@ -63,6 +63,10 @@
struct mgcp_codec_param {
bool amr_octet_aligned_present;
bool amr_octet_aligned;
+ bool fr_efr_twts001_present;
+ bool fr_efr_twts001;
+ bool hr_twts002_present;
+ bool hr_twts002;
};
/* Ensure that the msg->l2h is NUL terminated. */
diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index fbe0850..3366674 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -124,6 +124,7 @@
struct osmo_fsm_inst *trau_sync_fi;
struct osmo_trau2rtp_state *trau_rtp_st;
uint8_t last_amr_ft;
+ uint8_t rtp_extensions;
struct mgcp_rtp_codec *last_codec;
} e1;
diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index ab8ba9f..63d03f9 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -1426,15 +1426,32 @@
/* Add optional codec parameters (fmtp) */
if (mgcp_msg->param_present) {
for (i = 0; i < mgcp_msg->ptmap_len; i++) {
- /* The following is only applicable for AMR */
- if (mgcp_msg->ptmap[i].codec != CODEC_AMR_8000_1
- && mgcp_msg->ptmap[i].codec != CODEC_AMRWB_16000_1)
- continue;
pt = mgcp_msg->ptmap[i].pt;
- if (mgcp_msg->param.amr_octet_aligned_present && mgcp_msg->param.amr_octet_aligned)
- MSGB_PRINTF_OR_RET("a=fmtp:%u octet-align=1\r\n", pt);
- else if (mgcp_msg->param.amr_octet_aligned_present && !mgcp_msg->param.amr_octet_aligned)
- MSGB_PRINTF_OR_RET("a=fmtp:%u octet-align=0\r\n", pt);
+ switch (mgcp_msg->ptmap[i].codec) {
+ case CODEC_AMR_8000_1:
+ case CODEC_AMRWB_16000_1:
+ if (!mgcp_msg->param.amr_octet_aligned_present)
+ break;
+ MSGB_PRINTF_OR_RET("a=fmtp:%u octet-align=%d\r\n",
+ pt, (int)mgcp_msg->param.amr_octet_aligned);
+ break;
+ case CODEC_GSM_8000_1:
+ case CODEC_GSMEFR_8000_1:
+ if (!mgcp_msg->param.fr_efr_twts001_present)
+ break;
+ MSGB_PRINTF_OR_RET("a=fmtp:%u tw-ts-001=%d\r\n",
+ pt, (int)mgcp_msg->param.fr_efr_twts001);
+ break;
+ case CODEC_GSMHR_8000_1:
+ if (!mgcp_msg->param.hr_twts002_present)
+ break;
+ MSGB_PRINTF_OR_RET("a=fmtp:%u tw-ts-002=%d\r\n",
+ pt, (int)mgcp_msg->param.hr_twts002);
+ break;
+ default:
+ /* no parameters for the remaining codecs */
+ break;
+ }
}
}
diff --git a/src/libosmo-mgcp/mgcp_e1.c b/src/libosmo-mgcp/mgcp_e1.c
index 3a7a450..f056d75 100644
--- a/src/libosmo-mgcp/mgcp_e1.c
+++ b/src/libosmo-mgcp/mgcp_e1.c
@@ -40,6 +40,7 @@
#include <osmocom/mgcp/debug.h>
#include <osmocom/mgcp/mgcp_e1.h>
#include <osmocom/codec/codec.h>
+#include <osmocom/gsm/rtp_extensions.h>
#define DEBUG_BITS_MAX 80
#define DEBUG_BYTES_MAX 40
@@ -294,6 +295,7 @@
/* Convert decoded trau frame to RTP frame */
struct osmo_trau2rtp_state t2rs = {
.type = fr.type,
+ .rtp_extensions = endp->e1.rtp_extensions,
};
rc = osmo_trau2rtp(msgb_data(msg) + rtp_hdr_len, msg->data_len - rtp_hdr_len, &fr, &t2rs);
if (rc <= 0) {
@@ -682,6 +684,13 @@
determine_trau_fr_type(codec->subtype_name, endp->e1.scd.rate, endp->e1.last_amr_ft, endp);
endp->e1.last_codec = codec;
+ /* possible RTP extensions, codec-associated */
+ endp->e1.rtp_extensions = 0;
+ if (codec->param_present && codec->param.fr_efr_twts001)
+ endp->e1.rtp_extensions |= OSMO_RTP_EXT_TWTS001;
+ if (codec->param_present && codec->param.hr_twts002)
+ endp->e1.rtp_extensions |= OSMO_RTP_EXT_TWTS002;
+
/* Update sync pattern */
sync_pat_id = determine_trau_sync_pat(codec->subtype_name, endp->e1.scd.rate, endp->e1.last_amr_ft, endp);
osmo_trau_sync_set_pat(endp->e1.trau_sync_fi, sync_pat_id);
diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index 1d76ddb..2f21678 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -199,7 +199,7 @@
unsigned int pt;
unsigned int count = 0;
char delimiter;
- unsigned int amr_octet_aligned;
+ unsigned int param_val;
memset(fmtp_param, 0, sizeof(*fmtp_param));
@@ -239,12 +239,30 @@
if (delimiter == ';' || delimiter == ',')
str_ptr[strlen(str_ptr) - 1] = '\0';
- /* AMR octet aligned parameter (see also RFC 3267, section 8.3) */
- if (sscanf(param_str, "octet-align=%d", &amr_octet_aligned) == 1) {
+ /* We support the following codec parameters:
+ *
+ * AMR: octet-align parameter of RFC 4867 section 8.3;
+ * FR & EFR: tw-ts-001 parameter, Osmocom private;
+ * HR: tw-ts-002 parameter, Osmocom private.
+ *
+ * tw-ts-001 and tw-ts-002 Osmocom-private parameters are used
+ * only in the context of OsmoBSC driving an E1 MGW endpoint.
+ */
+ if (sscanf(param_str, "octet-align=%d", ¶m_val) == 1) {
fmtp_param->param.amr_octet_aligned_present = true;
fmtp_param->param.amr_octet_aligned = false;
- if (amr_octet_aligned == 1)
+ if (param_val == 1)
fmtp_param->param.amr_octet_aligned = true;
+ } else if (sscanf(param_str, "tw-ts-001=%d", ¶m_val) == 1) {
+ fmtp_param->param.fr_efr_twts001_present = true;
+ fmtp_param->param.fr_efr_twts001 = false;
+ if (param_val == 1)
+ fmtp_param->param.fr_efr_twts001 = true;
+ } else if (sscanf(param_str, "tw-ts-002=%d", ¶m_val) == 1) {
+ fmtp_param->param.hr_twts002_present = true;
+ fmtp_param->param.hr_twts002 = false;
+ if (param_val == 1)
+ fmtp_param->param.hr_twts002 = true;
}
param_str = strtok(NULL, " ");
@@ -559,7 +577,23 @@
goto buffer_too_small;
}
- if (codec->param_present) {
+ /* Include a=fmtp line in MGCP response only for AMR
+ * octet-align parameter, not for tw-ts-* parameters.
+ * Rationale:
+ *
+ * - tw-ts-* parameters exist meaningfully only for E1
+ * endpoints driven by OsmoBSC, not in any other
+ * context. libosmo-mgcp-client used by OsmoBSC
+ * completely ignores all fmtp lines, has no code
+ * to parse them at all.
+ *
+ * - The SDP we return is supposed to indicate what
+ * _we_ accept, conceptually independent from what
+ * the remote accepts. And we always accept TW-TS-001
+ * and TW-TS-002 RTP formats going to E1 DL, whether
+ * or not we send them in UL per client request.
+ */
+ if (codec->param_present && codec->param.amr_octet_aligned_present) {
fmtp_param.payload_type = payload_type;
fmtp_param.param = codec->param;
fmtp_params[0] = fmtp_param;
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39730?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: I0d58e6d84418f50670c8ab7cf8490af3bc2f5c26
Gerrit-Change-Number: 39730
Gerrit-PatchSet: 3
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
falconia has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/39751?usp=email )
Change subject: E1: implement dummy fill for HRv1 codec
......................................................................
E1: implement dummy fill for HRv1 codec
In the absence of a proper TFO transform (TS 28.062 section
C3.2.1.1), OsmoMGW-E1 inserts constant fill frames when there is
no RTP input, or when RTP input fails conversion to TRAU-DL and
thus does not enqueue anything to the I.460 mux.
This dummy fill was previously implemented for FR and EFR codecs,
but not for HRv1. Fix this omission.
With this change and with a fix to OsmoBSC to select 8k subslot
endpoints for TCH/H instead of 16k, OsmoMGW-E1 now supports HR
codec to the same degree to which it supports FR and EFR: far from
perfect, but mostly usable, especially if DTXu is disabled
and there is no TrFO interworking with a far end that does DTXu.
Change-Id: I188bc0a0468b19126281016f45e36f1de617e9ee
---
M src/libosmo-mgcp/mgcp_e1.c
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/src/libosmo-mgcp/mgcp_e1.c b/src/libosmo-mgcp/mgcp_e1.c
index 0e42e62..dc0acca 100644
--- a/src/libosmo-mgcp/mgcp_e1.c
+++ b/src/libosmo-mgcp/mgcp_e1.c
@@ -82,6 +82,11 @@
dummy_fill_pl = osmo_gsm660_homing_frame;
dummy_fill_pl_len = GSM_EFR_BYTES;
break;
+ case OSMO_TRAU16_FT_HR:
+ case OSMO_TRAU8_SPEECH:
+ dummy_fill_pl = osmo_gsm620_silence_frame;
+ dummy_fill_pl_len = GSM_HR_BYTES;
+ break;
default:
LOGPENDP(endp, DE1, LOGL_ERROR, "E1-I.460-IDLE-TX: unsupported frame type\n");
goto skip;
--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/39751?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: I188bc0a0468b19126281016f45e36f1de617e9ee
Gerrit-Change-Number: 39751
Gerrit-PatchSet: 6
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: falconia.
laforge has posted comments on this change by falconia. ( https://gerrit.osmocom.org/c/osmo-bsc/+/39752?usp=email )
Change subject: E1 BTS: direct MGW to 8k subslots for TCH/H
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Patchset:
PS1:
i'm also not aware of any 16k TCH/H using BTSs, at least not consciously. I just thought it would be simpler to support from our code than to deal with 8k TRAU... back at a point where
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/39752?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If6141a55434ce08f8fdd1c69b6fc9a97d6c726a7
Gerrit-Change-Number: 39752
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: falconia <falcon(a)freecalypso.org>
Gerrit-Comment-Date: Mon, 10 Mar 2025 19:15:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: lynxis lazus.
laforge has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/39563?usp=email )
Change subject: Add Gn support to allow MME->SGSN, SGSN->MME cell reselection
......................................................................
Patch Set 6:
(12 comments)
Patchset:
PS6:
overall my gut feeling is that there's way too much open-coded pointer arithmetic and manual buffer/length/index handling for my taste. If we cannot use msgb for some reason (it has stuff like msgb_may_pull, msgb_tailroom, ...), then maybe there's some other/better helpers we can develop for this use case?
File src/sgsn/gprs_gmm.c:
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/b83b3465_d5fbbdee?us… :
PS6, Line 1488: static int get_guti(struct msgb *msg, struct gprs_gmm_ra_upd_req *req, uint32_t ptmsi, struct osmo_guti *guti, uint16_t *nas_token)
I would usually assume that the first argument is the non-const output, followed by const arguments for input-only data. Here, I guess 'req' can be const. But then it seems nas_token is also an output argument.. so the function not only gets guti but also nas_token? And msg is not used at all?
I guess this needs some thought about naming, unused arguments and const input data.
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/c1721823_4e2bd641?us… :
PS6, Line 1628: LOGP(DGPRS, LOGL_ERROR, "Can't decode guti\n");
LOGIUP at least, so we get some context? Possibly even the entire input data so that we have a chane of figuring out why this happens if we ever see the error?
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/36d37e70_19e60e6c?us… :
PS6, Line 1635: LOGP(DGPRS, LOGL_ERROR, "No MME found for Gummei %s", osmo_gummei_name(&guti.gummei));
Existing code above uses LOGIUP, so for consstency also add that?
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/36d1fbf9_323ca7f7?us… :
PS6, Line 2625: /* FIXME: reject with impl. */
maybe at least log an error if this ever happens and we know we should be doing something?
File src/sgsn/gprs_rau_fsm.c:
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/e459dd21_61b24d7d?us… :
PS6, Line 211: /* FIXME */
this is the fourth fixme in less than 20 lines of code... are we sure this is ready yet?
File src/sgsn/sgsn_libgtp.c:
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/c381fd58_13bcd666?us… :
PS6, Line 923: // CKSN
let's stick to C style comments, laso below.
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/4009c195_63479ac3?us… :
PS6, Line 1002: MEMCPY_CHK(ptr, &mmctx->drx_parms, sizeof(mmctx->drx_parms));
all of this custom working with a pointer and bounds checking makes me wonder why the code is not using a msgb here? doesn't have to be the actual overall signaling message msgb, but just a local buffer?
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/31ff63cc_ff275571?us… :
PS6, Line 1051: //GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
looks like left-over / cleanup needed?
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/dc3030a8_5b7d50e7?us… :
PS6, Line 1119: // resp_it++;
likewise, leftover/cleanup/bug?
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/0e47ab01_41393e1f?us… :
PS6, Line 1151: static int validate_quintlets(uint8_t *buf, unsigned int buf_len)
are there really quintlets in 3GPP somewhere? I'm familiar with quintets or quintuplets so far.
https://gerrit.osmocom.org/c/osmo-sgsn/+/39563/comment/d7c70b80_64fb3cc6?us… :
PS6, Line 1328: quintlets
quintuplets?
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/39563?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Iffe83b31db2b6e6869fedf2351375184096cff6f
Gerrit-Change-Number: 39563
Gerrit-PatchSet: 6
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Comment-Date: Mon, 10 Mar 2025 19:12:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/39670?usp=email )
Change subject: filesystem: do not decode short TransRecEF records
......................................................................
filesystem: do not decode short TransRecEF records
A TransRecEF is based on a TransparentEF. This means that a TransRecEF
is basically normal TransparentEF that holds a record oriented data
structure. This also requires that the total length of the TransRecEF
is a multiple of the record length of the data structure that is stored
in it. When this is not the case, the last record will be cut short and
the decoding will fail. We should guard against this case.
Related: OS#6598
Change-Id: Ib1dc4d7ce306f1f0b080bb4b6abc36e72431d3fa
---
M pySim/filesystem.py
1 file changed, 12 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 246afb0..7f350ec 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -1224,6 +1224,13 @@
Returns:
abstract_data; dict representing the decoded data
"""
+
+ # The record data length should always be equal or at least greater than the record length defined for the
+ # TransRecEF. Short records may be occur when the length of the underlying TransparentEF is not a multiple
+ # of the TransRecEF record length.
+ if len(raw_hex_data) // 2 < self.__get_rec_len():
+ return {'raw': raw_hex_data}
+
method = getattr(self, '_decode_record_hex', None)
if callable(method):
return method(raw_hex_data)
@@ -1251,6 +1258,11 @@
Returns:
abstract_data; dict representing the decoded data
"""
+
+ # See comment in decode_record_hex (above)
+ if len(raw_bin_data) < self.__get_rec_len():
+ return {'raw': b2h(raw_bin_data)}
+
method = getattr(self, '_decode_record_bin', None)
if callable(method):
return method(raw_bin_data)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39670?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ib1dc4d7ce306f1f0b080bb4b6abc36e72431d3fa
Gerrit-Change-Number: 39670
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>