Skip to content

Commit

Permalink
[MME] incorrect behavior of the SGsAP
Browse files Browse the repository at this point in the history
1. According to ETSI TS 129 118 4.1, if the Network Access Mode (NAM) is set
   to "Packet only," no SGs association should be established.

2. If the NAM is set to "Packet and Circuit," and the SGs association is
   rejected by the CS core, this rejection should only impact
   the SGs association itself and not result in a UE attach rejection
   for a UE with a valid HSS account.
  • Loading branch information
acetcom committed Mar 24, 2024
1 parent 7c14073 commit 390a9dd
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/_docs/tutorial/01-your-first-lte.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ Change back to the srsRAN source directory and copy the main config example as w
```bash
$ cp srsenb/enb.conf.example srsenb/enb.conf
$ cp srsenb/rr.conf.example srsenb/rr.conf
$ cp srsenb/drb.conf.example srsenb/drb.conf
$ cp srsenb/rb.conf.example srsenb/rb.conf
$ cp srsenb/sib.conf.example srsenb/sib.conf
```

Expand Down
12 changes: 8 additions & 4 deletions src/mme/esm-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,17 @@ int esm_handle_information_response(mme_sess_t *sess,
mme_csmap_t *csmap = mme_csmap_find_by_tai(&mme_ue->tai);
mme_ue->csmap = csmap;

if (csmap) {
ogs_assert(OGS_OK ==
sgsap_send_location_update_request(mme_ue));
} else {
if (!csmap ||
mme_ue->network_access_mode ==
OGS_NETWORK_ACCESS_MODE_ONLY_PACKET ||
mme_ue->nas_eps.attach.value ==
OGS_NAS_ATTACH_TYPE_EPS_ATTACH) {
r = nas_eps_send_attach_accept(mme_ue);
ogs_expect(r == OGS_OK);
ogs_assert(r != OGS_ERROR);
} else {
ogs_assert(OGS_OK ==
sgsap_send_location_update_request(mme_ue));
}
} else {
ogs_assert(OGS_OK ==
Expand Down
15 changes: 9 additions & 6 deletions src/mme/mme-s11-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,20 @@ void mme_s11_handle_create_session_response(
mme_csmap_t *csmap = mme_csmap_find_by_tai(&mme_ue->tai);
mme_ue->csmap = csmap;

if (csmap) {
ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(
session->paa.session_type));
ogs_assert(OGS_OK ==
sgsap_send_location_update_request(mme_ue));
} else {
if (!csmap ||
mme_ue->network_access_mode ==
OGS_NETWORK_ACCESS_MODE_ONLY_PACKET ||
mme_ue->nas_eps.attach.value ==
OGS_NAS_ATTACH_TYPE_EPS_ATTACH) {
ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(
session->paa.session_type));
r = nas_eps_send_attach_accept(mme_ue);
ogs_expect(r == OGS_OK);
ogs_assert(r != OGS_ERROR);
} else {
ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(
session->paa.session_type));
ogs_assert(OGS_OK == sgsap_send_location_update_request(mme_ue));
}

} else if (create_action == OGS_GTP_CREATE_IN_TRACKING_AREA_UPDATE) {
Expand Down
4 changes: 1 addition & 3 deletions src/mme/sgsap-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,9 @@ void sgsap_handle_location_update_reject(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
ogs_plmn_id_hexdump(&lai->nas_plmn_id), lai->lac);
}

r = nas_eps_send_attach_reject(mme_ue->enb_ue, mme_ue,
emm_cause, OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
r = nas_eps_send_attach_accept(mme_ue);
ogs_expect(r == OGS_OK);
ogs_assert(r != OGS_ERROR);
mme_send_delete_session_or_mme_ue_context_release(mme_ue);

return;

Expand Down
75 changes: 74 additions & 1 deletion tests/csfb/mo-idle-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,84 @@ static void test2_func(abts_case *tc, void *data)
rv = testvlr_sgsap_send(sgsap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Receive Attach Reject */
/* Receive Initial Context Setup Request +
* Attach Accept +
* Activate Default Bearer Context Request */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);

/* Send Initial Context Setup Response */
sendbuf = test_s1ap_build_initial_context_setup_response(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Send Attach Complete + Activate default EPS bearer cotext accept */
test_ue->nr_cgi.cell_id = 0x1234502;
bearer = test_bearer_find_by_ue_ebi(test_ue, 5);
ogs_assert(bearer);
esmbuf = testesm_build_activate_default_eps_bearer_context_accept(
bearer, false);
ABTS_PTR_NOTNULL(tc, esmbuf);
emmbuf = testemm_build_attach_complete(test_ue, esmbuf);
ABTS_PTR_NOTNULL(tc, emmbuf);
sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, emmbuf);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Receive EMM information */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);

/* Send UE Context Release Request */
sendbuf = test_s1ap_build_ue_context_release_request(test_ue,
S1AP_Cause_PR_radioNetwork, S1AP_CauseRadioNetwork_user_inactivity);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Receive UE Context Release Command */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);

/* Send UE Context Release Complete */
sendbuf = test_s1ap_build_ue_context_release_complete(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Send Service Request */
emmbuf = testemm_build_service_request(test_ue);
ABTS_PTR_NOTNULL(tc, emmbuf);
sendbuf = test_s1ap_build_initial_ue_message(
test_ue, emmbuf, S1AP_RRC_Establishment_Cause_mo_Data, true);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Receive Initial Context Setup Request */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);

/* Send Initial Context Setup Response */
sendbuf = test_s1ap_build_initial_context_setup_response(test_ue);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Send Detach Request */
emmbuf = testemm_build_detach_request(test_ue, 1, true, true);
ABTS_PTR_NOTNULL(tc, emmbuf);
sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, emmbuf);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);

/* Receive UE Context Release Command */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
Expand Down

0 comments on commit 390a9dd

Please sign in to comment.