|
|
@ -249,8 +249,6 @@ int nas_5g::send_registration_request()
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Generating registration request");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initial_registration_request_stored.hdr.extended_protocol_discriminator =
|
|
|
|
initial_registration_request_stored.hdr.extended_protocol_discriminator =
|
|
|
|
nas_5gs_hdr::extended_protocol_discriminator_opts::extended_protocol_discriminator_5gmm;
|
|
|
|
nas_5gs_hdr::extended_protocol_discriminator_opts::extended_protocol_discriminator_5gmm;
|
|
|
|
registration_request_t& reg_req = initial_registration_request_stored.set_registration_request();
|
|
|
|
registration_request_t& reg_req = initial_registration_request_stored.set_registration_request();
|
|
|
@ -284,6 +282,7 @@ int nas_5g::send_registration_request()
|
|
|
|
logger.debug("Starting T3410. Timeout in %d ms.", t3510.duration());
|
|
|
|
logger.debug("Starting T3410. Timeout in %d ms.", t3510.duration());
|
|
|
|
t3510.run();
|
|
|
|
t3510.run();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Sending Registration Request");
|
|
|
|
if (rrc_nr->is_connected() == true) {
|
|
|
|
if (rrc_nr->is_connected() == true) {
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -342,8 +341,6 @@ int nas_5g::send_authentication_response(const uint8_t res[16])
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Generating Authentication Response");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
authentication_response_t& auth_resp = nas_msg.set_authentication_response();
|
|
|
|
authentication_response_t& auth_resp = nas_msg.set_authentication_response();
|
|
|
|
auth_resp.authentication_response_parameter_present = true;
|
|
|
|
auth_resp.authentication_response_parameter_present = true;
|
|
|
@ -402,8 +399,6 @@ int nas_5g::send_security_mode_complete(const srsran::nas_5g::security_mode_comm
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Generating Security Mode Complete");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
security_mode_complete_t& security_mode_complete = nas_msg.set_security_mode_complete();
|
|
|
|
security_mode_complete_t& security_mode_complete = nas_msg.set_security_mode_complete();
|
|
|
|
|
|
|
|
|
|
|
@ -491,7 +486,7 @@ int nas_5g::send_authentication_failure(const cause_5gmm_t::cause_5gmm_type_::op
|
|
|
|
if (pcap != nullptr) {
|
|
|
|
if (pcap != nullptr) {
|
|
|
|
pcap->write_nas(pdu.get()->msg, pdu.get()->N_bytes);
|
|
|
|
pcap->write_nas(pdu.get()->msg, pdu.get()->N_bytes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.info("Sending Authentication Failure");
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
|
|
|
|
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
@ -529,8 +524,6 @@ int nas_5g::send_pdu_session_establishment_request(uint32_t tran
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Generating PDU Session Establishment Request");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
nas_msg.hdr.pdu_session_identity = pdu_session_id;
|
|
|
|
nas_msg.hdr.pdu_session_identity = pdu_session_id;
|
|
|
|
nas_msg.hdr.procedure_transaction_identity = transaction_identity;
|
|
|
|
nas_msg.hdr.procedure_transaction_identity = transaction_identity;
|
|
|
@ -619,8 +612,6 @@ int nas_5g::send_deregistration_request_ue_originating(bool switch_off)
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Generating Deregistration Request (UE Originating)");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
deregistration_request_ue_originating_t& deregistration_request = nas_msg.set_deregistration_request_ue_originating();
|
|
|
|
deregistration_request_ue_originating_t& deregistration_request = nas_msg.set_deregistration_request_ue_originating();
|
|
|
|
nas_msg.hdr.security_header_type = nas_5gs_hdr::security_header_type_opts::integrity_protected_and_ciphered;
|
|
|
|
nas_msg.hdr.security_header_type = nas_5gs_hdr::security_header_type_opts::integrity_protected_and_ciphered;
|
|
|
@ -682,8 +673,6 @@ int nas_5g::send_identity_response(srsran::nas_5g::identity_type_5gs_t::identity
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Generating Identity Response");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
identity_response_t& identity_response = nas_msg.set_identity_response();
|
|
|
|
identity_response_t& identity_response = nas_msg.set_identity_response();
|
|
|
|
nas_msg.hdr.security_header_type = nas_5gs_hdr::security_header_type_opts::integrity_protected_and_ciphered;
|
|
|
|
nas_msg.hdr.security_header_type = nas_5gs_hdr::security_header_type_opts::integrity_protected_and_ciphered;
|
|
|
@ -734,6 +723,7 @@ int nas_5g::send_identity_response(srsran::nas_5g::identity_type_5gs_t::identity
|
|
|
|
pdu->N_bytes - SEQ_5G_OFFSET,
|
|
|
|
pdu->N_bytes - SEQ_5G_OFFSET,
|
|
|
|
&pdu->msg[MAC_5G_OFFSET]);
|
|
|
|
&pdu->msg[MAC_5G_OFFSET]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Sending Identity Response");
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
ctxt_base.tx_count++;
|
|
|
|
ctxt_base.tx_count++;
|
|
|
|
|
|
|
|
|
|
|
@ -748,8 +738,6 @@ int nas_5g::send_configuration_update_complete()
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("Generating Configuration Update Complete");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
nas_5gs_msg nas_msg;
|
|
|
|
configuration_update_complete_t& config_update_complete = nas_msg.set_configuration_update_complete();
|
|
|
|
configuration_update_complete_t& config_update_complete = nas_msg.set_configuration_update_complete();
|
|
|
|
nas_msg.hdr.security_header_type = nas_5gs_hdr::security_header_type_opts::integrity_protected_and_ciphered;
|
|
|
|
nas_msg.hdr.security_header_type = nas_5gs_hdr::security_header_type_opts::integrity_protected_and_ciphered;
|
|
|
@ -772,6 +760,7 @@ int nas_5g::send_configuration_update_complete()
|
|
|
|
pdu->N_bytes - SEQ_5G_OFFSET,
|
|
|
|
pdu->N_bytes - SEQ_5G_OFFSET,
|
|
|
|
&pdu->msg[MAC_5G_OFFSET]);
|
|
|
|
&pdu->msg[MAC_5G_OFFSET]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.error("Sending Configuration Update Complete");
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
rrc_nr->write_sdu(std::move(pdu));
|
|
|
|
ctxt_base.tx_count++;
|
|
|
|
ctxt_base.tx_count++;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
@ -780,6 +769,7 @@ int nas_5g::send_configuration_update_complete()
|
|
|
|
// Message handler
|
|
|
|
// Message handler
|
|
|
|
int nas_5g::handle_registration_accept(registration_accept_t& registration_accept)
|
|
|
|
int nas_5g::handle_registration_accept(registration_accept_t& registration_accept)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
if (state.get_state() != mm5g_state_t::state_t::registered_initiated) {
|
|
|
|
if (state.get_state() != mm5g_state_t::state_t::registered_initiated) {
|
|
|
|
logger.warning("Not compatibale with current state %s", state.get_full_state_text());
|
|
|
|
logger.warning("Not compatibale with current state %s", state.get_full_state_text());
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
@ -808,7 +798,7 @@ int nas_5g::handle_registration_accept(registration_accept_t& registration_accep
|
|
|
|
int nas_5g::handle_registration_reject(registration_reject_t& registration_reject)
|
|
|
|
int nas_5g::handle_registration_reject(registration_reject_t& registration_reject)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Registration Reject");
|
|
|
|
logger.info("Handling Registration Reject");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
state.set_deregistered(mm5g_state_t::deregistered_substate_t::plmn_search);
|
|
|
|
state.set_deregistered(mm5g_state_t::deregistered_substate_t::plmn_search);
|
|
|
|
|
|
|
|
|
|
|
|
switch (registration_reject.cause_5gmm.cause_5gmm.value) {
|
|
|
|
switch (registration_reject.cause_5gmm.cause_5gmm.value) {
|
|
|
@ -837,7 +827,7 @@ int nas_5g::handle_registration_reject(registration_reject_t& registration_rejec
|
|
|
|
int nas_5g::handle_authentication_request(authentication_request_t& authentication_request)
|
|
|
|
int nas_5g::handle_authentication_request(authentication_request_t& authentication_request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Registration Request");
|
|
|
|
logger.info("Handling Registration Request");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
// Generate authentication response using RAND, AUTN & KSI-ASME
|
|
|
|
// Generate authentication response using RAND, AUTN & KSI-ASME
|
|
|
|
uint16 mcc, mnc;
|
|
|
|
uint16 mcc, mnc;
|
|
|
|
mcc = rrc_nr->get_mcc();
|
|
|
|
mcc = rrc_nr->get_mcc();
|
|
|
@ -898,6 +888,7 @@ int nas_5g::handle_authentication_request(authentication_request_t& authenticati
|
|
|
|
int nas_5g::handle_authentication_reject(srsran::nas_5g::authentication_reject_t& authentication_reject)
|
|
|
|
int nas_5g::handle_authentication_reject(srsran::nas_5g::authentication_reject_t& authentication_reject)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Authentication Reject");
|
|
|
|
logger.info("Handling Authentication Reject");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
state.set_deregistered(mm5g_state_t::deregistered_substate_t::plmn_search);
|
|
|
|
state.set_deregistered(mm5g_state_t::deregistered_substate_t::plmn_search);
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -905,6 +896,7 @@ int nas_5g::handle_authentication_reject(srsran::nas_5g::authentication_reject_t
|
|
|
|
int nas_5g::handle_identity_request(identity_request_t& identity_request)
|
|
|
|
int nas_5g::handle_identity_request(identity_request_t& identity_request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Identity Request");
|
|
|
|
logger.info("Handling Identity Request");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
send_identity_response(identity_request.identity_type.type_of_identity.value);
|
|
|
|
send_identity_response(identity_request.identity_type.type_of_identity.value);
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -912,12 +904,14 @@ int nas_5g::handle_identity_request(identity_request_t& identity_request)
|
|
|
|
int nas_5g::handle_service_accept(srsran::nas_5g::service_accept_t& service_accept)
|
|
|
|
int nas_5g::handle_service_accept(srsran::nas_5g::service_accept_t& service_accept)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Service Accept");
|
|
|
|
logger.info("Handling Service Accept");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int nas_5g::handle_service_reject(srsran::nas_5g::service_reject_t& service_reject)
|
|
|
|
int nas_5g::handle_service_reject(srsran::nas_5g::service_reject_t& service_reject)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Service Accept");
|
|
|
|
logger.info("Handling Service Reject");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -972,6 +966,7 @@ int nas_5g::handle_deregistration_accept_ue_terminated(
|
|
|
|
deregistration_accept_ue_terminated_t& deregistration_accept_ue_terminated)
|
|
|
|
deregistration_accept_ue_terminated_t& deregistration_accept_ue_terminated)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Deregistration Accept UE Terminated");
|
|
|
|
logger.info("Handling Deregistration Accept UE Terminated");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -979,12 +974,14 @@ int nas_5g::handle_deregistration_request_ue_terminated(
|
|
|
|
deregistration_request_ue_terminated_t& deregistration_request_ue_terminated)
|
|
|
|
deregistration_request_ue_terminated_t& deregistration_request_ue_terminated)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Deregistration Request UE Terminated");
|
|
|
|
logger.info("Handling Deregistration Request UE Terminated");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int nas_5g::handle_dl_nas_transport(srsran::nas_5g::dl_nas_transport_t& dl_nas_transport)
|
|
|
|
int nas_5g::handle_dl_nas_transport(srsran::nas_5g::dl_nas_transport_t& dl_nas_transport)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling DL NAS transport");
|
|
|
|
logger.info("Handling DL NAS transport");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
switch (dl_nas_transport.payload_container_type.payload_container_type) {
|
|
|
|
switch (dl_nas_transport.payload_container_type.payload_container_type) {
|
|
|
|
case payload_container_type_t::Payload_container_type_type_::options::n1_sm_information:
|
|
|
|
case payload_container_type_t::Payload_container_type_type_::options::n1_sm_information:
|
|
|
|
return handle_n1_sm_information(dl_nas_transport.payload_container.payload_container_contents);
|
|
|
|
return handle_n1_sm_information(dl_nas_transport.payload_container.payload_container_contents);
|
|
|
@ -1026,6 +1023,7 @@ int nas_5g::handle_deregistration_accept_ue_originating(
|
|
|
|
srsran::nas_5g::deregistration_accept_ue_originating_t& deregistration_accept_ue_originating)
|
|
|
|
srsran::nas_5g::deregistration_accept_ue_originating_t& deregistration_accept_ue_originating)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Received Deregistration Accept (UE Originating)");
|
|
|
|
logger.info("Received Deregistration Accept (UE Originating)");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
if (state.get_state() != mm5g_state_t::state_t::deregistered_initiated) {
|
|
|
|
if (state.get_state() != mm5g_state_t::state_t::deregistered_initiated) {
|
|
|
|
logger.warning("Received deregistration accept while not in deregistered initiated state");
|
|
|
|
logger.warning("Received deregistration accept while not in deregistered initiated state");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1038,6 +1036,7 @@ int nas_5g::handle_configuration_update_command(
|
|
|
|
srsran::nas_5g::configuration_update_command_t& configuration_update_command)
|
|
|
|
srsran::nas_5g::configuration_update_command_t& configuration_update_command)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("Handling Configuration Update Command");
|
|
|
|
logger.info("Handling Configuration Update Command");
|
|
|
|
|
|
|
|
ctxt_base.rx_count++;
|
|
|
|
send_configuration_update_complete();
|
|
|
|
send_configuration_update_complete();
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|