laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/34419?usp=email )
Change subject: APDU parsing support for GlobalPlatform GET RESPONSE
......................................................................
APDU parsing support for GlobalPlatform GET RESPONSE
This patch adds GET RESPONSE support for GlobalPlatform command. Android is using
this to get the response data on SGP.22 eUICCs.
simtrace2-cardem-pcsc is failing otherwise e.g. on an xingtera camera with Android.
Change-Id: I5ae3165f172f9c949550ee4a07fe70e91f1a037c
---
M src/sim/class_tables.c
1 file changed, 14 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/sim/class_tables.c b/src/sim/class_tables.c
index 9c51387..724c077 100644
--- a/src/sim/class_tables.c
+++ b/src/sim/class_tables.c
@@ -222,6 +222,7 @@
[0xE8] = 4, /* LOAD */
[0xD8] = 4, /* PUT KEY */
[0xF0] = 3, /* SET STATUS */
+ [0xC0] = 2, /* GET RESPONSE */
};
static const struct osim_cla_ins_case uicc_ins_case[] = {
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/34419?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5ae3165f172f9c949550ee4a07fe70e91f1a037c
Gerrit-Change-Number: 34419
Gerrit-PatchSet: 2
Gerrit-Owner: k_o_ <wider.stand(a)gmx.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/34122?usp=email )
Change subject: sgsn_rim: forward message based on RIM ROUTING ADDRESS
......................................................................
sgsn_rim: forward message based on RIM ROUTING ADDRESS
At the moment we parse the RAN TRANSPARENT CONTAINER to look at the
destination RIM ROUTING INFORMATION. This is not correct. The SGSN
should not decode the RAN TRANSPARENT CONTAINER and use the RIM ROUTING
ADDRESS / RIM ROUTING ADDRESS DISCRIMINATOR IE to make the routing
decision.
Related: OS#6095
Depends: libosmocore.git Ibca1f08906c4ffeecdae80d4e91c6c7b05fe4f8a
Change-Id: Ifd2b915ed2f05130cff8ee77714b82005c17de3d
---
M include/osmocom/sgsn/sgsn_rim.h
M src/sgsn/sgsn_libgtp.c
M src/sgsn/sgsn_rim.c
3 files changed, 83 insertions(+), 14 deletions(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/sgsn/sgsn_rim.h b/include/osmocom/sgsn/sgsn_rim.h
index f43b09a..fc87b46 100644
--- a/include/osmocom/sgsn/sgsn_rim.h
+++ b/include/osmocom/sgsn/sgsn_rim.h
@@ -3,4 +3,4 @@
struct sgsn_mme_ctx;
int sgsn_rim_rx_from_gb(struct osmo_bssgp_prim *bp, struct msgb *msg);
-int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu);
+int sgsn_rim_rx_from_gtp(struct msgb *msg, struct bssgp_rim_routing_info *rim_routing_address);
diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c
index 156f730..0b6da62 100644
--- a/src/sgsn/sgsn_libgtp.c
+++ b/src/sgsn/sgsn_libgtp.c
@@ -695,9 +695,46 @@
LOGMME(mme, DGTP, LOGL_INFO, "Rx GTP RAN Information Relay\n");
+ int rc;
unsigned int len = 0;
- struct msgb *msg = msgb_alloc(4096, "gtpcv1_ran_info");
- struct bssgp_ran_information_pdu pdu;
+ struct msgb *msg = bssgp_msgb_alloc();
+
+ uint8_t rim_ra_encoded[256];
+ unsigned int rim_ra_encoded_len = 0;
+ struct bssgp_rim_routing_info rim_ra;
+
+ unsigned int rim_ra_discr_encoded_len = 0;
+ uint8_t rim_ra_discr;
+
+ /* Read RIM Routing Address Discriminator (optional) */
+ rc = gtpie_gettlv(ie, GTPIE_RIM_RA_DISCR, 0, &rim_ra_discr_encoded_len, &rim_ra_discr,
+ sizeof(rim_ra_discr));
+ if (rc || rim_ra_discr_encoded_len <= 0) {
+ LOGMME(mme, DGTP, LOGL_NOTICE, "Rx GTP RAN Information Relay: No RIM Routing Address Discriminator IE found!\n");
+
+ /* It is not an error when the RIM ROUTING ADDRESS DISCRIMINATOR IE is missing. The RIM ROUTING ADDRESS
+ * DISCRIMINATOR IE is an optional IE. When it is missing, the RIM Routing Address shall be processed
+ * as an RNC address ("0001") See also: 3GPP TS 29.060 */
+ rim_ra_discr = BSSGP_RIM_ROUTING_INFO_UTRAN;
+ }
+
+ /* Read RIM Routing Address (optional) */
+ rc = gtpie_gettlv(ie, GTPIE_RIM_ROUT_ADDR, 0, &rim_ra_encoded_len, rim_ra_encoded, sizeof(rim_ra_encoded));
+ if (rc || rim_ra_encoded_len <= 0) {
+ LOGMME(mme, DGTP, LOGL_ERROR, "Rx GTP RAN Information Relay: No RIM Routing Address IE found!\n");
+
+ /* TODO: The (usually included) RIM ROUTING ADDRESS field is an optional field. However, we cannot
+ * proceed without a destination address. A possible way to fix this would be a default route that
+ * can be configured via the VTY. */
+ goto ret_error;
+ } else {
+ rc = bssgp_parse_rim_ra(&rim_ra, rim_ra_encoded, rim_ra_encoded_len, rim_ra_discr);
+ if (rc < 0) {
+ LOGMME(mme, DGTP, LOGL_ERROR,
+ "Rx GTP RAN Information Relay: Failed parsing RIM Routing Address/RIM Routing Address Discriminator IE!\n");
+ goto ret_error;
+ }
+ }
if (gtpie_gettlv(ie, GTPIE_RAN_T_CONTAIN, 0, &len, msgb_data(msg), 4096) || len <= 0) {
LOGMME(mme, DGTP, LOGL_ERROR, "Rx GTP RAN Information Relay: No Transparent Container IE found!\n");
@@ -706,13 +743,8 @@
msgb_put(msg, len);
msgb_bssgph(msg) = msg->data;
msgb_nsei(msg) = 0;
- if (bssgp_parse_rim_pdu(&pdu, msg) < 0) {
- LOGMME(mme, DGTP, LOGL_ERROR, "Rx GTP RAN Information Relay: Failed parsing Transparent Container IE!\n");
- goto ret_error;
- }
- msgb_free(msg);
- return sgsn_rim_rx_from_gtp(&pdu);
+ return sgsn_rim_rx_from_gtp(msg, &rim_ra);
ret_error:
msgb_free(msg);
diff --git a/src/sgsn/sgsn_rim.c b/src/sgsn/sgsn_rim.c
index c6f8dcd..40e1f90 100644
--- a/src/sgsn/sgsn_rim.c
+++ b/src/sgsn/sgsn_rim.c
@@ -33,6 +33,23 @@
return bssgp_tx_rim(pdu, bvc_ctx->nsei);
}
+static int sgsn_bssgp_fwd_rim_to_geran_encoded(struct msgb *msg, struct bssgp_rim_routing_info *rim_routing_address)
+{
+ struct bssgp_bvc_ctx *bvc_ctx;
+ OSMO_ASSERT(rim_routing_address->discr == BSSGP_RIM_ROUTING_INFO_GERAN);
+
+ /* Resolve RIM ROUTING ADDRESS to a BVC context */
+ bvc_ctx = btsctx_by_raid_cid(&rim_routing_address->geran.raid, rim_routing_address->geran.cid);
+ if (!bvc_ctx) {
+ LOGP(DRIM, LOGL_ERROR, "Unable to find NSEI for destination cell %s\n",
+ bssgp_rim_ri_name(rim_routing_address));
+ return -EINVAL;
+ }
+
+ /* Forward PDU to the NSEI of the resolved BVC context */
+ return bssgp_tx_rim_encoded(msg, bvc_ctx->nsei);
+}
+
static int sgsn_bssgp_fwd_rim_to_eutran(const struct bssgp_ran_information_pdu *pdu)
{
struct sgsn_mme_ctx *mme;
@@ -91,17 +108,20 @@
}
/* Receive a RIM PDU from GTPv1C (EUTRAN) */
-int sgsn_rim_rx_from_gtp(struct bssgp_ran_information_pdu *pdu)
+int sgsn_rim_rx_from_gtp(struct msgb *msg, struct bssgp_rim_routing_info *rim_routing_address)
{
- if (pdu->routing_info_dest.discr != BSSGP_RIM_ROUTING_INFO_GERAN) {
+ /* TODO: In this code path, we currently only support RIM message forwarding to GERAN (BSSGP). However, it
+ * technically also be possible to route a message back to GTP (BSSGP_RIM_ROUTING_INFO_EUTRAN) or to
+ * IuPS (BSSGP_RIM_ROUTING_INFO_UTRAN) */
+ if (rim_routing_address->discr != BSSGP_RIM_ROUTING_INFO_GERAN) {
LOGP(DRIM, LOGL_ERROR, "Rx GTP RAN Information Relay: Expected dst %s, got %s\n",
bssgp_rim_routing_info_discr_str(BSSGP_RIM_ROUTING_INFO_GERAN),
- bssgp_rim_routing_info_discr_str(pdu->routing_info_dest.discr));
+ bssgp_rim_routing_info_discr_str(rim_routing_address->discr));
return -EINVAL;
}
LOGP(DRIM, LOGL_INFO, "Rx GTP RAN Information Relay for dest cell %s\n",
- bssgp_rim_ri_name(&pdu->routing_info_dest));
+ bssgp_rim_ri_name(rim_routing_address));
- return sgsn_bssgp_fwd_rim_to_geran(pdu);
+ return sgsn_bssgp_fwd_rim_to_geran_encoded(msg, rim_routing_address);
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/34122?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ifd2b915ed2f05130cff8ee77714b82005c17de3d
Gerrit-Change-Number: 34122
Gerrit-PatchSet: 5
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34506?usp=email )
Change subject: PCU_Tests: fix BSSGP in TC_ta_idle_dl_tbf_ass
......................................................................
PCU_Tests: fix BSSGP in TC_ta_idle_dl_tbf_ass
When we send BSSGP DL UD, we should include an IMSI, since we are
expecting the paging request to appear on the PCH
Related: OS#5927
Change-Id: If62c2c7db9717cd08116374ee6ca939211bdf01e
---
M pcu/PCU_Tests.ttcn
1 file changed, 14 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index a6d3559..ba27e58 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -592,7 +592,7 @@
/* SGSN sends some DL data, PCU will initiate Packet Downlink
* Assignment on CCCH (PCH). We don't care about the payload. */
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(10)));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(10), imsi := ts_BSSGP_IMSI(ms.imsi)));
f_ms_exp_dl_tbf_ass_ccch(ms);
/* Make sure that Timing Advance is 0 (the actual value is not known yet).
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34506?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: If62c2c7db9717cd08116374ee6ca939211bdf01e
Gerrit-Change-Number: 34506
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34507?usp=email )
Change subject: PCU_Tests: make sure ts_BSSGP_DL_UD includes IMSI
......................................................................
PCU_Tests: make sure ts_BSSGP_DL_UD includes IMSI
Whenever we send a ts_BSSGP_DL_UD via BSSGP and we expect the downlink
assignment on the paging channel by calling
f_ms_exp_dl_tbf_ass_ccch(ms), then we should make sure that
ts_BSSGP_IMSI actually contains an IMSI (paging group)
Related: OS#5927
Change-Id: I356d93edd03c7e7564bde88d34effcf1b1967621
---
M pcu/PCU_Tests.ttcn
1 file changed, 22 insertions(+), 7 deletions(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index ba27e58..012a0be 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -479,7 +479,7 @@
/* New data arrives, PCU should page the MS since no TBF active exists: */
/* Send some more data, it will never reach the MS */
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi)));
f_ms_exp_dl_tbf_ass_ccch(ms);
f_shutdown(__BFILE__, __LINE__, final := true);
@@ -1785,7 +1785,7 @@
f_sleep(int2float(info_ind.t3191));
/* The TBF should be freed now, so new data should trigger an Assignment: */
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2, imsi := ts_BSSGP_IMSI(ms.imsi)));
f_ms_exp_dl_tbf_ass_ccch(ms);
/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
@@ -1860,7 +1860,7 @@
f_sleep(int2float(info_ind.t3191));
/* The TBF should be freed now, so new data should trigger an Assignment: */
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2, imsi := ts_BSSGP_IMSI(ms.imsi)));
f_ms_exp_dl_tbf_ass_ccch(ms);
/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
@@ -3128,10 +3128,10 @@
for (var integer i := 0; i < 10; i := i + 1) {
BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi_other, imsi := ts_BSSGP_IMSI(ms.imsi)));
}
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi2));
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi7));
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi8));
- BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi1));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi2, imsi := ts_BSSGP_IMSI(ms.imsi)));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi7, imsi := ts_BSSGP_IMSI(ms.imsi)));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi8, imsi := ts_BSSGP_IMSI(ms.imsi)));
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi1, imsi := ts_BSSGP_IMSI(ms.imsi)));
f_ms_exp_dl_tbf_ass_ccch(ms);
/* Wait timer X2002 and DL block is available after CCCH IMM ASS */
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34507?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: I356d93edd03c7e7564bde88d34effcf1b1967621
Gerrit-Change-Number: 34507
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged