lynxis lazus has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-sgsn/+/39425?usp=email )
Change subject: GMM: implement IMEI SV on auth/ciph response
......................................................................
GMM: implement IMEI SV on auth/ciph response
The SGSN is requesting the IMEI SV on an auth/ciphering response.
Parse the answer of the MS/UE.
Change-Id: Ia8b428967a4ce3132a4a63ae10fe610de81c3a29
---
M src/sgsn/gprs_gmm.c
1 file changed, 23 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/25/39425/1
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index b9b13fd..1c457a2 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -637,6 +637,7 @@
{
struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_gmmh(msg);
struct gsm48_auth_ciph_resp *acr = (struct gsm48_auth_ciph_resp *)gh->data;
+ struct osmo_mobile_identity mi;
struct tlv_parsed tp;
struct gsm_auth_tuple *at;
const char *res_name = "(no response)";
@@ -673,6 +674,28 @@
return -EINVAL;
}
+ /* IMEI SV parsing */
+ if (TLVP_LEN(&tp, GSM48_IE_GMM_IMEISV) != 9) {
+ LOGMMCTXP(LOGL_ERROR, ctx, "-> GMM AUTH AND CIPH RESPONSE: Invalid
IMEISV\n");
+ return -EINVAL;
+ }
+
+ /* FIXME: should we allow invalid IMEI SV? Are there phones which has broken SV in hex?
*/
+ if (osmo_mobile_identity_decode(&mi,
+ TLVP_VAL(&tp, GSM48_IE_GMM_IMEISV),
+ TLVP_LEN(&tp, GSM48_IE_GMM_IMEISV),
+ false)) {
+ LOGMMCTXP(LOGL_ERROR, ctx, "-> GMM AUTH AND CIPH RESPONSE: Cannot decode
IMEISV\n");
+ return -EINVAL;
+ }
+
+ if (mi.type != GSM_MI_TYPE_IMEISV) {
+ LOGMMCTXP(LOGL_ERROR, ctx, "-> GMM AUTH AND CIPH RESPONSE: Invalid MI type
found in IMEISV %d\n", mi.type);
+ return -EINVAL;
+ }
+
+ memcpy(&ctx->imei, mi.imeisv, ARRAY_SIZE(ctx->imei));
+
/* Start with the good old 4-byte SRES */
memcpy(res, TLVP_VAL(&tp, GSM48_IE_GMM_AUTH_SRES), 4);
res_len = 4;
--
To view, visit
https://gerrit.osmocom.org/c/osmo-sgsn/+/39425?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: Ia8b428967a4ce3132a4a63ae10fe610de81c3a29
Gerrit-Change-Number: 39425
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>