fix: Derive ESM cause from GTP-Cause (#755)

This commit is contained in:
Sukchan Lee
2021-01-10 23:36:12 -05:00
parent d6ed13968d
commit 5fb0611cb2
19 changed files with 200 additions and 134 deletions

View File

@@ -210,7 +210,6 @@ typedef struct test_service_request_param_s {
};
uint8_t value;
};
uint8_t service_type;
struct {
uint16_t pdu_session_status;
uint16_t uplink_data_status;

View File

@@ -231,7 +231,7 @@ ogs_pkbuf_t *testgmm_build_registration_complete(test_ue_t *test_ue)
}
ogs_pkbuf_t *testgmm_build_service_request(
test_ue_t *test_ue, ogs_pkbuf_t *nasbuf)
test_ue_t *test_ue, uint8_t service_type, ogs_pkbuf_t *nasbuf)
{
ogs_nas_5gs_message_t message;
ogs_pkbuf_t *pkbuf = NULL;
@@ -268,7 +268,7 @@ ogs_pkbuf_t *testgmm_build_service_request(
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM;
message.gmm.h.message_type = OGS_NAS_5GS_SERVICE_REQUEST;
service_request->ngksi.type = test_ue->service_request_param.service_type;
service_request->ngksi.type = service_type;
service_request->ngksi.tsc = test_ue->nas.tsc;
service_request->ngksi.value = test_ue->nas.ksi;

View File

@@ -29,7 +29,7 @@ ogs_pkbuf_t *testgmm_build_registration_request(
ogs_pkbuf_t *testgmm_build_registration_complete(test_ue_t *test_ue);
ogs_pkbuf_t *testgmm_build_service_request(
test_ue_t *test_ue, ogs_pkbuf_t *nasbuf);
test_ue_t *test_ue, uint8_t service_type, ogs_pkbuf_t *nasbuf);
ogs_pkbuf_t *testgmm_build_de_registration_request(
test_ue_t *test_ue, bool switch_off);

View File

@@ -324,14 +324,15 @@ static void test1_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.pdu_session_status = 1;
test_ue->service_request_param.psimask.pdu_session_status =
1 << sess->psi;
nasbuf = testgmm_build_service_request(test_ue, NULL);
test_ue->service_request_param.psimask.pdu_session_status = 1 << sess->psi;
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);
@@ -400,16 +401,17 @@ static void test1_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.uplink_data_status = 1;
test_ue->service_request_param.
psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.pdu_session_status = 0;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.uplink_data_status = 0;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);
@@ -733,12 +735,14 @@ static void test2_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.pdu_session_status = 1;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);
ABTS_PTR_NOTNULL(tc, sendbuf);
@@ -1085,18 +1089,18 @@ static void test3_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.uplink_data_status = 1;
test_ue->service_request_param.psimask.uplink_data_status =
1 << sess->psi;
test_ue->service_request_param.psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.pdu_session_status = 1;
test_ue->service_request_param.psimask.pdu_session_status =
1 << sess->psi;
nasbuf = testgmm_build_service_request(test_ue, NULL);
test_ue->service_request_param.psimask.pdu_session_status = 1 << sess->psi;
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.uplink_data_status = 0;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);
@@ -1149,9 +1153,9 @@ static void test3_func(abts_case *tc, void *data)
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.ciphered = 1;
test_ue->service_request_param.uplink_data_status = 1;
test_ue->service_request_param.psimask.uplink_data_status =
1 << sess->psi;
gmmbuf = testgmm_build_service_request(test_ue, NULL);
test_ue->service_request_param.psimask.uplink_data_status = 1 << sess->psi;
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf);
@@ -1488,12 +1492,14 @@ static void test4_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.pdu_session_status = 1;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, false);
@@ -1565,18 +1571,18 @@ static void test4_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.uplink_data_status = 1;
test_ue->service_request_param.psimask.uplink_data_status =
1 << sess->psi;
test_ue->service_request_param.psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.pdu_session_status = 1;
test_ue->service_request_param.psimask.pdu_session_status =
1 << sess->psi;
nasbuf = testgmm_build_service_request(test_ue, NULL);
test_ue->service_request_param.psimask.pdu_session_status = 1 << sess->psi;
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.uplink_data_status = 0;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);
@@ -1632,7 +1638,8 @@ static void test4_func(abts_case *tc, void *data)
test_ue->service_request_param.pdu_session_status = 1;
test_ue->service_request_param.psimask.pdu_session_status =
1 << sess->psi;
gmmbuf = testgmm_build_service_request(test_ue, NULL);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, NULL);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf);
@@ -1682,7 +1689,8 @@ static void test4_func(abts_case *tc, void *data)
test_ue->service_request_param.pdu_session_status = 1;
test_ue->service_request_param.psimask.pdu_session_status =
1 << sess->psi;
gmmbuf = testgmm_build_service_request(test_ue, NULL);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, NULL);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf);
@@ -2041,12 +2049,14 @@ static void test5_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.pdu_session_status = 1;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);
@@ -2497,16 +2507,17 @@ static void test6_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.uplink_data_status = 1;
test_ue->service_request_param.
psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.pdu_session_status = 0;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.uplink_data_status = 0;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);

View File

@@ -1386,14 +1386,15 @@ static void test4_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.pdu_session_status = 1;
test_ue->service_request_param.psimask.pdu_session_status =
1 << sess->psi;
nasbuf = testgmm_build_service_request(test_ue, NULL);
test_ue->service_request_param.psimask.pdu_session_status = 1 << sess->psi;
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_SIGNALLING, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, false);
@@ -1441,16 +1442,17 @@ static void test4_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.uplink_data_status = 1;
test_ue->service_request_param.
psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.pdu_session_status = 0;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.uplink_data_status = 0;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, false);

View File

@@ -418,16 +418,17 @@ static void test1_func(abts_case *tc, void *data)
*/
test_ue->service_request_param.integrity_protected = 0;
test_ue->service_request_param.uplink_data_status = 1;
test_ue->service_request_param.
psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.psimask.uplink_data_status = 1 << sess->psi;
test_ue->service_request_param.pdu_session_status = 0;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.uplink_data_status = 0;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);

View File

@@ -464,13 +464,15 @@ static void test1_func(abts_case *tc, void *data)
test_ue->service_request_param.
psimask.uplink_data_status = (1 << 5 | 1 << 6);
test_ue->service_request_param.pdu_session_status = 0;
nasbuf = testgmm_build_service_request(test_ue, NULL);
nasbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, NULL);
ABTS_PTR_NOTNULL(tc, nasbuf);
test_ue->service_request_param.integrity_protected = 1;
test_ue->service_request_param.uplink_data_status = 0;
test_ue->service_request_param.pdu_session_status = 0;
gmmbuf = testgmm_build_service_request(test_ue, nasbuf);
gmmbuf = testgmm_build_service_request(
test_ue, OGS_NAS_SERVICE_TYPE_DATA, nasbuf);
ABTS_PTR_NOTNULL(tc, gmmbuf);
sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, true, true);