Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lte][agw]Bug fix for missing ue context at spgw #4141

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
110 changes: 58 additions & 52 deletions lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,12 @@ void mme_app_handle_delete_session_rsp(
OAILOG_FUNC_OUT(LOG_MME_APP);
}
#endif
hashtable_uint64_ts_remove(
hashtable_rc_t hash_rc = hashtable_uint64_ts_remove(
mme_app_desc_p->mme_ue_contexts.tun11_ue_context_htbl,
(const hash_key_t) ue_context_p->mme_teid_s11);
ue_context_p->mme_teid_s11 = 0;
if (hash_rc == HASH_TABLE_OK) {
ue_context_p->mme_teid_s11 = 0;
}
ue_context_p->nb_active_pdn_contexts -= 1;

/* In case of Ue initiated explicit IMSI Detach or Combined EPS/IMSI detach
Expand Down Expand Up @@ -1538,7 +1540,11 @@ void mme_app_handle_initial_context_setup_rsp(
OAILOG_FUNC_OUT(LOG_MME_APP);
}

// Stop Initial context setup process guard timer,if running
/* Stop Initial context setup process guard timer,if running.
* Do not process the message if timer is not running because
* it means that the timer has already expired
* and implicit detach is triggered.
*/
if (ue_context_p->initial_context_setup_rsp_timer.id !=
MME_APP_TIMER_INACTIVE_ID) {
nas_itti_timer_arg_t* timer_argP = NULL;
Expand All @@ -1557,29 +1563,29 @@ void mme_app_handle_initial_context_setup_rsp(
ue_context_p->initial_context_setup_rsp_timer.id =
MME_APP_TIMER_INACTIVE_ID;
ue_context_p->time_ics_rsp_timer_started = 0;
}

if (mme_app_send_modify_bearer_request_for_active_pdns(
ue_context_p, initial_ctxt_setup_rsp_p) != RETURNok) {
OAILOG_ERROR_UE(
LOG_MME_APP, ue_context_p->emm_context._imsi64,
"Failed to send modify bearer request for UE id %d \n",
ue_context_p->mme_ue_s1ap_id);
OAILOG_FUNC_OUT(LOG_MME_APP);
}
/*
* During Service request procedure,after initial context setup response
* Send ULR, when UE moved from Idle to Connected and
* flag location_info_confirmed_in_hss set to true during hss reset.
*/
if (ue_context_p->location_info_confirmed_in_hss == true) {
mme_app_send_s6a_update_location_req(ue_context_p);
}
if (ue_context_p->sgs_context) {
ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_NONE;
// Reset mt_call_in_progress flag
if (ue_context_p->sgs_context->mt_call_in_progress) {
ue_context_p->sgs_context->mt_call_in_progress = false;
if (mme_app_send_modify_bearer_request_for_active_pdns(
ue_context_p, initial_ctxt_setup_rsp_p) != RETURNok) {
OAILOG_ERROR_UE(
LOG_MME_APP, ue_context_p->emm_context._imsi64,
"Failed to send modify bearer request for UE id %d \n",
ue_context_p->mme_ue_s1ap_id);
OAILOG_FUNC_OUT(LOG_MME_APP);
}
/*
* During Service request procedure,after initial context setup response
* Send ULR, when UE moved from Idle to Connected and
* flag location_info_confirmed_in_hss set to true during hss reset.
*/
if (ue_context_p->location_info_confirmed_in_hss == true) {
mme_app_send_s6a_update_location_req(ue_context_p);
}
if (ue_context_p->sgs_context) {
ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_NONE;
// Reset mt_call_in_progress flag
if (ue_context_p->sgs_context->mt_call_in_progress) {
ue_context_p->sgs_context->mt_call_in_progress = false;
}
}
}
OAILOG_FUNC_OUT(LOG_MME_APP);
Expand Down Expand Up @@ -1949,35 +1955,35 @@ void mme_app_handle_initial_context_setup_failure(
ue_context_p->initial_context_setup_rsp_timer.id =
MME_APP_TIMER_INACTIVE_ID;
ue_context_p->time_implicit_detach_timer_started = 0;
}
/* *********Abort the ongoing procedure*********
* Check if UE is registered already that implies service request procedure is
* active. If so then release the S1AP context and move the UE back to idle
* mode. Otherwise if UE is not yet registered that implies attach procedure
* is active. If so,then abort the attach procedure and release the UE
* context.
*/
ue_context_p->ue_context_rel_cause = S1AP_INITIAL_CONTEXT_SETUP_FAILED;
if (ue_context_p->mm_state == UE_UNREGISTERED) {
// Initiate Implicit Detach for the UE
nas_proc_implicit_detach_ue_ind(ue_context_p->mme_ue_s1ap_id);
increment_counter(
"ue_attach", 1, 2, "result", "failure", "cause",
"initial_context_setup_failure_rcvd");
increment_counter("ue_attach", 1, 1, "action", "attach_abort");
} else {
// Release S1-U bearer and move the UE to idle mode
/* *********Abort the ongoing procedure*********
* Check if UE is registered already that implies service request procedure
* is active. If so then release the S1AP context and move the UE back to
* idle mode. Otherwise if UE is not yet registered that implies attach
* procedure is active. If so,then abort the attach procedure and release
* the UE context.
*/
ue_context_p->ue_context_rel_cause = S1AP_INITIAL_CONTEXT_SETUP_FAILED;
if (ue_context_p->mm_state == UE_UNREGISTERED) {
// Initiate Implicit Detach for the UE
nas_proc_implicit_detach_ue_ind(ue_context_p->mme_ue_s1ap_id);
increment_counter(
"ue_attach", 1, 2, "result", "failure", "cause",
"initial_context_setup_failure_rcvd");
increment_counter("ue_attach", 1, 1, "action", "attach_abort");
} else {
// Release S1-U bearer and move the UE to idle mode

for (pdn_cid_t i = 0; i < MAX_APN_PER_UE; i++) {
if (ue_context_p->pdn_contexts[i]) {
mme_app_send_s11_release_access_bearers_req(ue_context_p, i);
for (pdn_cid_t i = 0; i < MAX_APN_PER_UE; i++) {
if (ue_context_p->pdn_contexts[i]) {
mme_app_send_s11_release_access_bearers_req(ue_context_p, i);
}
}
/* Handles CSFB failure */
if (ue_context_p->sgs_context != NULL) {
handle_csfb_s1ap_procedure_failure(
ue_context_p, "initial_context_setup_failed",
INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED);
}
}
/* Handles CSFB failure */
if (ue_context_p->sgs_context != NULL) {
handle_csfb_s1ap_procedure_failure(
ue_context_p, "initial_context_setup_failed",
INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED);
}
}
OAILOG_FUNC_OUT(LOG_MME_APP);
Expand Down
2 changes: 1 addition & 1 deletion lte/gateway/c/oai/tasks/mme_app/mme_app_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ void mme_ue_context_update_coll_keys(
h_rc = hashtable_uint64_ts_remove(
mme_ue_context_p->tun11_ue_context_htbl,
(const hash_key_t) ue_context_p->mme_teid_s11);
if (INVALID_MME_UE_S1AP_ID != mme_ue_s1ap_id) {
if ((INVALID_MME_UE_S1AP_ID != mme_ue_s1ap_id) && (mme_teid_s11)) {
h_rc = hashtable_uint64_ts_insert(
mme_ue_context_p->tun11_ue_context_htbl,
(const hash_key_t) mme_teid_s11, (uint64_t) mme_ue_s1ap_id);
Expand Down
2 changes: 2 additions & 0 deletions lte/gateway/c/oai/tasks/sgw/sgw_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ static int send_mbr_failure(
modify_response_p->bearer_contexts_marked_for_removal.bearer_contexts[idx]
.cause.cause_value = CONTEXT_NOT_FOUND;
}
// Fill mme s11 teid received in modify bearer request
modify_response_p->teid = modify_bearer_pP->local_teid;
modify_response_p->bearer_contexts_marked_for_removal.num_bearer_context += 1;
modify_response_p->cause.cause_value = CONTEXT_NOT_FOUND;
modify_response_p->trxn = modify_bearer_pP->trxn;
Expand Down