Skip to content

Commit

Permalink
[SMF] Gy: Tear down session when CCR-Update is rejected by OCS
Browse files Browse the repository at this point in the history
  • Loading branch information
pespin committed Mar 19, 2024
1 parent f66c65b commit 1d40517
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
21 changes: 21 additions & 0 deletions src/smf/gsm-sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
ogs_pfcp_xact_t *pfcp_xact = NULL;
ogs_pfcp_message_t *pfcp_message = NULL;

ogs_diam_gy_message_t *gy_message = NULL;
uint32_t diam_err;

ogs_nas_5gs_message_t *nas_message = NULL;

ogs_sbi_stream_t *stream = NULL;
Expand Down Expand Up @@ -829,6 +832,24 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
}
break;

case SMF_EVT_GY_MESSAGE:
gy_message = e->gy_message;
ogs_assert(gy_message);

switch(gy_message->cmd_code) {
case OGS_DIAM_GY_CMD_CODE_CREDIT_CONTROL:
switch (gy_message->cc_request_type) {
case OGS_DIAM_GY_CC_REQUEST_TYPE_UPDATE_REQUEST:
ogs_assert(e->pfcp_xact);
diam_err = smf_gy_handle_cca_update_request(sess, gy_message, e->pfcp_xact);
if (diam_err != ER_DIAMETER_SUCCESS)
OGS_FSM_TRAN(s, smf_gsm_state_wait_pfcp_deletion);
break;
}
break;
}
break;

case OGS_EVENT_SBI_SERVER:
sbi_message = e->h.sbi.message;
ogs_assert(sbi_message);
Expand Down
9 changes: 4 additions & 5 deletions src/smf/gy-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ uint32_t smf_gy_handle_cca_initial_request(
return ER_DIAMETER_SUCCESS;
}

void smf_gy_handle_cca_update_request(
uint32_t smf_gy_handle_cca_update_request(
smf_sess_t *sess, ogs_diam_gy_message_t *gy_message,
ogs_pfcp_xact_t *pfcp_xact)
{
Expand All @@ -175,10 +175,8 @@ void smf_gy_handle_cca_update_request(
if (gy_message->result_code != ER_DIAMETER_SUCCESS) {
ogs_warn("Gy CCA Update Diameter failure: res=%u err=%u",
gy_message->result_code, *gy_message->err);
// TODO: generate new gtp_xact from sess here? */
//ogs_assert(OGS_OK ==
// smf_epc_pfcp_send_session_deletion_request(sess, gtp_xact));
return;
return gy_message->err ? *gy_message->err :
ER_DIAMETER_AUTHENTICATION_REJECTED;
}

bearer = smf_default_bearer_in_sess(sess);
Expand Down Expand Up @@ -234,6 +232,7 @@ void smf_gy_handle_cca_update_request(
OGS_GTP1_CAUSE_REACTIACTION_REQUESTED);
ogs_assert(rv == OGS_OK);
}
return ER_DIAMETER_SUCCESS;
}

uint32_t smf_gy_handle_cca_termination_request(
Expand Down
2 changes: 1 addition & 1 deletion src/smf/gy-handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern "C" {
uint32_t smf_gy_handle_cca_initial_request(
smf_sess_t *sess, ogs_diam_gy_message_t *gy_message,
ogs_gtp_xact_t *gtp_xact);
void smf_gy_handle_cca_update_request(
uint32_t smf_gy_handle_cca_update_request(
smf_sess_t *sess, ogs_diam_gy_message_t *gy_message,
ogs_pfcp_xact_t *pfcp_xact);
uint32_t smf_gy_handle_cca_termination_request(
Expand Down
18 changes: 1 addition & 17 deletions src/smf/smf-sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,23 +328,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)

switch(gy_message->cmd_code) {
case OGS_DIAM_GY_CMD_CODE_CREDIT_CONTROL:
switch(gy_message->cc_request_type) {
case OGS_DIAM_GY_CC_REQUEST_TYPE_INITIAL_REQUEST:
ogs_fsm_dispatch(&sess->sm, e);
break;
case OGS_DIAM_GY_CC_REQUEST_TYPE_UPDATE_REQUEST:
ogs_assert(e->pfcp_xact);
smf_gy_handle_cca_update_request(
sess, gy_message, e->pfcp_xact);
break;
case OGS_DIAM_GY_CC_REQUEST_TYPE_TERMINATION_REQUEST:
ogs_fsm_dispatch(&sess->sm, e);
break;
default:
ogs_error("Not implemented(%d)", gy_message->cc_request_type);
break;
}

ogs_fsm_dispatch(&sess->sm, e);
break;
case OGS_DIAM_GY_CMD_RE_AUTH:
smf_gy_handle_re_auth_request(sess, gy_message);
Expand Down

0 comments on commit 1d40517

Please sign in to comment.