From 0d61011d1396c4e8ee69d1d3ed76fff7eb5e8c47 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 18 Jun 2018 17:21:06 +0100 Subject: [PATCH] Changing user_db.csv to allow users to choose OP/OPc. --- srsepc/hdr/hss/hss.h | 12 +++++++----- srsepc/src/hss/hss.cc | 8 ++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/srsepc/hdr/hss/hss.h b/srsepc/hdr/hss/hss.h index 97e2d45c1..26bbe8aa6 100644 --- a/srsepc/hdr/hss/hss.h +++ b/srsepc/hdr/hss/hss.h @@ -54,11 +54,13 @@ typedef struct{ typedef struct{ std::string name; uint64_t imsi; - uint8_t key[16]; - uint8_t op[16]; - uint8_t amf[2]; - uint8_t sqn[6]; - uint8_t last_rand[16]; + uint8_t key[16]; + bool op_configured; + uint8_t op[16]; + uint8_t opc[16]; + uint8_t amf[2]; + uint8_t sqn[6]; + uint8_t last_rand[16]; }hss_ue_ctx_t; enum hss_auth_algo { diff --git a/srsepc/src/hss/hss.cc b/srsepc/src/hss/hss.cc index 4deeb41a2..6cd06cdc7 100644 --- a/srsepc/src/hss/hss.cc +++ b/srsepc/src/hss/hss.cc @@ -166,10 +166,12 @@ hss::read_db_file(std::string db_filename) get_uint_vec_from_hex_str(split[2],ue_ctx->key,16); if(split[3] == std::string("op")) { + ue_ctx->op_configured = true; get_uint_vec_from_hex_str(split[4],ue_ctx->op,16); } else if (split[3] == std::string("opc")) { + ue_ctx->op_configured =false; get_uint_vec_from_hex_str(split[4],ue_ctx->op,16); } else @@ -239,6 +241,12 @@ bool hss::write_db_file(std::string db_filename) m_db_file << ","; m_db_file << hex_string(it->second->key, 16); m_db_file << ","; + if(it->second->op_configured){ + m_db_file << "op,"; + } + else{ + m_db_file << "opc,"; + } m_db_file << hex_string(it->second->op, 16); m_db_file << ","; m_db_file << hex_string(it->second->amf, 2);