From ba0b63fe2fe9dcffadcdb1bdd73eb97872889b8b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 9 Aug 2024 15:02:30 +0200 Subject: [PATCH] F1AP: Handle SCTP communication lost It can happen that SCTP communication is simply lost, e.g. [SCTP] SCTP_ASSOC_CHANGE to SCTP_COMM_LOST [SCTP] sctp_recvmsg (fd 104, len -1 ): Connection reset by peer:104 The previous code only handled the SHUTDOWN event, but in abnormal situations, we should also handle the connection state change and signal to RRC that the endpoint is dead, which is now implemented. --- openair2/F1AP/f1ap_cu_task.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index a320b92935..72e3d86ea2 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -64,27 +64,17 @@ static void cu_task_handle_sctp_association_ind(instance_t instance, static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { DevAssert(sctp_new_association_resp != NULL); - if (sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN) { + enum sctp_state_e state = sctp_new_association_resp->sctp_state; + if (state != SCTP_STATE_ESTABLISHED) { f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance); AssertFatal(f1ap_cu_data != NULL, "illegal state: SCTP shutdown for non-existing F1AP endpoint\n"); - LOG_I(F1AP, "Received SCTP shutdown for assoc_id %d, removing endpoint\n", sctp_new_association_resp->assoc_id); + LOG_I(F1AP, "Received SCTP state %d for assoc_id %d, removing endpoint\n", state, sctp_new_association_resp->assoc_id); /* inform RRC that the DU is gone */ MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_LOST_CONNECTION); message_p->ittiMsgHeader.originInstance = sctp_new_association_resp->assoc_id; itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); return; } - - if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); - //if (sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN) - //proto_agent_stop(instance); - //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; // exit -1 for debugging - } } static void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {