summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-08-21 20:01:31 +0200
committerHarald Welte <laforge@gnumonks.org>2019-08-22 12:13:44 +0200
commita5e9ca904561b3655af677d3e5d79e20b8105cba (patch)
treebd6371d0f743de72d386b102cca98322c73d6bfa
parent94c38a9e03e29c196cc5a9461678bb8bffb4baf9 (diff)
AUC: Add support for setting the AMF separation bit to '1' for EUTRANlaforge/cccamp2019
-rw-r--r--src/db.h2
-rw-r--r--src/db_auc.c8
-rw-r--r--src/hlr.c6
-rw-r--r--src/hlr_vty_subscr.c4
4 files changed, 16 insertions, 4 deletions
diff --git a/src/db.h b/src/db.h
index 0f1d40d..68d7a63 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 <osmocom/core/linuxlist.h>
#include <osmocom/gsm/protocol/gsm_23_003.h>
diff --git a/src/db_auc.c b/src/db_auc.c
index 2cf7143..6eaee9d 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 76b2f22..87f92e3 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 8c3ef2b..f7089c4 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);