From 88998385eb3b0fa68eff205a2be3068f0cad0dab Mon Sep 17 00:00:00 2001 From: Matan Perelman Date: Sun, 29 May 2022 14:09:25 +0300 Subject: [PATCH] NAS: Add configuration for LAC. --- srsepc/epc.conf.example | 2 ++ srsepc/hdr/mme/nas.h | 2 ++ srsepc/hdr/mme/s1ap_common.h | 1 + srsepc/src/main.cc | 7 +++++++ srsepc/src/mme/nas.cc | 5 +++-- srsepc/src/mme/s1ap_nas_transport.cc | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/srsepc/epc.conf.example b/srsepc/epc.conf.example index 73183a63f..e0aa15393 100644 --- a/srsepc/epc.conf.example +++ b/srsepc/epc.conf.example @@ -21,6 +21,7 @@ # (supported: EIA0 (rejected by most UEs), EIA1 (default), EIA2, EIA3 # paging_timer: Value of paging timer in seconds (T3413) # request_imeisv: Request UE's IMEI-SV in security mode command +# lac: 16-bit Location Area Code. # ##################################################################### [mme] @@ -36,6 +37,7 @@ encryption_algo = EEA0 integrity_algo = EIA1 paging_timer = 2 request_imeisv = false +lac = 0x0006 ##################################################################### # HSS configuration diff --git a/srsepc/hdr/mme/nas.h b/srsepc/hdr/mme/nas.h index bd29e889f..9c55460fb 100644 --- a/srsepc/hdr/mme/nas.h +++ b/srsepc/hdr/mme/nas.h @@ -133,6 +133,7 @@ typedef struct { srsran::CIPHERING_ALGORITHM_ID_ENUM cipher_algo; srsran::INTEGRITY_ALGORITHM_ID_ENUM integ_algo; bool request_imeisv; + uint16_t lac; } nas_init_t; typedef struct { @@ -271,6 +272,7 @@ private: std::string m_full_net_name; std::string m_short_net_name; bool m_request_imeisv = false; + uint16_t m_lac = 0; // Timers timeout values uint16_t m_t3413 = 0; diff --git a/srsepc/hdr/mme/s1ap_common.h b/srsepc/hdr/mme/s1ap_common.h index 3c38d6929..d4952730f 100644 --- a/srsepc/hdr/mme/s1ap_common.h +++ b/srsepc/hdr/mme/s1ap_common.h @@ -43,6 +43,7 @@ typedef struct { srsran::CIPHERING_ALGORITHM_ID_ENUM encryption_algo; srsran::INTEGRITY_ALGORITHM_ID_ENUM integrity_algo; bool request_imeisv; + uint16_t lac; } s1ap_args_t; typedef struct { diff --git a/srsepc/src/main.cc b/srsepc/src/main.cc index d0d5c76f2..43bfbfed3 100644 --- a/srsepc/src/main.cc +++ b/srsepc/src/main.cc @@ -88,6 +88,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) string hss_db_file; string hss_auth_algo; string log_filename; + string lac; // Command line only options bpo::options_description general("General options"); @@ -115,6 +116,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) ("mme.integrity_algo", bpo::value(&integrity_algo)->default_value("EIA1"), "Set preferred integrity protection algorithm for NAS") ("mme.paging_timer", bpo::value(&paging_timer)->default_value(2), "Set paging timer value in seconds (T3413)") ("mme.request_imeisv", bpo::value(&request_imeisv)->default_value(false), "Enable IMEISV request in Security mode command") + ("mme.lac", bpo::value(&lac)->default_value("0x01"), "Location Area Code") ("hss.db_file", bpo::value(&hss_db_file)->default_value("ue_db.csv"), ".csv file that stores UE's keys") ("spgw.gtpu_bind_addr", bpo::value(&spgw_bind_addr)->default_value("127.0.0.1"), "IP address of SP-GW for the S1-U connection") ("spgw.sgi_if_addr", bpo::value(&sgi_if_addr)->default_value("176.16.0.1"), "IP address of TUN interface for the SGi connection") @@ -218,6 +220,11 @@ void parse_args(all_args_t* args, int argc, char* argv[]) sstr << std::hex << vm["mme.tac"].as(); sstr >> args->mme_args.s1ap_args.tac; } + { + std::stringstream sstr; + sstr << std::hex << vm["mme.lac"].as(); + sstr >> args->mme_args.s1ap_args.lac; + } // Convert MCC/MNC strings if (!srsran::string_to_mcc(mcc, &args->mme_args.s1ap_args.mcc)) { diff --git a/srsepc/src/mme/nas.cc b/srsepc/src/mme/nas.cc index e7164422b..aa0f4d97d 100644 --- a/srsepc/src/mme/nas.cc +++ b/srsepc/src/mme/nas.cc @@ -37,7 +37,8 @@ nas::nas(const nas_init_t& args, const nas_if_t& itf) : m_full_net_name(args.full_net_name), m_short_net_name(args.short_net_name), m_t3413(args.paging_timer), - m_request_imeisv(args.request_imeisv) + m_request_imeisv(args.request_imeisv), + m_lac(args.lac) { m_sec_ctx.integ_algo = args.integ_algo; m_sec_ctx.cipher_algo = args.cipher_algo; @@ -1541,7 +1542,7 @@ bool nas::pack_attach_accept(srsran::byte_buffer_t* nas_buffer) attach_accept.lai_present = true; attach_accept.lai.mcc = mcc; attach_accept.lai.mnc = mnc; - attach_accept.lai.lac = 001; + attach_accept.lai.lac = m_lac; attach_accept.ms_id_present = true; attach_accept.ms_id.type_of_id = LIBLTE_MME_MOBILE_ID_TYPE_TMSI; diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 54888e833..4e7e70baa 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -72,6 +72,7 @@ void s1ap_nas_transport::init() m_nas_init.integ_algo = m_s1ap->m_s1ap_args.integrity_algo; m_nas_init.cipher_algo = m_s1ap->m_s1ap_args.encryption_algo; m_nas_init.request_imeisv = m_s1ap->m_s1ap_args.request_imeisv; + m_nas_init.lac = m_s1ap->m_s1ap_args.lac; // Init NAS interface m_nas_if.s1ap = s1ap::get_instance();