open5gs/tests/csfb/abts-main.c
Sukchan Lee ae2a3255a5 [CSFB] Fix Location Update for non-EPS (#3381)
While experimenting with CSFB, it was observed that when the UE returns
to E-UTRAN after a CS call, the UE performs a Tracking Area Update
with a combined Tracking Area/Location Area update and IMSI attach.
Currently, Open5GS's MME simply responds with a TAU Accept message
but does not inform the MSC/VLR.

As a result, no further MT (Mobile Terminated) CS/SMS services are possible
in cases where the MSC/VLR only attempts paging on GERAN.
However, some MSC/VLR implementations with fast fallback may still attempt
paging on E-UTRAN, allowing MT CS/SMS services to function intermittently.

According to 3GPP TS 29.118 Section 5.2.2 Procedures in the MME,
specifically Section 5.2.2.2.1, if the timer Ts6-1 is not running,
the MME shall start the location update for non-EPS services procedure
upon receiving a combined Tracking Area Update Request indicating
combined TA/LA updating with IMSI attach. However, SGs timers are not
implemented in Open5GS, which is a separate issue.

To comply with the specification and ensure that the MSC/VLR is informed
when the UE becomes reachable via SGs, the following changes have been
implemented:

1. Delay UEContextReleaseCommand:

When the active_flag is set to 0, the UEContextReleaseCommand is now delayed
until the MME receives the TAU Complete message from the UE. This ensures
that the UE has acknowledged the new P-TMSI before the network releases
the context, maintaining proper synchronization between the UE and the network.

2. Include Mobile Identity Only When P-TMSI Changes:

The Mobile Identity is now included in the Attach/TAU Accept messages
only when the MSC/VLR updates the P-TMSI. This ensures that the UE receives
the Mobile Identity information solely when there is an actual change
in the P-TMSI, preventing unnecessary or incorrect handling
of TAU Complete messages.

3. Send SGsAP-REALLOCATION-COMPLETE Conditionally:

The SGsAP-REALLOCATION-COMPLETE message is now sent to the MSC/VLR
only upon receiving a Attach/TAU Complete message from the UE.
This confirmation indicates that the UE has successfully updated its P-TMSI,
ensuring that the MSC/VLR is accurately informed of the change.

4. Handle P-TMSI Confirmation:

When the MSC/VLR updates the P-TMSI, Open5GS stores the new P-TMSI
in the next field of the mme_ue structure. Upon receiving the TAU Complete
message from the UE, indicating acknowledgment of the new P-TMSI,
Open5GS confirms the update by transferring the P-TMSI from the next field
to the current field. This ensures that the MME maintains an accurate and
up-to-date record of the P-TMSI as confirmed by the UE.
2024-11-05 16:37:45 +09:00

87 lines
2.1 KiB
C

/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "test-app.h"
abts_suite *test_mo_idle(abts_suite *suite);
abts_suite *test_mt_idle(abts_suite *suite);
abts_suite *test_mo_active(abts_suite *suite);
abts_suite *test_mt_active(abts_suite *suite);
abts_suite *test_mo_sms(abts_suite *suite);
abts_suite *test_mt_sms(abts_suite *suite);
abts_suite *test_tau(abts_suite *suite);
abts_suite *test_crash(abts_suite *suite);
const struct testlist {
abts_suite *(*func)(abts_suite *suite);
} alltests[] = {
{test_mo_idle},
{test_mt_idle},
{test_mo_active},
{test_mt_active},
{test_mo_sms},
{test_mt_sms},
{test_tau},
{test_crash},
{NULL},
};
ogs_socknode_t *sgsap = NULL;
static void terminate(void)
{
ogs_msleep(50);
test_child_terminate();
app_terminate();
testvlr_sgsap_close(sgsap);
test_epc_final();
ogs_app_terminate();
}
static void initialize(const char *const argv[])
{
int rv;
rv = ogs_app_initialize(NULL, NULL, argv);
ogs_assert(rv == OGS_OK);
test_epc_init();
sgsap = testvlr_sgsap_server("127.0.0.2");
ogs_assert(sgsap);
rv = app_initialize(argv);
ogs_assert(rv == OGS_OK);
}
int main(int argc, const char *const argv[])
{
int i;
abts_suite *suite = NULL;
atexit(terminate);
test_app_run(argc, argv, "csfb.yaml", initialize);
for (i = 0; alltests[i].func; i++)
suite = alltests[i].func(suite);
return abts_report(suite);
}