mirror of https://github.com/PentHertz/srsLTE.git
Added the Authentication reject nas message.
This commit is contained in:
parent
150a747181
commit
f908439ed4
|
@ -41,6 +41,8 @@ public:
|
|||
void set_log(srslte::log *s1ap_logger);
|
||||
bool unpack_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *init_ue, LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT *attach_req, LIBLTE_MME_PDN_CONNECTIVITY_REQUEST_MSG_STRUCT *pdn_con_req);
|
||||
bool pack_authentication_request(srslte::byte_buffer_t *reply_msg, uint32_t enb_ue_s1ap_id, uint32_t next_mme_ue_s1ap_id, uint8_t *autn,uint8_t *rand);
|
||||
bool pack_authentication_reject(srslte::byte_buffer_t *reply_msg, uint32_t enb_ue_s1ap_id, uint32_t mme_ue_s1ap_id);
|
||||
|
||||
bool unpack_authentication_response(LIBLTE_S1AP_MESSAGE_UPLINKNASTRANSPORT_STRUCT *ul_xport, LIBLTE_MME_AUTHENTICATION_RESPONSE_MSG_STRUCT *auth_resp);
|
||||
bool pack_security_mode_command(srslte::byte_buffer_t *reply_msg, ue_ctx_t *ue_ctx);
|
||||
|
||||
|
|
|
@ -320,7 +320,8 @@ s1ap::handle_initial_ue_message(LIBLTE_S1AP_MESSAGE_INITIALUEMESSAGE_STRUCT *ini
|
|||
/*Get NAS Attach Request and PDN connectivity request messages*/
|
||||
if(!m_s1ap_nas_transport.unpack_initial_ue_message(init_ue, &attach_req,&pdn_con_req))
|
||||
{
|
||||
//TODO set up error reply
|
||||
//Could not decode the attach request and the PDN connectivity request.
|
||||
m_s1ap_log->error("Could not unpack NAS Attach Request and PDN connectivity request.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -472,6 +473,7 @@ s1ap::handle_nas_authentication_response(srslte::byte_buffer_t *nas_msg, srslte:
|
|||
m_s1ap_log->console("UE Authentication Rejected. IMSI: %lu\n", ue_ctx->imsi);
|
||||
m_s1ap_log->warning("UE Authentication Rejected. IMSI: %lu\n", ue_ctx->imsi);
|
||||
//TODO send back error reply
|
||||
m_s1ap_nas_transport.pack_authentication_reject(reply_msg, ue_ctx->enb_ue_s1ap_id, ue_ctx->mme_ue_s1ap_id);
|
||||
return false;
|
||||
}
|
||||
m_s1ap_log->console("UE Authentication Accepted. IMSI: %lu\n", ue_ctx->imsi);
|
||||
|
|
|
@ -118,7 +118,7 @@ s1ap_nas_transport::pack_authentication_request(srslte::byte_buffer_t *reply_msg
|
|||
//Setup Dw NAS structure
|
||||
LIBLTE_S1AP_MESSAGE_DOWNLINKNASTRANSPORT_STRUCT *dw_nas = &init->choice.DownlinkNASTransport;
|
||||
dw_nas->ext=false;
|
||||
dw_nas->MME_UE_S1AP_ID.MME_UE_S1AP_ID = next_mme_ue_s1ap_id;
|
||||
dw_nas->MME_UE_S1AP_ID.MME_UE_S1AP_ID = next_mme_ue_s1ap_id;//FIXME Change name
|
||||
dw_nas->eNB_UE_S1AP_ID.ENB_UE_S1AP_ID = enb_ue_s1ap_id;
|
||||
dw_nas->HandoverRestrictionList_present=false;
|
||||
dw_nas->SubscriberProfileIDforRFP_present=false;
|
||||
|
@ -156,6 +156,56 @@ s1ap_nas_transport::pack_authentication_request(srslte::byte_buffer_t *reply_msg
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
s1ap_nas_transport::pack_authentication_reject(srslte::byte_buffer_t *reply_msg, uint32_t enb_ue_s1ap_id, uint32_t mme_ue_s1ap_id)
|
||||
{
|
||||
srslte::byte_buffer_t *nas_buffer = m_pool->allocate();
|
||||
|
||||
//Setup initiating message
|
||||
LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu;
|
||||
bzero(&tx_pdu, sizeof(LIBLTE_S1AP_S1AP_PDU_STRUCT));
|
||||
|
||||
tx_pdu.ext = false;
|
||||
tx_pdu.choice_type = LIBLTE_S1AP_S1AP_PDU_CHOICE_INITIATINGMESSAGE;
|
||||
|
||||
LIBLTE_S1AP_INITIATINGMESSAGE_STRUCT *init = &tx_pdu.choice.initiatingMessage;
|
||||
init->procedureCode = LIBLTE_S1AP_PROC_ID_DOWNLINKNASTRANSPORT;
|
||||
init->choice_type = LIBLTE_S1AP_INITIATINGMESSAGE_CHOICE_DOWNLINKNASTRANSPORT;
|
||||
|
||||
//Setup Dw NAS structure
|
||||
LIBLTE_S1AP_MESSAGE_DOWNLINKNASTRANSPORT_STRUCT *dw_nas = &init->choice.DownlinkNASTransport;
|
||||
dw_nas->ext=false;
|
||||
dw_nas->MME_UE_S1AP_ID.MME_UE_S1AP_ID = mme_ue_s1ap_id;//FIXME Change name
|
||||
dw_nas->eNB_UE_S1AP_ID.ENB_UE_S1AP_ID = enb_ue_s1ap_id;
|
||||
dw_nas->HandoverRestrictionList_present=false;
|
||||
dw_nas->SubscriberProfileIDforRFP_present=false;
|
||||
|
||||
LIBLTE_MME_AUTHENTICATION_REQUEST_MSG_STRUCT auth_rej;
|
||||
LIBLTE_ERROR_ENUM err = liblte_mme_pack_authentication_request_msg(&auth_rej, (LIBLTE_BYTE_MSG_STRUCT *) nas_buffer);
|
||||
if(err != LIBLTE_SUCCESS)
|
||||
{
|
||||
m_s1ap_log->error("Error packing Athentication Request\n");
|
||||
m_s1ap_log->console("Error packing Athentication Request\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Copy NAS PDU to Downlink NAS Trasport message buffer
|
||||
memcpy(dw_nas->NAS_PDU.buffer, nas_buffer->msg, nas_buffer->N_bytes);
|
||||
dw_nas->NAS_PDU.n_octets = nas_buffer->N_bytes;
|
||||
|
||||
//Pack Downlink NAS Transport Message
|
||||
err = liblte_s1ap_pack_s1ap_pdu(&tx_pdu, (LIBLTE_BYTE_MSG_STRUCT *) reply_msg);
|
||||
if(err != LIBLTE_SUCCESS)
|
||||
{
|
||||
m_s1ap_log->error("Error packing Athentication Reject\n");
|
||||
m_s1ap_log->console("Error packing Athentication Reject\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_pool->deallocate(nas_buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
s1ap_nas_transport::unpack_authentication_response(LIBLTE_S1AP_MESSAGE_UPLINKNASTRANSPORT_STRUCT *ul_xport,
|
||||
LIBLTE_MME_AUTHENTICATION_RESPONSE_MSG_STRUCT *auth_resp )
|
||||
|
|
Loading…
Reference in New Issue