[SMF] incorrect GTP cause with changed APN (#1360)

SMF setting incorrect Cause when answering
with a changed APN type IPv4v6 ->IPv4/IPv6
This commit is contained in:
Sukchan Lee 2022-02-23 20:16:04 +09:00
parent d61127afcc
commit af3db1770f
9 changed files with 51 additions and 23 deletions

View File

@ -138,7 +138,12 @@ void mme_s11_handle_create_session_response(
ogs_assert(cause);
cause_value = cause->value;
if (cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED) {
if (cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED ||
cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED_PARTIALLY ||
cause_value ==
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE ||
cause_value ==
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) {
if (rsp->bearer_contexts_created.cause.presence) {
cause = rsp->bearer_contexts_created.cause.data;
ogs_assert(cause);
@ -168,7 +173,12 @@ void mme_s11_handle_create_session_response(
}
}
if (cause_value != OGS_GTP_CAUSE_REQUEST_ACCEPTED) {
if (cause_value != OGS_GTP_CAUSE_REQUEST_ACCEPTED &&
cause_value != OGS_GTP_CAUSE_REQUEST_ACCEPTED_PARTIALLY &&
cause_value !=
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE &&
cause_value !=
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) {
if (mme_ue_from_teid && mme_ue) {
if (UE_CONTEXT_IN_ATTACH(mme_ue)) {
ogs_error("[%s] Attach reject", mme_ue->imsi_bcd);

View File

@ -144,7 +144,12 @@ void sgwc_s5c_handle_create_session_response(
sgwc_ue = sess->sgwc_ue;
ogs_assert(sgwc_ue);
if (cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED) {
if (cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED ||
cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED_PARTIALLY ||
cause_value ==
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE ||
cause_value ==
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) {
bearer = sgwc_bearer_find_by_sess_ebi(sess,
rsp->bearer_contexts_created.eps_bearer_id.u8);
if (!bearer)
@ -161,7 +166,12 @@ void sgwc_s5c_handle_create_session_response(
ogs_assert(cause);
cause_value = cause->value;
if (cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED) {
if (cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED ||
cause_value == OGS_GTP_CAUSE_REQUEST_ACCEPTED_PARTIALLY ||
cause_value ==
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE ||
cause_value ==
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) {
if (rsp->bearer_contexts_created.cause.presence) {
cause = rsp->bearer_contexts_created.cause.data;
ogs_assert(cause);
@ -179,7 +189,12 @@ void sgwc_s5c_handle_create_session_response(
cause_value = OGS_GTP_CAUSE_MANDATORY_IE_MISSING;
}
if (cause_value != OGS_GTP_CAUSE_REQUEST_ACCEPTED) {
if (cause_value != OGS_GTP_CAUSE_REQUEST_ACCEPTED &&
cause_value != OGS_GTP_CAUSE_REQUEST_ACCEPTED_PARTIALLY &&
cause_value !=
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE &&
cause_value !=
OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) {
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP_CREATE_SESSION_RESPONSE_TYPE, cause_value);

View File

@ -269,7 +269,7 @@ typedef struct smf_sess_s {
/* PDN Configuration */
ogs_session_t session;
uint8_t ue_pdu_session_type;
uint8_t ue_session_type;
uint8_t ue_ssc_mode;
ogs_pfcp_ue_ip_t *ipv4;

View File

@ -165,7 +165,7 @@ ogs_pkbuf_t *gsm_build_pdu_session_establishment_accept(smf_sess_t *sess)
}
/* GSM cause */
if (sess->ue_pdu_session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
if (sess->ue_session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
if (pdu_address->pdn_type == OGS_PDU_SESSION_TYPE_IPV4) {
pdu_session_establishment_accept->presencemask |=
OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_5GSM_CAUSE_PRESENT;

View File

@ -53,7 +53,7 @@ int gsm_handle_pdu_session_establishment_request(
if (pdu_session_establishment_request->presencemask &
OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT)
sess->ue_pdu_session_type = pdu_session_type->value;
sess->ue_session_type = pdu_session_type->value;
if (pdu_session_establishment_request->presencemask &
OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_PRESENT)

View File

@ -114,14 +114,14 @@ bool smf_nudm_sdm_handle_get(smf_sess_t *sess, ogs_sbi_stream_t *stream,
dnnConfigurationMap->key) != 0)
continue;
if (sess->ue_pdu_session_type) {
if (sess->ue_session_type) {
OpenAPI_list_for_each(
pduSessionTypeList->allowed_session_types, node2) {
if (node2->data) {
uint8_t allowed_session_type = (uintptr_t)node2->data;
if (sess->ue_pdu_session_type == allowed_session_type) {
if (sess->ue_session_type == allowed_session_type) {
sess->session.session_type =
sess->ue_pdu_session_type;
sess->ue_session_type;
break;
}
}

View File

@ -32,6 +32,7 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
ogs_gtp_create_session_response_t *rsp = NULL;
ogs_gtp_cause_t cause;
ogs_gtp_cause_t bearer_cause;
ogs_gtp_f_teid_t smf_s5c_teid, pgw_s5u_teid;
ogs_gtp_ambr_t ambr;
ogs_gtp_bearer_qos_t bearer_qos;
@ -56,11 +57,14 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
/* Set Cause */
memset(&cause, 0, sizeof(cause));
cause.value = OGS_GTP_CAUSE_REQUEST_ACCEPTED;
rsp->cause.presence = 1;
rsp->cause.len = sizeof(cause);
rsp->cause.data = &cause;
cause.value = OGS_GTP_CAUSE_REQUEST_ACCEPTED;
if (sess->ue_session_type != sess->session.session_type)
cause.value = OGS_GTP_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE;
/* Control Plane(UL) : SMF-S5C */
memset(&smf_s5c_teid, 0, sizeof(ogs_gtp_f_teid_t));
switch (sess->gtp_rat_type) {
@ -139,9 +143,11 @@ ogs_pkbuf_t *smf_s5c_build_create_session_response(
rsp->bearer_contexts_created.eps_bearer_id.u8 = bearer->ebi;
/* Bearer Cause */
memset(&bearer_cause, 0, sizeof(bearer_cause));
rsp->bearer_contexts_created.cause.presence = 1;
rsp->bearer_contexts_created.cause.len = sizeof(cause);
rsp->bearer_contexts_created.cause.data = &cause;
rsp->bearer_contexts_created.cause.len = sizeof(bearer_cause);
rsp->bearer_contexts_created.cause.data = &bearer_cause;
bearer_cause.value = OGS_GTP_CAUSE_REQUEST_ACCEPTED;
/* Bearer QoS
* if PCRF changes Bearer QoS, this should be included. */

View File

@ -210,7 +210,12 @@ void smf_s5c_handle_create_session_request(
/* UE IP Address */
paa = req->pdn_address_allocation.data;
ogs_assert(paa);
sess->session.session_type = paa->session_type;
/* Store UE Session Type (IPv4, IPv6, IPv4v6) */
sess->ue_session_type = paa->session_type;
/* Initially Set Session Type from UE */
sess->session.session_type = sess->ue_session_type;
rv = ogs_gtp_paa_to_ip(paa, &sess->session.ue_ip);
ogs_assert(rv == OGS_OK);

View File

@ -183,14 +183,10 @@ ogs_pkbuf_t *test_sgsap_downlink_unitdata(int i)
const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
"0701089910073746 0000061626090123 0100079144775810 0650001700048032"
"2400009160404044 150009c8329bfd06 4d9b53",
"",
"",
};
uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
51,
0,
0,
};
char hexbuf[OGS_MAX_SDU_LEN];
@ -208,14 +204,10 @@ ogs_pkbuf_t *test_sgsap_mm_information_request(int i)
const char *payload[TEST_SGSAP_MAX_MESSAGE] = {
"1a01087942120000 0000301714430483 d46413450483d464 1347917071028401"
"29",
"",
"",
};
uint16_t len[TEST_SGSAP_MAX_MESSAGE] = {
33,
0,
0,
};
char hexbuf[OGS_MAX_SDU_LEN];