Revert "[SGWC] pfcp: Retrieve sess when SEID=0 (#1620)"

This reverts commit 9700563023.
This commit is contained in:
Sukchan Lee 2022-06-30 09:11:38 +09:00
parent 6332f10593
commit 0be5e765c8
5 changed files with 108 additions and 31 deletions

View File

@ -212,8 +212,6 @@ int sgwc_pfcp_send_bearer_to_modify_list(
ogs_assert(sess);
ogs_assert(xact);
xact->local_seid = sess->sgwc_sxa_seid;
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
h.seid = sess->sgwu_sxa_seid;
@ -248,7 +246,6 @@ 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;
@ -314,7 +311,6 @@ 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);
@ -352,7 +348,6 @@ 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;
@ -378,7 +373,6 @@ int sgwc_pfcp_send_session_report_response(
ogs_pfcp_header_t h;
ogs_assert(xact);
xact->local_seid = sess->sgwc_sxa_seid;
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE;

View File

@ -183,16 +183,8 @@ 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:
@ -216,32 +208,44 @@ 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)
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
sgwc_sxa_handle_session_establishment_response(
sess, xact, e->gtp_message,
&message->pfcp_session_establishment_response);
break;
case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE:
if (!message->h.seid_presence)
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
sgwc_sxa_handle_session_modification_response(
sess, xact, e->gtp_message,
&message->pfcp_session_modification_response);
break;
case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE:
if (!message->h.seid_presence)
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
sgwc_sxa_handle_session_deletion_response(
sess, xact, e->gtp_message,
&message->pfcp_session_deletion_response);
break;
case OGS_PFCP_SESSION_REPORT_REQUEST_TYPE:
if (!message->h.seid_presence)
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
sgwc_sxa_handle_session_report_request(
sess, xact, &message->pfcp_session_report_request);
break;

View File

