Commit 37ee9eb6 authored by masayuki.harada's avatar masayuki.harada Committed by Haruki NAOI

Fix x2 setup problem.

(cherry picked from commit 4c664da7d2ca85f60902f0ec929abe8d5c11bae0)
parent 32291b72
...@@ -111,8 +111,6 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa ...@@ -111,8 +111,6 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
X2AP_ERROR("%s %d: sctp_new_association_resp is a NULL pointer \n",__FILE__,__LINE__); X2AP_ERROR("%s %d: sctp_new_association_resp is a NULL pointer \n",__FILE__,__LINE__);
return ; return ;
} }
printf("x2ap_eNB_handle_sctp_association_resp at 1\n");
dump_trees();
instance_p = x2ap_eNB_get_instance(instance); instance_p = x2ap_eNB_get_instance(instance);
if(instance_p == NULL) { if(instance_p == NULL) {
X2AP_ERROR("%s %d: instance_p is a NULL pointer \n",__FILE__,__LINE__); X2AP_ERROR("%s %d: instance_p is a NULL pointer \n",__FILE__,__LINE__);
...@@ -145,8 +143,6 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa ...@@ -145,8 +143,6 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
X2AP_ERROR("%s %d: x2ap_enb_data_p is a NULL pointer \n",__FILE__,__LINE__); X2AP_ERROR("%s %d: x2ap_enb_data_p is a NULL pointer \n",__FILE__,__LINE__);
return ; return ;
} }
printf("x2ap_eNB_handle_sctp_association_resp at 2\n");
dump_trees();
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
X2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", X2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
...@@ -154,28 +150,23 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa ...@@ -154,28 +150,23 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
instance, instance,
sctp_new_association_resp->ulp_cnx_id); sctp_new_association_resp->ulp_cnx_id);
x2ap_handle_x2_setup_message(instance_p, x2ap_enb_data_p, x2ap_handle_x2_setup_message(instance_p, x2ap_enb_data_p,
sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); (sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN) | (sctp_new_association_resp->sctp_state == SCTP_STATE_UNREACHABLE));
return; return;
} }
printf("x2ap_eNB_handle_sctp_association_resp at 3\n");
dump_trees();
/* Update parameters */ /* Update parameters */
x2ap_enb_data_p->assoc_id = sctp_new_association_resp->assoc_id; x2ap_enb_data_p->assoc_id = sctp_new_association_resp->assoc_id;
x2ap_enb_data_p->in_streams = sctp_new_association_resp->in_streams; x2ap_enb_data_p->in_streams = sctp_new_association_resp->in_streams;
x2ap_enb_data_p->out_streams = sctp_new_association_resp->out_streams; x2ap_enb_data_p->out_streams = sctp_new_association_resp->out_streams;
printf("x2ap_eNB_handle_sctp_association_resp at 4\n");
dump_trees();
/* Prepare new x2 Setup Request */ /* Prepare new x2 Setup Request */
x2ap_eNB_generate_x2_setup_request(instance_p, x2ap_enb_data_p); x2ap_eNB_generate_x2_setup_request(instance_p, x2ap_enb_data_p);
dump_trees();
} }
static static
void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) {
x2ap_eNB_instance_t *instance_p; x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *x2ap_enb_data_p; x2ap_eNB_data_t *x2ap_enb_data_p;
printf("x2ap_eNB_handle_sctp_association_ind at 1 (called for instance %d)\n", instance);
dump_trees();
if(sctp_new_association_ind == NULL) { if(sctp_new_association_ind == NULL) {
X2AP_ERROR("%s %d: sctp_new_association_ind is a NULL pointer \n",__FILE__,__LINE__); X2AP_ERROR("%s %d: sctp_new_association_ind is a NULL pointer \n",__FILE__,__LINE__);
...@@ -219,13 +210,10 @@ void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_associat ...@@ -219,13 +210,10 @@ void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_associat
X2AP_WARN("x2ap_enb_data_p already exists\n"); X2AP_WARN("x2ap_enb_data_p already exists\n");
} }
printf("x2ap_eNB_handle_sctp_association_ind at 2\n");
dump_trees();
/* Update parameters */ /* Update parameters */
//x2ap_enb_data_p->assoc_id = sctp_new_association_ind->assoc_id; //x2ap_enb_data_p->assoc_id = sctp_new_association_ind->assoc_id;
x2ap_enb_data_p->in_streams = sctp_new_association_ind->in_streams; x2ap_enb_data_p->in_streams = sctp_new_association_ind->in_streams;
x2ap_enb_data_p->out_streams = sctp_new_association_ind->out_streams; x2ap_enb_data_p->out_streams = sctp_new_association_ind->out_streams;
printf("x2ap_eNB_handle_sctp_association_ind at 3\n");
dump_trees(); dump_trees();
} }
......
...@@ -149,11 +149,6 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data ...@@ -149,11 +149,6 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data
} }
} }
} else { } else {
/* Check that at least one setup message is pending */
DevCheck(instance_p->x2_target_enb_pending_nb > 0,
instance_p->instance,
instance_p->x2_target_enb_pending_nb, 0);
if (instance_p->x2_target_enb_pending_nb > 0) { if (instance_p->x2_target_enb_pending_nb > 0) {
/* Decrease pending messages number */ /* Decrease pending messages number */
instance_p->x2_target_enb_pending_nb --; instance_p->x2_target_enb_pending_nb --;
...@@ -352,6 +347,24 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance, ...@@ -352,6 +347,24 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
} }
} }
instance_p = x2ap_eNB_get_instance(instance);
if(instance_p == NULL) {
X2AP_ERROR("%s %d: instance_p is a NULL pointer \n",__FILE__,__LINE__);
itti_free(ITTI_MSG_ORIGIN_ID(msg), msg);
return -1;
}
X2AP_DEBUG("Check eNB id %d my eNB id %d\n", eNB_id, instance_p->eNB_id);
if(eNB_id==instance_p->eNB_id){
X2AP_ERROR("Rejecting x2 setup request as eNB id %d is duplicated my eNB id assoc_id: %d\n", eNB_id, assoc_id);
x2ap_eNB_generate_x2_setup_failure (instance,
assoc_id,
X2AP_Cause_PR_protocol,
X2AP_CauseProtocol_unspecified,
-1);
return -1;
}
X2AP_DEBUG("Adding eNB to the list of associated eNBs\n"); X2AP_DEBUG("Adding eNB to the list of associated eNBs\n");
if ((x2ap_eNB_data = x2ap_is_eNB_id_in_list (eNB_id)) == NULL) { if ((x2ap_eNB_data = x2ap_is_eNB_id_in_list (eNB_id)) == NULL) {
...@@ -413,13 +426,6 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance, ...@@ -413,13 +426,6 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
} }
} }
instance_p = x2ap_eNB_get_instance(instance);
if(instance_p == NULL) {
X2AP_ERROR("%s %d: instance_p is a NULL pointer \n",__FILE__,__LINE__);
itti_free(ITTI_MSG_ORIGIN_ID(msg), msg);
return -1;
}
itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg); itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg);
return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data); return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data);
......
...@@ -967,7 +967,7 @@ sctp_eNB_read_from_socket( ...@@ -967,7 +967,7 @@ sctp_eNB_read_from_socket(
&sinfo, &flags); &sinfo, &flags);
if (n < 0) { if (n < 0) {
if( (errno == ENOTCONN) || (errno == ECONNRESET) || (errno == ETIMEDOUT) || (errno == ECONNREFUSED) ) if( (errno == ENOTCONN) || (errno == ECONNRESET) || (errno == ECONNREFUSED) )
{ {
itti_unsubscribe_event_fd(TASK_SCTP, sctp_cnx->sd); itti_unsubscribe_event_fd(TASK_SCTP, sctp_cnx->sd);
...@@ -978,6 +978,18 @@ sctp_eNB_read_from_socket( ...@@ -978,6 +978,18 @@ sctp_eNB_read_from_socket(
sctp_cnx->task_id, sctp_cnx->instance, -1, sctp_cnx->task_id, sctp_cnx->instance, -1,
sctp_cnx->cnx_id, SCTP_STATE_UNREACHABLE, 0, 0); sctp_cnx->cnx_id, SCTP_STATE_UNREACHABLE, 0, 0);
close(sctp_cnx->sd);
STAILQ_REMOVE(&sctp_cnx_list, sctp_cnx, sctp_cnx_list_elm_s, entries);
sctp_nb_cnx--;
free(sctp_cnx);
} else if(errno == ETIMEDOUT) {
SCTP_DEBUG("SCTP heart beat timeout for sd %d\n", sctp_cnx->sd);
SCTP_ERROR("sctp_recvmsg (fd %d, len %d ): %s:%d\n", sctp_cnx->sd, n, strerror(errno), errno);
sctp_itti_send_association_resp(
sctp_cnx->task_id, sctp_cnx->instance, sctp_cnx->assoc_id,
sctp_cnx->cnx_id, SCTP_STATE_SHUTDOWN, 0, 0);
close(sctp_cnx->sd); close(sctp_cnx->sd);
STAILQ_REMOVE(&sctp_cnx_list, sctp_cnx, sctp_cnx_list_elm_s, entries); STAILQ_REMOVE(&sctp_cnx_list, sctp_cnx, sctp_cnx_list_elm_s, entries);
sctp_nb_cnx--; sctp_nb_cnx--;
......
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