diff --git a/src/db.h b/src/db.h index 0f1d40d6..68d7a63c 100644 --- a/src/db.h +++ b/src/db.h @@ -69,7 +69,7 @@ int db_update_sqn(struct db_context *dbc, int64_t id, int db_get_auc(struct db_context *dbc, const char *imsi, unsigned int auc_3g_ind, struct osmo_auth_vector *vec, unsigned int num_vec, const uint8_t *rand_auts, - const uint8_t *auts); + const uint8_t *auts, bool separation_bit); #include #include diff --git a/src/db_auc.c b/src/db_auc.c index 2cf71438..6eaee9d6 100644 --- a/src/db_auc.c +++ b/src/db_auc.c @@ -189,7 +189,7 @@ out: int db_get_auc(struct db_context *dbc, const char *imsi, unsigned int auc_3g_ind, struct osmo_auth_vector *vec, unsigned int num_vec, const uint8_t *rand_auts, - const uint8_t *auts) + const uint8_t *auts, bool separation_bit) { struct osmo_sub_auth_data aud2g, aud3g; int64_t subscr_id; @@ -209,6 +209,12 @@ int db_get_auc(struct db_context *dbc, const char *imsi, aud3g.u.umts.ind_bitlen, aud3g.u.umts.ind); aud3g.u.umts.ind &= (1U << aud3g.u.umts.ind_bitlen) - 1; } + /* the first bit (bit0) cannot be used as AMF anymore, but has been + * re-appropriated as the separation bit. See 3GPP TS 33.102 Annex H + * together with 3GPP TS 33.401 / 33.402 / 33.501 */ + aud3g.u.umts.amf[0] = aud3g.u.umts.amf[0] & 0x7f; + if (separation_bit) + aud3g.u.umts.amf[0] |= 0x80; LOGAUC(imsi, LOGL_DEBUG, "Calling to generate %u vectors\n", num_vec); rc = auc_compute_vectors(vec, num_vec, &aud2g, &aud3g, rand_auts, auts); diff --git a/src/hlr.c b/src/hlr.c index 76b2f221..87f92e39 100644 --- a/src/hlr.c +++ b/src/hlr.c @@ -233,6 +233,7 @@ static int rx_send_auth_info(struct osmo_gsup_conn *conn, { struct osmo_gsup_message gsup_out; struct msgb *msg_out; + bool separation_bit = false; int rc; subscr_create_on_demand(gsup->imsi); @@ -241,10 +242,13 @@ static int rx_send_auth_info(struct osmo_gsup_conn *conn, memset(&gsup_out, 0, sizeof(gsup_out)); memcpy(&gsup_out.imsi, &gsup->imsi, sizeof(gsup_out.imsi)); + if (gsup->rat_types_len >= 1 && gsup->rat_types[0] == OSMO_RAT_EUTRAN_SGS) + separation_bit = true; + rc = db_get_auc(dbc, gsup->imsi, conn->auc_3g_ind, gsup_out.auth_vectors, ARRAY_SIZE(gsup_out.auth_vectors), - gsup->rand, gsup->auts); + gsup->rand, gsup->auts, separation_bit); if (rc <= 0) { gsup_out.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_ERROR; switch (rc) { diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c index 8c3ef2b7..f7089c4c 100644 --- a/src/hlr_vty_subscr.c +++ b/src/hlr_vty_subscr.c @@ -628,7 +628,7 @@ DEFUN(subscriber_rat, const char *id = argv[1]; const char *rat_str = argv[2]; const char *allowed_forbidden = argv[3]; - enum osmo_rat_type rat; + enum osmo_rat_type rat = OSMO_RAT_UNKNOWN; bool allowed; int rc; @@ -636,6 +636,8 @@ DEFUN(subscriber_rat, rat = OSMO_RAT_GERAN_A; else if (strcmp(rat_str, "utran-iu") == 0) rat = OSMO_RAT_UTRAN_IU; + else if (strcmp(rat_str, "eutran") == 0) + rat = OSMO_RAT_EUTRAN_SGS; allowed = (strcmp(allowed_forbidden, "allowed") == 0);