[PFCP] Refine error code path without assertion

Refer to #1635, #1620
This commit is contained in:
Sukchan Lee 2022-06-30 10:35:03 +09:00
parent 0be5e765c8
commit b1d982a1ee
6 changed files with 25 additions and 31 deletions

View File

@ -246,6 +246,7 @@ int sgwc_pfcp_send_session_establishment_request(
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
}
xact->local_seid = sess->sgwc_sxa_seid;
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE;
@ -281,6 +282,7 @@ int sgwc_pfcp_send_session_modification_request(
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
}
xact->local_seid = sess->sgwc_sxa_seid;
ogs_list_for_each(&sess->bearer_list, bearer)
ogs_list_add(&xact->bearer_to_modify_list, &bearer->to_modify_node);
@ -311,6 +313,7 @@ int sgwc_pfcp_send_bearer_modification_request(
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
}
xact->local_seid = sess->sgwc_sxa_seid;
ogs_list_add(&xact->bearer_to_modify_list, &bearer->to_modify_node);
@ -348,6 +351,7 @@ int sgwc_pfcp_send_session_deletion_request(
xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
}
xact->local_seid = sess->sgwc_sxa_seid;
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_DELETION_REQUEST_TYPE;

View File

@ -183,8 +183,16 @@ void sgwc_pfcp_state_associated(ogs_fsm_t *s, sgwc_event_t *e)
xact = e->pfcp_xact;
ogs_assert(xact);
if (message->h.seid_presence && message->h.seid != 0)
if (message->h.seid_presence && message->h.seid != 0) {
sess = sgwc_sess_find_by_seid(message->h.seid);
} else if (xact->local_seid) { /* rx no SEID or SEID=0 */
/* 3GPP TS 29.244 7.2.2.4.2: we receive SEID=0 under some
* conditions, such as cause "Session context not found". In those
* cases, we still want to identify the local session which
* originated the message, so try harder by using the SEID we
* locacally stored in xact when sending the original request: */
sess = sgwc_sess_find_by_seid(xact->local_seid);
}
switch (message->h.type) {
case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
@ -208,10 +216,7 @@ void sgwc_pfcp_state_associated(ogs_fsm_t *s, sgwc_event_t *e)
&message->pfcp_association_setup_response);
break;
case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE:
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
if (!message->h.seid_presence) ogs_error("No SEID");
sgwc_sxa_handle_session_establishment_response(
sess, xact, e->gtp_message,
@ -219,10 +224,7 @@ void sgwc_pfcp_state_associated(ogs_fsm_t *s, sgwc_event_t *e)
break;
case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE:
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
if (!message->h.seid_presence) ogs_error("No SEID");
sgwc_sxa_handle_session_modification_response(
sess, xact, e->gtp_message,
@ -230,10 +232,7 @@ void sgwc_pfcp_state_associated(ogs_fsm_t *s, sgwc_event_t *e)
break;
case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE:
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
if (!message->h.seid_presence) ogs_error("No SEID");
sgwc_sxa_handle_session_deletion_response(
sess, xact, e->gtp_message,
@ -241,10 +240,7 @@ void sgwc_pfcp_state_associated(ogs_fsm_t *s, sgwc_event_t *e)
break;
case OGS_PFCP_SESSION_REPORT_REQUEST_TYPE:
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
if (!message->h.seid_presence) ogs_error("No SEID");
sgwc_sxa_handle_session_report_request(
sess, xact, &message->pfcp_session_report_request);

View File

@ -480,6 +480,7 @@ void sgwc_s11_handle_modify_bearer_request(
current_xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
ogs_assert(current_xact->gtpbuf);
}
current_xact->local_seid = sess->sgwc_sxa_seid;
ogs_list_add(&pfcp_xact_list, &current_xact->tmpnode);
}

View File

@ -329,8 +329,6 @@ int smf_pfcp_send_modify_list(
ogs_assert(sess);
ogs_assert(xact);
xact->local_seid = sess->smf_n4_seid;
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
h.seid = sess->upf_n4_seid;

View File

@ -220,8 +220,8 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
&message->pfcp_association_setup_response);
break;
case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE:
if (!message->h.seid_presence)
ogs_error("No SEID");
if (!message->h.seid_presence) ogs_error("No SEID");
if (!sess) {
ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
ogs_assert(gtp_xact);
@ -239,10 +239,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
break;
case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE:
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
if (!message->h.seid_presence) ogs_error("No SEID");
if (xact->epc)
smf_epc_n4_handle_session_modification_response(
@ -254,8 +251,8 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
break;
case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE:
if (!message->h.seid_presence)
ogs_error("No SEID");
if (!message->h.seid_presence) ogs_error("No SEID");
if (!sess) {
ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
if (!gtp_xact)
@ -275,10 +272,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
break;
case OGS_PFCP_SESSION_REPORT_REQUEST_TYPE:
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
if (!message->h.seid_presence) ogs_error("No SEID");
smf_n4_handle_session_report_request(
sess, xact, &message->pfcp_session_report_request);

View File

@ -556,6 +556,7 @@ void smf_s5c_handle_modify_bearer_request(
pfcp_xact->gtp_pti = OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED;
pfcp_xact->gtp_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
pfcp_xact->local_seid = sess->smf_n4_seid;
ogs_assert(gtpbuf);
pfcp_xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);