Fixed the bug of SGW-C session deletion (#1825)

This commit is contained in:
Sukchan Lee 2022-10-25 21:22:14 +09:00
parent b151642fa1
commit e3ba32c85d
5 changed files with 22 additions and 26 deletions

View File

@ -231,6 +231,7 @@ int sgwc_gtp_send_downlink_data_notification(
gtp_xact = ogs_gtp_xact_local_create(
sgwc_ue->gnode, &h, pkbuf, bearer_timeout, bearer);
ogs_expect_or_return_val(gtp_xact, OGS_ERROR);
gtp_xact->local_teid = sgwc_ue->sgw_s11_teid;
rv = ogs_gtp_xact_commit(gtp_xact);
ogs_expect(rv == OGS_OK);

View File

@ -661,6 +661,7 @@ void sgwc_s11_handle_delete_session_request(
s5c_xact = ogs_gtp_xact_local_create(
sess->gnode, &message->h, gtpbuf, gtp_sess_timeout, sess);
ogs_expect_or_return(s5c_xact);
s5c_xact->local_teid = sess->sgw_s5c_teid;
ogs_gtp_xact_associate(s11_xact, s5c_xact);

View File

@ -420,7 +420,6 @@ void sgwc_s5c_handle_delete_session_response(
ogs_pkbuf_t *gtpbuf, ogs_gtp2_message_t *message)
{
int rv;
ogs_gtp2_cause_t *cause = NULL;
uint8_t cause_value;
sgwc_ue_t *sgwc_ue = NULL;
@ -466,37 +465,23 @@ void sgwc_s5c_handle_delete_session_response(
return;
}
/*****************************************
* Check Mandatory/Conditional IE Missing
*****************************************/
ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED);
if (rsp->cause.presence == 0) {
ogs_error("No Cause");
cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
/********************
* Check Cause Value
********************/
ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED);
cause = rsp->cause.data;
ogs_assert(cause);
cause_value = cause->value;
if (rsp->cause.presence) {
ogs_gtp2_cause_t *cause = rsp->cause.data;
ogs_assert(cause);
cause_value = cause->value;
} else {
ogs_error("No Cause");
cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_error("GTP Cause [Value:%d]", cause_value);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value);
return;
ogs_error("GTP Cause [Value:%d] - Ignored", cause_value);
}
/********************
@ -725,6 +710,7 @@ void sgwc_s5c_handle_update_bearer_request(
s11_xact = ogs_gtp_xact_local_create(
sgwc_ue->gnode, &message->h, pkbuf, bearer_timeout, bearer);
ogs_expect_or_return(s11_xact);
s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
ogs_gtp_xact_associate(s5c_xact, s11_xact);
} else {
@ -870,6 +856,7 @@ void sgwc_s5c_handle_delete_bearer_request(
s11_xact = ogs_gtp_xact_local_create(
sgwc_ue->gnode, &message->h, pkbuf, bearer_timeout, bearer);
ogs_expect_or_return(s11_xact);
s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
ogs_gtp_xact_associate(s5c_xact, s11_xact);
} else {

View File

@ -232,6 +232,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
if (!sess) {
ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
ogs_error("No Session");
if (!gtp_xact) {
ogs_error("No associated GTP transaction");
break;
@ -266,6 +267,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
if (!sess) {
ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
ogs_error("No Session");
if (!gtp_xact) {
ogs_error("No associated GTP transaction");
break;

View File

@ -143,6 +143,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
OGS_SETUP_GTP_NODE(sess, smf_gnode->gnode);
}
if (!sess) {
ogs_error("No Session");
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
@ -152,9 +153,11 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_fsm_dispatch(&sess->sm, e);
break;
case OGS_GTP2_DELETE_SESSION_REQUEST_TYPE:
if (!gtp2_message.h.teid_presence) ogs_error("No TEID");
smf_metrics_inst_global_inc(SMF_METR_GLOB_CTR_S5C_RX_DELETESESSIONREQ);
smf_metrics_inst_gtp_node_inc(smf_gnode->metrics, SMF_METR_GTP_NODE_CTR_S5C_RX_DELETESESSIONREQ);
if (!sess) {
ogs_error("No Session");
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
@ -164,6 +167,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_fsm_dispatch(&sess->sm, e);
break;
case OGS_GTP2_MODIFY_BEARER_REQUEST_TYPE:
if (!gtp2_message.h.teid_presence) ogs_error("No TEID");
smf_s5c_handle_modify_bearer_request(
sess, gtp_xact, recvbuf, &gtp2_message.modify_bearer_request);
break;
@ -188,6 +192,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_fsm_dispatch(&sess->sm, e);
break;
case OGS_GTP2_BEARER_RESOURCE_COMMAND_TYPE:
if (!gtp2_message.h.teid_presence) ogs_error("No TEID");
smf_s5c_handle_bearer_resource_command(
sess, gtp_xact, &gtp2_message.bearer_resource_command);
break;