From 59e847ba0814618a4bb985e54d388fbbe356f636 Mon Sep 17 00:00:00 2001 From: David Rupprecht Date: Fri, 17 Sep 2021 15:23:49 +0200 Subject: [PATCH] Added NAS 5G args --- srsue/hdr/stack/upper/nas_5g.h | 12 ++++++++---- srsue/hdr/stack/upper/nas_config.h | 17 +++++++++++++++++ srsue/src/stack/upper/nas_5g.cc | 2 +- srsue/src/stack/upper/test/nas_5g_test.cc | 19 +++++++++++++------ 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/srsue/hdr/stack/upper/nas_5g.h b/srsue/hdr/stack/upper/nas_5g.h index 3278ddad8..138ade151 100644 --- a/srsue/hdr/stack/upper/nas_5g.h +++ b/srsue/hdr/stack/upper/nas_5g.h @@ -49,7 +49,10 @@ class nas_5g : public nas_base, public nas_5g_interface_rrc_nr, public nas_5g_in public: explicit nas_5g(srslog::basic_logger& logger_, srsran::task_sched_handle task_sched_); virtual ~nas_5g(); - int init(usim_interface_nas* usim_, rrc_nr_interface_nas_5g* rrc_nr_, gw_interface_nas* gw_, const nas_args_t& cfg_); + int init(usim_interface_nas* usim_, + rrc_nr_interface_nas_5g* rrc_nr_, + gw_interface_nas* gw_, + const nas_5g_args_t& cfg_); void stop(); void run_tti(); @@ -80,8 +83,8 @@ private: srsran::nas_5g::nas_5gs_msg initial_registration_request_stored; - nas_args_t cfg = {}; - mm5g_state_t state; + nas_5g_args_t cfg = {}; + mm5g_state_t state; // Security bool ia5g_caps[8] = {}; @@ -125,7 +128,8 @@ private: int send_registration_request(); int send_authentication_response(const uint8_t res[16]); int send_security_mode_reject(const srsran::nas_5g::cause_5gmm_t::cause_5gmm_type_::options cause); - int send_authentication_failure(const srsran::nas_5g::cause_5gmm_t::cause_5gmm_type_::options cause, const uint8_t res_star[16]); + int send_authentication_failure(const srsran::nas_5g::cause_5gmm_t::cause_5gmm_type_::options cause, + const uint8_t res_star[16]); int send_security_mode_complete(const srsran::nas_5g::security_mode_command_t& security_mode_command); int send_registration_complete(); int send_pdu_session_establishment_request(uint32_t transaction_identity, diff --git a/srsue/hdr/stack/upper/nas_config.h b/srsue/hdr/stack/upper/nas_config.h index c0444725b..4d6216956 100644 --- a/srsue/hdr/stack/upper/nas_config.h +++ b/srsue/hdr/stack/upper/nas_config.h @@ -43,5 +43,22 @@ public: std::vector pdu_session_cfgs; }; +class nas_5g_args_t +{ +public: + nas_5g_args_t() : force_imsi_attach(false) {} + ~nas_5g_args_t() = default; + bool force_imsi_attach; + + // Need EPS sec capabilities in 5G + std::string eia; + std::string eea; + + // 5G Security capabilities + std::string ia5g; + std::string ea5g; + std::vector pdu_session_cfgs; +}; + } // namespace srsue #endif // SRSUE_NAS_COMMON_H diff --git a/srsue/src/stack/upper/nas_5g.cc b/srsue/src/stack/upper/nas_5g.cc index 29a59266e..8d594c783 100644 --- a/srsue/src/stack/upper/nas_5g.cc +++ b/srsue/src/stack/upper/nas_5g.cc @@ -69,7 +69,7 @@ void nas_5g::stop() int nas_5g::init(usim_interface_nas* usim_, rrc_nr_interface_nas_5g* rrc_nr_, gw_interface_nas* gw_, - const nas_args_t& cfg_) + const nas_5g_args_t& cfg_) { usim = usim_; rrc_nr = rrc_nr_; diff --git a/srsue/src/stack/upper/test/nas_5g_test.cc b/srsue/src/stack/upper/test/nas_5g_test.cc index 5a48ead48..d7e6f01f7 100644 --- a/srsue/src/stack/upper/test/nas_5g_test.cc +++ b/srsue/src/stack/upper/test/nas_5g_test.cc @@ -42,11 +42,18 @@ int amf_attach_request_test(srsran::nas_pcap* pcap) args.op = "63BFA50EE6523365FF14C1F45F88737D"; usim.init(&args); - nas_args_t nas_cfg; - nas_cfg.force_imsi_attach = true; - nas_cfg.apn_name = "test123"; - nas_cfg.ia5g = "0,1,2,3"; - nas_cfg.ea5g = "0,1,2,3"; + nas_5g_args_t nas_5g_cfg; + nas_5g_cfg.force_imsi_attach = true; + pdu_session_cfg_t pdu_session; + pdu_session.apn_name = "test123"; + + nas_5g_cfg.pdu_session_cfgs.push_back(pdu_session); + + nas_5g_cfg.eia = "0,1,2,3"; + nas_5g_cfg.eea = "0,1,2,3"; + + nas_5g_cfg.ia5g = "0,1,2,3"; + nas_5g_cfg.ea5g = "0,1,2,3"; test_stack_dummy stack(&pdcp_dummy); srsue::nas_5g nas_5g(srslog::fetch_basic_logger("NAS-5G"), &stack.task_sched); @@ -64,7 +71,7 @@ int amf_attach_request_test(srsran::nas_pcap* pcap) gw.init(gw_args, &stack); stack.init(&nas_5g); - nas_5g.init(&usim, &rrc_nr_dummy, &gw, nas_cfg); + nas_5g.init(&usim, &rrc_nr_dummy, &gw, nas_5g_cfg); rrc_nr_dummy.init(&nas_5g); // trigger test