lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/39425?usp=email ) ( 3 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )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(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c index b9b13fd..c34c1a1 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 have 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: merged Gerrit-Project: osmo-sgsn Gerrit-Branch: master Gerrit-Change-Id: Ia8b428967a4ce3132a4a63ae10fe610de81c3a29 Gerrit-Change-Number: 39425 Gerrit-PatchSet: 4 Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> Gerrit-Reviewer: pespin <pespin@sysmocom.de>