@ -157,7 +157,6 @@ void sgwc_sxa_handle_session_establishment_response(
ogs_debug("Session Establishment Response");
ogs_assert(sess);
ogs_assert(pfcp_xact);
ogs_assert(pfcp_rsp);
ogs_assert(recv_message);
@ -172,6 +171,11 @@ void sgwc_sxa_handle_session_establishment_response(
cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
if (!sess) {
ogs_warn("No Context");
cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
}
if (pfcp_rsp->up_f_seid.presence == 0) {
ogs_error("No UP F-SEID");
cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
@ -447,7 +451,6 @@ void sgwc_sxa_handle_session_modification_response(
ogs_debug("Session Modification Response");
ogs_assert(sess);
ogs_assert(pfcp_xact);
ogs_assert(pfcp_rsp);
@ -457,12 +460,30 @@ void sgwc_sxa_handle_session_modification_response(
cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
if (flags & OGS_PFCP_MODIFY_SESSION) {
if (!sess) {
ogs_warn("No Context");
sess = pfcp_xact->data;
ogs_assert(sess);
cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
}
sgwc_ue = sess->sgwc_ue;
ogs_assert(sgwc_ue);
} else {
bearer = pfcp_xact->data;
ogs_assert(bearer);
if (!sess) {
ogs_warn("No Context");
sess = bearer->sess;
ogs_assert(sess);
cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
}
sgwc_ue = bearer->sgwc_ue;
ogs_assert(sgwc_ue);
}
@ -1181,12 +1202,16 @@ void sgwc_sxa_handle_session_deletion_response(
ogs_debug("Session Deletion Response");
ogs_assert(sess);
ogs_assert(pfcp_xact);
ogs_assert(pfcp_rsp);
cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
if (!sess) {
ogs_warn("No Context");
cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
}
if (pfcp_rsp->cause.presence) {
if (pfcp_rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
ogs_warn("PFCP Cause[%d] : Not Accepted", pfcp_rsp->cause.u8);
@ -1295,12 +1320,16 @@ void sgwc_sxa_handle_session_report_request(
ogs_debug("Session Report Request");
ogs_assert(sess);
ogs_assert(pfcp_xact);
ogs_assert(pfcp_req);
cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
if (!sess) {
ogs_warn("No Context");
cause_value = OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND;
}
if (pfcp_req->report_type.presence == 0) {
ogs_error("No Report Type");
cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;

View File

@ -255,7 +255,6 @@ void smf_5gc_n4_handle_session_modification_response(
ogs_debug("Session Modification Response [5gc]");
ogs_assert(sess);
ogs_assert(xact);
ogs_assert(rsp);
@ -280,6 +279,11 @@ void smf_5gc_n4_handle_session_modification_response(
status = OGS_SBI_HTTP_STATUS_OK;
if (!sess) {
ogs_warn("No Context");
status = OGS_SBI_HTTP_STATUS_NOT_FOUND;
}
if (rsp->cause.presence) {
if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
ogs_warn("PFCP Cause [%d] : Not Accepted", rsp->cause.u8);
@ -620,7 +624,10 @@ int smf_5gc_n4_handle_session_deletion_response(
status = OGS_SBI_HTTP_STATUS_OK;
ogs_assert(sess);
if (!sess) {
ogs_warn("No Context");
status = OGS_SBI_HTTP_STATUS_NOT_FOUND;
}
if (rsp->cause.presence) {
if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
@ -662,6 +669,8 @@ int smf_5gc_n4_handle_session_deletion_response(
return status;
}
ogs_assert(sess);
return status;
}
@ -794,7 +803,6 @@ void smf_epc_n4_handle_session_modification_response(
OGS_LIST(pdr_to_create_list);
ogs_assert(sess);
ogs_assert(xact);
ogs_assert(rsp);
@ -823,6 +831,11 @@ void smf_epc_n4_handle_session_modification_response(
ogs_pfcp_xact_commit(xact);
if (!sess) {
ogs_error("No Context");
return;
}
if (rsp->cause.presence) {
if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
ogs_error("PFCP Cause [%d] : Not Accepted", rsp->cause.u8);
@ -1098,7 +1111,6 @@ void smf_n4_handle_session_report_request(
uint16_t pdr_id = 0;
unsigned int i;
ogs_assert(sess);
ogs_assert(pfcp_xact);
ogs_assert(pfcp_req);
@ -1106,6 +1118,11 @@ void smf_n4_handle_session_report_request(
cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
if (!sess) {
ogs_warn("No Context");
cause_value = OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND;
}
if (pfcp_req->report_type.presence == 0) {
ogs_error("No Report Type");
cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
@ -1118,6 +1135,7 @@ void smf_n4_handle_session_report_request(
return;
}
ogs_assert(sess);
report_type.value = pfcp_req->report_type.u8;
if (report_type.downlink_data_report) {

View File

@ -222,13 +222,28 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE:
if (!message->h.seid_presence)
ogs_error("No SEID");
ogs_assert(sess);
if (!sess) {
ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
ogs_assert(gtp_xact);
if (gtp_xact->gtp_version == 1)
ogs_gtp1_send_error_message(gtp_xact, 0,
OGS_GTP1_CREATE_PDP_CONTEXT_RESPONSE_TYPE,
OGS_GTP1_CAUSE_CONTEXT_NOT_FOUND);
else
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
break;
}
ogs_fsm_dispatch(&sess->sm, e);
break;
case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE:
if (!message->h.seid_presence)
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
if (xact->epc)
smf_epc_n4_handle_session_modification_response(
sess, xact, e->gtp2_message,
@ -241,13 +256,30 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE:
if (!message->h.seid_presence)
ogs_error("No SEID");
ogs_assert(sess);
if (!sess) {
ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
if (!gtp_xact)
break;
if (gtp_xact->gtp_version == 1)
ogs_gtp1_send_error_message(gtp_xact, 0,
OGS_GTP1_CREATE_PDP_CONTEXT_RESPONSE_TYPE,
OGS_GTP1_CAUSE_CONTEXT_NOT_FOUND);
else
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
break;
}
ogs_fsm_dispatch(&sess->sm, e);
break;
case OGS_PFCP_SESSION_REPORT_REQUEST_TYPE:
if (!message->h.seid_presence)
if (!message->h.seid_presence) {
ogs_error("No SEID");
break;
}
smf_n4_handle_session_report_request(
sess, xact, &message->pfcp_session_report_request);
break;