Commit 5d06dcc3 authored by Bing-Kai Hong's avatar Bing-Kai Hong

fix Segmentation fault when f1ap_message_decoded_callback have not define instance_t for arguments

parent d4b13691
......@@ -419,6 +419,7 @@ inline void ASN_DEBUG(const char *fmt, ...);
/** \brief Function callback prototype.
**/
typedef int (*f1ap_message_decoded_callback)(
instance_t instance,
uint32_t assoc_id,
uint32_t stream,
F1AP_F1AP_PDU_t *message_p
......
......@@ -65,12 +65,12 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams;
}
void cu_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
int result;
DevAssert(sctp_data_ind != NULL);
f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
......@@ -132,7 +132,8 @@ void *F1AP_CU_task(void *arg) {
case SCTP_DATA_IND:
LOG_I(CU_F1AP, "SCTP_DATA_IND\n");
cu_task_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_data_ind);
break;
case F1AP_SETUP_RESP: // from rrc
......
......@@ -24,7 +24,7 @@
void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind);
void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
void cu_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind);
void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind);
void cu_task_send_sctp_init_req(instance_t enb_id);
void *F1AP_CU_task(void *arg);
......
......@@ -97,13 +97,13 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
DU_send_F1_SETUP_REQUEST(instance);
}
void du_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind)
{
int result;
DevAssert(sctp_data_ind != NULL);
f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
......@@ -154,7 +154,8 @@ void *F1AP_DU_task(void *arg) {
case SCTP_DATA_IND:
// ex: any F1 incoming message for DU ends here
LOG_I(DU_F1AP, "SCTP_DATA_IND\n");
du_task_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
du_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_data_ind);
break;
case TERMINATE_MESSAGE:
......
......@@ -24,7 +24,7 @@
void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req);
void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
void du_task_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind);
void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind);
void *F1AP_DU_task(void *arg);
#endif /* DU_F1AP_TASK_H_ */
......@@ -78,7 +78,7 @@ static const char *f1ap_direction_String[] = {
return(f1ap_direction_String[f1ap_dir]);
}
int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
const uint8_t * const data, const uint32_t data_length)
{
F1AP_F1AP_PDU_t pdu;
......@@ -116,7 +116,7 @@ int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
/* Calling the right handler */
ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1])
(assoc_id, stream, &pdu);
(instance, assoc_id, stream, &pdu);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
return ret;
}
\ No newline at end of file
......@@ -33,7 +33,7 @@
#ifndef F1AP_HANDLERS_H_
#define F1AP_HANDLERS_H_
int f1ap_handle_message(uint32_t assoc_id, int32_t stream,
int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
const uint8_t * const data, const uint32_t data_length);
#endif /* F1AP_HANDLERS_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment