From 0884d353780db1b8a8d42b5646f3a0ef81a2a76b Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Sat, 16 Dec 2017 15:32:40 +0000 Subject: [PATCH] added replayed GRPS security capabilities. Moto G4 sends security mode complete. --- srsepc/epc.conf.example | 4 ++-- srsepc/hdr/mme/s1ap_common.h | 2 ++ srsepc/src/mme/s1ap.cc | 10 ++++++---- srsepc/src/mme/s1ap_nas_transport.cc | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/srsepc/epc.conf.example b/srsepc/epc.conf.example index 34df1eb74..fe8a48735 100644 --- a/srsepc/epc.conf.example +++ b/srsepc/epc.conf.example @@ -19,7 +19,7 @@ mme_group = 0x0001 tac = 0x0001 mcc = 001 mnc = 01 -mme_bind_addr = 127.0.0.0/24 +mme_bind_addr = 127.0.1.100 ##################################################################### # HSS configuration @@ -40,5 +40,5 @@ db_file = user_db.csv ##################################################################### [spgw] -gtpu_bind_addr=127.0.0.2 +gtpu_bind_addr=127.0.1.100 sgi_if_addr=172.0.0.1 diff --git a/srsepc/hdr/mme/s1ap_common.h b/srsepc/hdr/mme/s1ap_common.h index d09eb0566..8fefbcf60 100644 --- a/srsepc/hdr/mme/s1ap_common.h +++ b/srsepc/hdr/mme/s1ap_common.h @@ -92,6 +92,8 @@ typedef struct{ eps_security_ctx_t security_ctxt; erab_ctx_t erabs_ctx[MAX_ERABS_PER_UE]; LIBLTE_MME_UE_NETWORK_CAPABILITY_STRUCT ue_network_cap; + bool ms_network_cap_present; + LIBLTE_MME_MS_NETWORK_CAPABILITY_STRUCT ms_network_cap; } ue_ctx_t; }//namespace #endif diff --git a/srsepc/src/mme/s1ap.cc b/srsepc/src/mme/s1ap.cc index 462dc336e..1ba077134 100644 --- a/srsepc/src/mme/s1ap.cc +++ b/srsepc/src/mme/s1ap.cc @@ -369,16 +369,18 @@ s1ap::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *ini m_s1ap_log->console("Attach request from IMSI: %015lu\n", imsi); m_s1ap_log->info("Attach request from IMSI: %015lu\n", imsi); - //Get UE security capabilities + //Get UE network capabilities memcpy(&ue_ctx.ue_network_cap, &attach_req.ue_network_cap, sizeof(LIBLTE_MME_UE_NETWORK_CAPABILITY_STRUCT)); - + ue_ctx.ms_network_cap_present = attach_req.ms_network_cap_present; + if(attach_req.ms_network_cap_present) + { + memcpy(&ue_ctx.ms_network_cap, &attach_req.ms_network_cap, sizeof(LIBLTE_MME_MS_NETWORK_CAPABILITY_STRUCT)); + } //FIXME use this info uint8_t eps_bearer_id = pdn_con_req.eps_bearer_id; //TODO: Unused uint8_t proc_transaction_id = pdn_con_req.proc_transaction_id; //TODO: Transaction ID unused m_s1ap_log->console("EPS Bearer id: %d\n", eps_bearer_id); - - //Add eNB info to UE ctxt memcpy(&ue_ctx.enb_sri, enb_sri, sizeof(struct sctp_sndrcvinfo)); diff --git a/srsepc/src/mme/s1ap_nas_transport.cc b/srsepc/src/mme/s1ap_nas_transport.cc index 513109083..6b7db1b72 100644 --- a/srsepc/src/mme/s1ap_nas_transport.cc +++ b/srsepc/src/mme/s1ap_nas_transport.cc @@ -266,7 +266,7 @@ s1ap_nas_transport::pack_security_mode_command(srslte::byte_buffer_t *reply_msg, sm_cmd.selected_nas_sec_algs.type_of_eia = LIBLTE_MME_TYPE_OF_INTEGRITY_ALGORITHM_128_EIA1; sm_cmd.nas_ksi.tsc_flag=LIBLTE_MME_TYPE_OF_SECURITY_CONTEXT_FLAG_NATIVE; - sm_cmd.nas_ksi.nas_ksi=6; //111 no key available + sm_cmd.nas_ksi.nas_ksi=0; //Replay UE security cap memcpy(sm_cmd.ue_security_cap.eea,ue_ctx->ue_network_cap.eea,8*sizeof(bool)); @@ -275,8 +275,8 @@ s1ap_nas_transport::pack_security_mode_command(srslte::byte_buffer_t *reply_msg, memcpy(sm_cmd.ue_security_cap.uea,ue_ctx->ue_network_cap.uea,8*sizeof(bool)); sm_cmd.ue_security_cap.uia_present = ue_ctx->ue_network_cap.uia_present; memcpy(sm_cmd.ue_security_cap.uia,ue_ctx->ue_network_cap.uia,8*sizeof(bool)); - sm_cmd.ue_security_cap.gea_present = false; - //memcpy(sm_cmd.ue_security_cap.gea,ue_ctx->ue_network_cap.gea,8*sizeof(bool)); + sm_cmd.ue_security_cap.gea_present = ue_ctx->ms_network_cap_present; + memcpy(sm_cmd.ue_security_cap.gea,ue_ctx->ms_network_cap.gea,8*sizeof(bool)); /* typedef struct{ bool eea[8];