From 020d0dacc80123a92dc2ccee7f7dcd3c377137bc Mon Sep 17 00:00:00 2001 From: David Rupprecht Date: Tue, 24 Nov 2020 11:18:43 +0100 Subject: [PATCH] add the additional sec cap to NAS attach request use same capabilities that are signaled for EUTRA --- lib/include/srslte/asn1/liblte_mme.h | 2 ++ lib/src/asn1/liblte_mme.cc | 37 ++++++++++++++++++++++++++++ srsue/src/stack/upper/nas.cc | 6 +++++ 3 files changed, 45 insertions(+) diff --git a/lib/include/srslte/asn1/liblte_mme.h b/lib/include/srslte/asn1/liblte_mme.h index 99c501feb..9bab6d57f 100644 --- a/lib/include/srslte/asn1/liblte_mme.h +++ b/lib/include/srslte/asn1/liblte_mme.h @@ -2538,6 +2538,7 @@ LIBLTE_ERROR_ENUM liblte_mme_unpack_attach_reject_msg(LIBLTE_BYTE_MSG_STRUCT* #define LIBLTE_MME_VOICE_DOMAIN_PREF_AND_UE_USAGE_SETTING_IEI 0x5D #define LIBLTE_MME_ATTACH_REQUEST_DEVICE_PROPERTIES_IEI 0xD #define LIBLTE_MME_GUTI_TYPE_IEI 0xE +#define LIBLTE_MME_ADDITIONAL_SECURITY_CAP_IEI 0x6F // Enums // Structs typedef struct { @@ -2574,6 +2575,7 @@ typedef struct { bool voice_domain_pref_and_ue_usage_setting_present; bool device_properties_present; bool old_guti_type_present; + bool additional_security_cap_present; } LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT; // Functions LIBLTE_ERROR_ENUM liblte_mme_pack_attach_request_msg(LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT* attach_req, diff --git a/lib/src/asn1/liblte_mme.cc b/lib/src/asn1/liblte_mme.cc index 6cde713ce..9d4ab4c8a 100644 --- a/lib/src/asn1/liblte_mme.cc +++ b/lib/src/asn1/liblte_mme.cc @@ -5062,6 +5062,43 @@ LIBLTE_ERROR_ENUM liblte_mme_pack_attach_request_msg(LIBLTE_MME_ATTACH_REQUEST_M msg_ptr++; } + if (attach_req->additional_security_cap_present) { + *msg_ptr = LIBLTE_MME_ADDITIONAL_SECURITY_CAP_IEI; + msg_ptr++; + *msg_ptr = 0x4; // Length + msg_ptr++; + + // Pack same capabilities that are used for EUTRA + *msg_ptr = attach_req->ue_network_cap.eea[0] << 7; + *msg_ptr |= attach_req->ue_network_cap.eea[1] << 6; + *msg_ptr |= attach_req->ue_network_cap.eea[2] << 5; + *msg_ptr |= attach_req->ue_network_cap.eea[3] << 4; + *msg_ptr |= attach_req->ue_network_cap.eea[4] << 3; + *msg_ptr |= attach_req->ue_network_cap.eea[5] << 2; + *msg_ptr |= attach_req->ue_network_cap.eea[6] << 1; + *msg_ptr |= attach_req->ue_network_cap.eea[7]; + msg_ptr++; + + // 0x00 (5G-EA8=0, 5G-EA9=0, 5G-EA10=0, 5G-EA11=0, 5G-EA12=0, 5G-EA13=0, 5G-EA14=0, 5G-EA15=0) + *msg_ptr = 0x00; + msg_ptr++; + + // Pack same integrity caps + *msg_ptr = attach_req->ue_network_cap.eia[0] << 7; + *msg_ptr |= attach_req->ue_network_cap.eia[1] << 6; + *msg_ptr |= attach_req->ue_network_cap.eia[2] << 5; + *msg_ptr |= attach_req->ue_network_cap.eia[3] << 4; + *msg_ptr |= attach_req->ue_network_cap.eia[4] << 3; + *msg_ptr |= attach_req->ue_network_cap.eia[5] << 2; + *msg_ptr |= attach_req->ue_network_cap.eia[6] << 1; + *msg_ptr |= attach_req->ue_network_cap.eia[7]; + msg_ptr++; + + // 0x00 (5G-IA8=0, 5G-IA9=0, 5G-IA10=0, 5G-IA11=0, 5G-IA12=0, 5G-IA13=0, 5G-IA14=0, 5G-IA15=0) + *msg_ptr = 0x00; + msg_ptr++; + } + // Fill in the number of bytes used msg->N_bytes = msg_ptr - msg->msg; diff --git a/srsue/src/stack/upper/nas.cc b/srsue/src/stack/upper/nas.cc index 3a1de6b23..cda502293 100644 --- a/srsue/src/stack/upper/nas.cc +++ b/srsue/src/stack/upper/nas.cc @@ -1702,6 +1702,12 @@ void nas::gen_attach_request(srslte::unique_byte_buffer_t& msg) attach_req.device_properties_present = false; attach_req.old_guti_type_present = false; + if (rrc->has_nr_dc()) { + attach_req.ue_network_cap.dc_nr_present = true; + attach_req.ue_network_cap.dc_nr = true; + attach_req.additional_security_cap_present = true; + } + // ESM message (PDN connectivity request) for first default bearer gen_pdn_connectivity_request(&attach_req.esm_msg);