laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/36787?usp=email )
Change subject: ranap_common: Implement support for missing procedures ......................................................................
ranap_common: Implement support for missing procedures
Both the RAN and the CN side of ranap_common were missing support for decoding requests and/or responses for a number of RANAP procedures.
This patch adds all of them a of TS 25.413 Release 12 except those related to MBMS or SRVCC.
Related: SYS#6885 Change-Id: I7dea74102da8b610ff2a310c5814f5c89f08e7a6 --- M src/ranap_common_cn.c M src/ranap_common_ran.c 2 files changed, 284 insertions(+), 25 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/87/36787/1
diff --git a/src/ranap_common_cn.c b/src/ranap_common_cn.c index 56ac4e8..749df8d 100644 --- a/src/ranap_common_cn.c +++ b/src/ranap_common_cn.c @@ -72,6 +72,20 @@ /* FIXME this is not a message received by CN (used by hnb-test) */ rc = ranap_decode_iu_releasecommandies(&message->msg.iu_ReleaseCommandIEs, &imsg->value); break; + case RANAP_ProcedureCode_id_RelocationPreparation: /* RELOCATION REQUIRED */ + rc = ranap_decode_relocationrequiredies(&message->msg.relocationRequiredIEs, &imsg->value); + break; + //case RANAP_ProcedureCode_id_RelocationDetect: /* no member in ranap_message */ + //case RANAP_ProcedureCode_id_RelocationComplete: /* no member in ranap_message */ + case RANAP_ProcedureCode_id_RelocationCancel: + rc = ranap_decode_relocationcancelies(&message->msg.relocationCancelIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_ForwardSRNS_Context: + rc = ranap_decode_forwardsrns_contexties(&message->msg.forwardSRNS_ContextIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_LocationReport: + rc = ranap_decode_locationreporties(&message->msg.locationReportIEs, &imsg->value); + break; default: LOGP(DRANAP, LOGL_INFO, "Received RANAP Procedure %s (CO, IM) from RNC. Decode not implemented\n", @@ -116,6 +130,20 @@ /* FIXME this is not a message received by CN (used by hnb-test) */ ranap_free_iu_releasecommandies(&message->msg.iu_ReleaseCommandIEs); break; + case RANAP_ProcedureCode_id_RelocationPreparation: /* RELOCATION REQUIRED */ + ranap_free_relocationrequiredies(&message->msg.relocationRequiredIEs); + break; + //case RANAP_ProcedureCode_id_RelocationDetect: /* no member in ranap_message */ + //case RANAP_ProcedureCode_id_RelocationComplete: /* no member in ranap_message */ + case RANAP_ProcedureCode_id_RelocationCancel: + ranap_free_relocationcancelies(&message->msg.relocationCancelIEs); + break; + case RANAP_ProcedureCode_id_ForwardSRNS_Context: + ranap_free_forwardsrns_contexties(&message->msg.forwardSRNS_ContextIEs); + break; + case RANAP_ProcedureCode_id_LocationReport: + ranap_free_locationreporties(&message->msg.locationReportIEs); + break; default: LOGP(DRANAP, LOGL_INFO, "Freeing RANAP Procedure %s (CO, IM) from RNC not implemented\n", @@ -139,13 +167,25 @@ /* RAB assignment response */ rc = ranap_decode_rab_assignmentresponseies(&message->msg.raB_AssignmentResponseIEs, &imsg->value); break; + case RANAP_ProcedureCode_id_Iu_Release: + /* Iu release Complete; confirmation of CN-initiated release */ + rc = ranap_decode_iu_releasecompleteies(&message->msg.iu_ReleaseCompleteIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_RelocationResourceAllocation: + rc = ranap_decode_relocationrequestacknowledgeies(&message->msg.relocationRequestAcknowledgeIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_SRNS_ContextTransfer: + rc = ranap_decode_srns_contextresponseies(&message->msg.srnS_ContextResponseIEs, &imsg->value); + break; case RANAP_ProcedureCode_id_SecurityModeControl: /* Security Mode Complete */ rc = ranap_decode_securitymodecompleteies(&message->msg.securityModeCompleteIEs, &imsg->value); break; - case RANAP_ProcedureCode_id_Iu_Release: - /* Iu release Complete; confirmation of CN-initiated release */ - rc = ranap_decode_iu_releasecompleteies(&message->msg.iu_ReleaseCompleteIEs, &imsg->value); + case RANAP_ProcedureCode_id_DataVolumeReport: + rc = ranap_decode_datavolumereporties(&message->msg.dataVolumeReportIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_LocationRelatedData: + rc = ranap_decode_locationrelateddataresponseies(&message->msg.locationRelatedDataResponseIEs, &imsg->value); break; default: LOGP(DRANAP, LOGL_INFO, @@ -165,13 +205,25 @@ /* RAB assignment response */ ranap_free_rab_assignmentresponseies(&message->msg.raB_AssignmentResponseIEs); break; + case RANAP_ProcedureCode_id_Iu_Release: + /* Iu release Complete; confirmation of CN-initiated release */ + ranap_free_iu_releasecompleteies(&message->msg.iu_ReleaseCompleteIEs); + break; + case RANAP_ProcedureCode_id_RelocationResourceAllocation: + ranap_free_relocationrequestacknowledgeies(&message->msg.relocationRequestAcknowledgeIEs); + break; + case RANAP_ProcedureCode_id_SRNS_ContextTransfer: + ranap_free_srns_contextresponseies(&message->msg.srnS_ContextResponseIEs); + break; case RANAP_ProcedureCode_id_SecurityModeControl: /* Security Mode Complete */ ranap_free_securitymodecompleteies(&message->msg.securityModeCompleteIEs); break; - case RANAP_ProcedureCode_id_Iu_Release: - /* Iu release Complete; confirmation of CN-initiated release */ - ranap_free_iu_releasecompleteies(&message->msg.iu_ReleaseCompleteIEs); + case RANAP_ProcedureCode_id_DataVolumeReport: + ranap_free_datavolumereporties(&message->msg.dataVolumeReportIEs); + break; + case RANAP_ProcedureCode_id_LocationRelatedData: + ranap_free_locationrelateddataresponseies(&message->msg.locationRelatedDataResponseIEs); break; default: LOGP(DRANAP, LOGL_INFO, @@ -222,6 +274,55 @@ } }
+static int cn_ranap_rx_unsuccessful_msg_co(RANAP_SuccessfulOutcome_t *imsg, ranap_message *message) +{ + int rc = 0; + + message->procedureCode = imsg->procedureCode; + message->criticality = imsg->criticality; + + DEBUGP(DRANAP, "Rx CO USO (%s)\n", get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + + switch (imsg->procedureCode) { + case RANAP_ProcedureCode_id_RelocationResourceAllocation: + rc = ranap_decode_relocationfailureies(&message->msg.relocationFailureIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_SecurityModeControl: + rc = ranap_decode_securitymoderejecties(&message->msg.securityModeRejectIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_LocationRelatedData: + rc = ranap_decode_locationrelateddatafailureies(&message->msg.locationRelatedDataFailureIEs, &imsg->value); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " + "unsuccessful outcome procedure %s (CO) from RNC, ignoring\n", + get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + rc = -1; + break; + } + + return rc; +} + +static void cn_ranap_free_unsuccessful_msg_co(ranap_message *message) +{ + switch (message->procedureCode) { + case RANAP_ProcedureCode_id_RelocationResourceAllocation: + ranap_free_relocationfailureies(&message->msg.relocationFailureIEs); + break; + case RANAP_ProcedureCode_id_SecurityModeControl: + ranap_free_securitymoderejecties(&message->msg.securityModeRejectIEs); + break; + case RANAP_ProcedureCode_id_LocationRelatedData: + ranap_free_locationrelateddatafailureies(&message->msg.locationRelatedDataFailureIEs); + break; + default: + LOGP(DRANAP, LOGL_INFO, "Freeing RANAP unsuccessful outcome procedure %s (CO) from RNC " + "not implemented\n", get_value_string(ranap_procedure_code_vals, message->procedureCode)); + break; + } +} + static int _cn_ranap_rx_co(RANAP_RANAP_PDU_t *pdu, ranap_message *message) { int rc = 0; @@ -234,11 +335,7 @@ rc = cn_ranap_rx_successful_msg_co(&pdu->choice.successfulOutcome, message); break; case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: - LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "unsuccessful outcome procedure %s (CO) from RNC, ignoring\n", - get_value_string(ranap_procedure_code_vals, - pdu->choice.unsuccessfulOutcome.procedureCode)); - rc = -1; + rc = cn_ranap_rx_unsuccessful_msg_co(&pdu->choice.successfulOutcome, message); break; case RANAP_RANAP_PDU_PR_outcome: rc = cn_ranap_rx_outcome_msg_co(&pdu->choice.outcome, message); @@ -265,8 +362,7 @@ cn_ranap_free_successful_msg_co(message); break; case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: - LOGP(DRANAP, LOGL_INFO, - "Freeing RANAP unsuccessful outcome procedure (CO) from RNC not implemented\n"); + cn_ranap_free_unsuccessful_msg_co(message); break; case RANAP_RANAP_PDU_PR_outcome: cn_ranap_free_outcome_msg_co(message); diff --git a/src/ranap_common_ran.c b/src/ranap_common_ran.c index 0bf3796..048a5df 100644 --- a/src/ranap_common_ran.c +++ b/src/ranap_common_ran.c @@ -46,9 +46,48 @@ case RANAP_ProcedureCode_id_RAB_Assignment: rc = ranap_decode_rab_assignmentrequesties(&message->msg.raB_AssignmentRequestIEs, &imsg->value); break; + case RANAP_ProcedureCode_id_DirectTransfer: + rc = ranap_decode_directtransferies(&message->msg.directTransferIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_ErrorIndication: + rc = ranap_decode_errorindicationies(&message->msg.errorIndicationIEs, &imsg->value); + break; case RANAP_ProcedureCode_id_Iu_Release: rc = ranap_decode_iu_releasecommandies(&message->msg.iu_ReleaseCommandIEs, &imsg->value); break; + case RANAP_ProcedureCode_id_RelocationResourceAllocation: + rc = ranap_decode_relocationrequesties(&message->msg.relocationRequestIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_SRNS_ContextTransfer: + rc = ranap_decode_srns_contextrequesties(&message->msg.srnS_ContextRequestIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_SRNS_DataForward: + rc = ranap_decode_srns_dataforwardcommandies(&message->msg.srnS_DataForwardCommandIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_ForwardSRNS_Context: + rc = ranap_decode_forwardsrns_contexties(&message->msg.forwardSRNS_ContextIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_CommonID: + rc = ranap_decode_commonid_ies(&message->msg.commonID_IEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_CN_InvokeTrace: + rc = ranap_decode_cn_invoketraceies(&message->msg.cN_InvokeTraceIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_SecurityModeControl: + rc = ranap_decode_securitymodecommandies(&message->msg.securityModeCommandIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_LocationReportingControl: + rc = ranap_decode_locationreportingcontrolies(&message->msg.locationReportingControlIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_DataVolumeReport: + rc = ranap_decode_datavolumereportrequesties(&message->msg.dataVolumeReportRequestIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_CN_DeactivateTrace: + rc = ranap_decode_cn_deactivatetraceies(&message->msg.cN_DeactivateTraceIEs, &imsg->value); + break; + case RANAP_ProcedureCode_id_LocationRelatedData: + rc = ranap_decode_locationrelateddatarequesties(&message->msg.locationRelatedDataRequestIEs, &imsg->value); + break; default: LOGP(DRANAP, LOGL_INFO, "Received RANAP Procedure %s (CO, IM) from CN. Decode not implemented\n", @@ -66,9 +105,48 @@ case RANAP_ProcedureCode_id_RAB_Assignment: ranap_free_rab_assignmentrequesties(&message->msg.raB_AssignmentRequestIEs); break; + case RANAP_ProcedureCode_id_DirectTransfer: + ranap_free_directtransferies(&message->msg.directTransferIEs); + break; + case RANAP_ProcedureCode_id_ErrorIndication: + ranap_free_errorindicationies(&message->msg.errorIndicationIEs); + break; case RANAP_ProcedureCode_id_Iu_Release: ranap_free_iu_releasecommandies(&message->msg.iu_ReleaseCommandIEs); break; + case RANAP_ProcedureCode_id_RelocationResourceAllocation: + ranap_free_relocationrequesties(&message->msg.relocationRequestIEs); + break; + case RANAP_ProcedureCode_id_SRNS_ContextTransfer: + ranap_free_srns_contextrequesties(&message->msg.srnS_ContextRequestIEs); + break; + case RANAP_ProcedureCode_id_SRNS_DataForward: + ranap_free_srns_dataforwardcommandies(&message->msg.srnS_DataForwardCommandIEs); + break; + case RANAP_ProcedureCode_id_ForwardSRNS_Context: + ranap_free_forwardsrns_contexties(&message->msg.forwardSRNS_ContextIEs); + break; + case RANAP_ProcedureCode_id_CommonID: + ranap_free_commonid_ies(&message->msg.commonID_IEs); + break; + case RANAP_ProcedureCode_id_CN_InvokeTrace: + ranap_free_cn_invoketraceies(&message->msg.cN_InvokeTraceIEs); + break; + case RANAP_ProcedureCode_id_SecurityModeControl: + ranap_free_securitymodecommandies(&message->msg.securityModeCommandIEs); + break; + case RANAP_ProcedureCode_id_LocationReportingControl: + ranap_free_locationreportingcontrolies(&message->msg.locationReportingControlIEs); + break; + case RANAP_ProcedureCode_id_DataVolumeReport: + ranap_free_datavolumereportrequesties(&message->msg.dataVolumeReportRequestIEs); + break; + case RANAP_ProcedureCode_id_CN_DeactivateTrace: + ranap_free_cn_deactivatetraceies(&message->msg.cN_DeactivateTraceIEs); + break; + case RANAP_ProcedureCode_id_LocationRelatedData: + ranap_free_locationrelateddatarequesties(&message->msg.locationRelatedDataRequestIEs); + break; default: LOGP(DRANAP, LOGL_INFO, "Freeing RANAP Procedure %s (CO, IM) from CN not implemented\n", @@ -77,6 +155,83 @@ } }
+static int ran_ranap_rx_successful_msg_co(RANAP_SuccessfulOutcome_t *imsg, ranap_message *message) +{ + int rc = 0; + + message->procedureCode = imsg->procedureCode; + message->criticality = imsg->criticality; + + DEBUGP(DRANAP, "Rx CO SO (%s)\n", get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + + switch (imsg->procedureCode) { + case RANAP_ProcedureCode_id_RelocationPreparation: /* RELOCATION COMMAND */ + rc = ranap_decode_relocationcommandies(&message->msg.relocationCommandIEs, &imsg->value); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " + "successful outcome procedure %s (CO) from CN, ignoring\n", + get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + rc = -1; + break; + } + + return rc; +} + +static void ran_ranap_free_successful_msg_co(ranap_message *message) +{ + switch (message->procedureCode) { + case RANAP_ProcedureCode_id_RelocationPreparation: + ranap_free_relocationcommandies(&message->msg.relocationCommandIEs); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Freeing RANAP " + "successful outcome procedure %s (CO) from CN not implemented\n", + get_value_string(ranap_procedure_code_vals, message->procedureCode)); + break; + } +} + +static int ran_ranap_rx_unsuccessful_msg_co(RANAP_SuccessfulOutcome_t *imsg, ranap_message *message) +{ + int rc = 0; + + message->procedureCode = imsg->procedureCode; + message->criticality = imsg->criticality; + + DEBUGP(DRANAP, "Rx CO USO (%s)\n", get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + + switch (imsg->procedureCode) { + case RANAP_ProcedureCode_id_RelocationPreparation: /* RELOCATION PREPARATION FAILURE */ + rc = ranap_decode_relocationpreparationfailureies(&message->msg.relocationPreparationFailureIEs, &imsg->value); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " + "unsuccessful outcome procedure %s (CO) from CN, ignoring\n", + get_value_string(ranap_procedure_code_vals, imsg->procedureCode)); + rc = -1; + break; + + } + + return rc; +} + +static void ran_ranap_free_unsuccessful_msg_co(ranap_message *message) +{ + switch (message->procedureCode) { + case RANAP_ProcedureCode_id_RelocationPreparation: + ranap_free_relocationpreparationfailureies(&message->msg.relocationPreparationFailureIEs); + break; + default: + LOGP(DRANAP, LOGL_NOTICE, "Freeing RANAP " + "unsuccessful outcome procedure %s (CO) from CN not implemented\n", + get_value_string(ranap_procedure_code_vals, message->procedureCode)); + break; + } +} + static int _ran_ranap_rx_co(void *ctx, RANAP_RANAP_PDU_t *pdu, ranap_message *message) { int rc = 0; @@ -86,16 +241,10 @@ rc = ran_ranap_rx_initiating_msg_co(ctx, &pdu->choice.initiatingMessage, message); break; case RANAP_RANAP_PDU_PR_successfulOutcome: - LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "successful outcome procedure %s (CO) from CN, ignoring\n", - get_value_string(ranap_procedure_code_vals, pdu->choice.successfulOutcome.procedureCode)); - rc = -1; + rc = ran_ranap_rx_successful_msg_co(&pdu->choice.successfulOutcome, message); break; case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: - LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " - "unsuccessful outcome procedure %s (CO) from CN, ignoring\n", - get_value_string(ranap_procedure_code_vals, pdu->choice.unsuccessfulOutcome.procedureCode)); - rc = -1; + rc = ran_ranap_rx_unsuccessful_msg_co(&pdu->choice.successfulOutcome, message); break; case RANAP_RANAP_PDU_PR_outcome: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " @@ -122,12 +271,10 @@ ran_ranap_free_initiating_msg_co(message); break; case RANAP_RANAP_PDU_PR_successfulOutcome: - LOGP(DRANAP, LOGL_NOTICE, "Not freeing unsupported RANAP " - "successful outcome procedure (CO) from CN\n"); + ran_ranap_free_successful_msg_co(message); break; case RANAP_RANAP_PDU_PR_unsuccessfulOutcome: - LOGP(DRANAP, LOGL_NOTICE, "Not freeing unsupported RANAP " - "unsuccessful outcome procedure (CO) from CN\n"); + ran_ranap_free_unsuccessful_msg_co(message); break; case RANAP_RANAP_PDU_PR_outcome: LOGP(DRANAP, LOGL_NOTICE, "Not freeing unsupported RANAP "