Compare commits

...

5 Commits

Author SHA1 Message Date
Sukchan Lee da5d424ed9 [MME] Incorrect behavior of SGsAP+Dedicated-Bearer (#3072)
First of all, it crashes when creating a Dedicated Bearer
on the default Session that is created for the first time.
This behavior should be possible, so the related ASSERT is removed.

Next, the InitialContextRequest is modified
during the Attach Request to include the first Bearer.

Finally, there was an issue where trying to create a Dedicated Bearer
with SGsAP enabled resulted in an InitialContextSetupRequest message
with a PTI of zero. This is because MME initializes the PTI to 0
upon receiving the Create Bearer Request while processing SGsAP.

All of these issues has been fixed.
2024-04-01 22:13:36 +09:00
Sukchan Lee d32cc14a71 [DBI] mongoc version not checked correctly #3086
checks mongoc version with

which can unexpectedly return false in case of mongoc versions such as 2.3.4.

So, I've fixed it as below.
2024-03-31 20:41:50 +09:00
Sukchan Lee e8a3b76af3 [SMF] Crash SMF when no GTP-C config (#3094)
When GTP-C secition of smf.yaml is deleted as follows to run smf as 5G,
it crashed.

```diff
--- smf.yaml.orig       2024-03-26 14:13:12.000000000 +0900
+++ smf.yaml    2024-03-26 14:29:40.701508424 +0900
@@ -23,9 +23,6 @@
     client:
       upf:
         - address: 127.0.0.7
-  gtpc:
-    server:
-      - address: 127.0.0.4
   gtpu:
     server:
       - address: 127.0.0.4
@@ -47,7 +44,7 @@
 #    - ::1
 #  ctf:
 #    enabled: auto   # auto(default)|yes|no
-  freeDiameter: /root/open5gs/install/etc/freeDiameter/smf.conf
+#  freeDiameter: /root/open5gs/install/etc/freeDiameter/smf.conf

 ################################################################################
 # SMF Info
Open5GS daemon v2.7.0-119-g581d255

03/26 14:39:42.844: [app] INFO: Configuration: 'install/etc/open5gs/smf.yaml' (../lib/app/ogs-init.c:130)
03/26 14:39:42.845: [app] INFO: File Logging: '/root/open5gs/install/var/log/open5gs/smf.log' (../lib/app/ogs-init.c:133)
03/26 14:39:42.913: [metrics] INFO: metrics_server() [http://127.0.0.4]:9090 (../lib/metrics/prometheus/context.c:299)
03/26 14:39:42.913: [smf] WARNING: No diameter configuration (../src/smf/fd-path.c:30)
03/26 14:39:42.913: [smf] FATAL: smf_gtp_open: Assertion `ogs_gtp_self()->gtpc_sock || ogs_gtp_self()->gtpc_sock6' failed. (../src/smf/gtp-path.c:253)
03/26 14:39:42.913: [core] FATAL: backtrace() returned 8 addresses (../lib/core/ogs-abort.c:37)
./install/bin/open5gs-smfd(+0x391ab) [0x55d28319b1ab]
./install/bin/open5gs-smfd(+0x10046) [0x55d283172046]
./install/bin/open5gs-smfd(+0xf3de) [0x55d2831713de]
./install/bin/open5gs-smfd(+0xfcf9) [0x55d283171cf9]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f0a145f9d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f0a145f9e40]
./install/bin/open5gs-smfd(+0xf305) [0x55d283171305]
Aborted (core dumped)
```

So, Fixed to run SMF with GTP-C disabled for 5G.
2024-03-31 20:25:25 +09:00
Oliver Smith be7d08bffc logrotate: fix reload failures
Do not attempt to run "systemctl reload" on the open5gs services, unless
they are running. This fixes the logrotate service failing on this
postrotate script, if units are not running or not installed.
2024-03-27 20:37:36 +09:00
Sukchan Lee 581d255c53 Revert "[GTP/PFCP]] incorrect dst TEI=0/SEID=0 (#3043)"
This reverts commit a667525041.
2024-03-26 08:04:26 +09:00
55 changed files with 849 additions and 506 deletions

View File

@ -8,7 +8,9 @@
postrotate
for i in nrfd scpd seppd pcrfd hssd ausfd udmd udrd upfd sgwcd sgwud smfd mmed amfd; do
systemctl reload open5gs-$i
if systemctl --quiet is-active open5gs-$i; then
systemctl reload open5gs-$i
fi
done
endscript
}

View File

@ -42,7 +42,7 @@ int ogs_dbi_msisdn_data(
"{", "imsi", BCON_UTF8(imsi_or_msisdn_bcd), "}",
"{", "msisdn", BCON_UTF8(imsi_or_msisdn_bcd), "}",
"]");
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
#if MONGOC_CHECK_VERSION(1, 5, 0)
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
#else
@ -138,7 +138,7 @@ int ogs_dbi_ims_data(char *supi, ogs_ims_data_t *ims_data)
ogs_assert(supi_id);
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
#if MONGOC_CHECK_VERSION(1, 5, 0)
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
#else

View File

@ -104,7 +104,7 @@ int ogs_mongoc_init(const char *db_uri)
return OGS_ERROR;
}
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 4
#if MONGOC_CHECK_VERSION(1, 4, 0)
mongoc_client_set_error_api(self.client, 2);
#endif
@ -182,7 +182,7 @@ void ogs_dbi_final(void)
mongoc_collection_destroy(self.collection.subscriber);
}
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
#if MONGOC_CHECK_VERSION(1, 9, 0)
if (self.stream) {
mongoc_change_stream_destroy(self.stream);
}
@ -193,7 +193,7 @@ void ogs_dbi_final(void)
int ogs_dbi_collection_watch_init(void)
{
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
#if MONGOC_CHECK_VERSION(1, 9, 0)
bson_t empty = BSON_INITIALIZER;
const bson_t *err_doc;
bson_error_t error;

View File

@ -37,7 +37,7 @@ typedef struct ogs_mongoc_s {
void *client;
void *database;
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
#if MONGOC_CHECK_VERSION(1, 9, 0)
mongoc_change_stream_t *stream;
#endif

View File

@ -50,7 +50,7 @@ int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_assert(supi_id);
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
#if MONGOC_CHECK_VERSION(1, 5, 0)
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
#else

View File

@ -44,7 +44,7 @@ int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
ogs_assert(supi_id);
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
#if MONGOC_CHECK_VERSION(1, 5, 0)
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
#else
@ -326,7 +326,7 @@ int ogs_dbi_subscription_data(char *supi,
ogs_assert(supi_id);
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
#if MONGOC_CHECK_VERSION(1, 5, 0)
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
#else

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -128,3 +128,16 @@ int ogs_gtp_sendto(ogs_gtp_node_t *gnode, ogs_pkbuf_t *pkbuf)
return OGS_OK;
}
void ogs_gtp_send_error_message(
ogs_gtp_xact_t *xact, uint32_t teid, uint8_t type, uint8_t cause_value)
{
switch (xact->gtp_version) {
case 1:
ogs_gtp1_send_error_message(xact, teid, type, cause_value);
break;
case 2:
ogs_gtp2_send_error_message(xact, teid, type, cause_value);
break;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -35,8 +35,6 @@ extern "C" {
ogs_gtp_self()->gtpc_sock6 = \
ogs_socknode_sock_first(&ogs_gtp_self()->gtpc_list6); \
\
ogs_assert(ogs_gtp_self()->gtpc_sock || ogs_gtp_self()->gtpc_sock6); \
\
if (ogs_gtp_self()->gtpc_sock) \
ogs_gtp_self()->gtpc_addr = \
&ogs_gtp_self()->gtpc_sock->local_addr; \
@ -44,8 +42,6 @@ extern "C" {
ogs_gtp_self()->gtpc_addr6 = \
&ogs_gtp_self()->gtpc_sock6->local_addr; \
\
ogs_assert(ogs_gtp_self()->gtpc_addr || ogs_gtp_self()->gtpc_addr6); \
\
} while(0)
#define OGS_SETUP_GTPU_SERVER \
@ -72,6 +68,9 @@ int ogs_gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, ogs_gtp_node_t *gnode);
int ogs_gtp_send(ogs_gtp_node_t *gnode, ogs_pkbuf_t *pkbuf);
int ogs_gtp_sendto(ogs_gtp_node_t *gnode, ogs_pkbuf_t *pkbuf);
void ogs_gtp_send_error_message(
ogs_gtp_xact_t *xact, uint32_t teid, uint8_t type, uint8_t cause_value);
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -20,7 +20,7 @@
/*******************************************************************************
* This file had been created by gtp-tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2024-03-23 07:21:22.444548 by acetcom
* Created on: 2023-08-26 16:35:12.648272 by acetcom
* from 29274-h70.docx
******************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -20,7 +20,7 @@
/*******************************************************************************
* This file had been created by gtp-tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2024-03-23 07:21:22.438775 by acetcom
* Created on: 2023-08-26 16:35:12.642445 by acetcom
* from 29274-h70.docx
******************************************************************************/
@ -44,9 +44,6 @@ typedef struct ogs_gtp2_header_s {
struct {
#define OGS_GTP2_VERSION_0 0
#define OGS_GTP2_VERSION_1 1
#define OGS_GTP2_TEID_NO_PRESENCE 0
#define OGS_GTP2_TEID_PRESENCE 1
ED4(uint8_t version:3;,
uint8_t piggybacked:1;,
uint8_t teid_presence:1;,

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -160,8 +160,8 @@ ogs_pkbuf_t *ogs_gtp2_handle_echo_req(ogs_pkbuf_t *pkb)
return pkb_resp;
}
void ogs_gtp2_send_error_message(ogs_gtp_xact_t *xact,
int teid_presence, uint32_t teid, uint8_t type, uint8_t cause_value)
void ogs_gtp2_send_error_message(
ogs_gtp_xact_t *xact, uint32_t teid, uint8_t type, uint8_t cause_value)
{
int rv;
ogs_gtp2_message_t errmsg;
@ -170,7 +170,6 @@ void ogs_gtp2_send_error_message(ogs_gtp_xact_t *xact,
ogs_pkbuf_t *pkbuf = NULL;
memset(&errmsg, 0, sizeof(ogs_gtp2_message_t));
errmsg.h.teid_presence = teid_presence;
errmsg.h.teid = teid;
errmsg.h.type = type;
@ -258,7 +257,7 @@ void ogs_gtp2_send_echo_request(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_ECHO_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_NO_PRESENCE;
h.teid = 0;
pkbuf = ogs_gtp2_build_echo_request(h.type, recovery, features);
if (!pkbuf) {
@ -285,7 +284,7 @@ void ogs_gtp2_send_echo_response(ogs_gtp_xact_t *xact,
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_ECHO_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_NO_PRESENCE;
h.teid = 0;
pkbuf = ogs_gtp2_build_echo_response(h.type, recovery, features);
if (!pkbuf) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -36,8 +36,8 @@ int ogs_gtp2_send_user_plane(
ogs_pkbuf_t *pkbuf);
ogs_pkbuf_t *ogs_gtp2_handle_echo_req(ogs_pkbuf_t *pkb);
void ogs_gtp2_send_error_message(ogs_gtp_xact_t *xact,
int teid_presence, uint32_t teid, uint8_t type, uint8_t cause_value);
void ogs_gtp2_send_error_message(
ogs_gtp_xact_t *xact, uint32_t teid, uint8_t type, uint8_t cause_value);
void ogs_gtp2_send_echo_request(
ogs_gtp_node_t *gnode, uint8_t recovery, uint8_t features);

View File

@ -1,4 +1,4 @@
# Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
# Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
@ -60,7 +60,7 @@ def write_file(f, string):
def output_header_to_file(f):
now = datetime.datetime.now()
f.write("""/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -461,9 +461,6 @@ typedef struct ogs_gtp2_header_s {
struct {
#define OGS_GTP2_VERSION_0 0
#define OGS_GTP2_VERSION_1 1
#define OGS_GTP2_TEID_NO_PRESENCE 0
#define OGS_GTP2_TEID_PRESENCE 1
ED4(uint8_t version:3;,
uint8_t piggybacked:1;,
uint8_t teid_presence:1;,

View File

@ -1,7 +1,6 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2022 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* Copyright (C) 2023-2024 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -408,7 +407,7 @@ int ogs_gtp_xact_update_tx(ogs_gtp_xact_t *xact,
return OGS_ERROR;
}
if (hdesc->teid_presence) {
if (hdesc->type > OGS_GTP2_VERSION_NOT_SUPPORTED_INDICATION_TYPE) {
gtp_hlen = OGS_GTPV2C_HEADER_LEN;
} else {
gtp_hlen = OGS_GTPV2C_HEADER_LEN - OGS_GTP2_TEID_LEN;
@ -421,12 +420,12 @@ int ogs_gtp_xact_update_tx(ogs_gtp_xact_t *xact,
h->version = 2;
h->type = hdesc->type;
if (hdesc->teid_presence) {
h->teid_presence = OGS_GTP2_TEID_PRESENCE;
if (hdesc->type > OGS_GTP2_VERSION_NOT_SUPPORTED_INDICATION_TYPE) {
h->teid_presence = 1;
h->teid = htobe32(hdesc->teid);
h->sqn = OGS_GTP2_XID_TO_SQN(xact->xid);
} else {
h->teid_presence = OGS_GTP2_TEID_NO_PRESENCE;
h->teid_presence = 0;
h->sqn_only = OGS_GTP2_XID_TO_SQN(xact->xid);
}
h->length = htobe16(pkbuf->len - 4);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -20,7 +20,7 @@
/*******************************************************************************
* This file had been created by pfcp-tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2024-03-23 07:20:44.691773 by acetcom
* Created on: 2024-01-19 23:36:01.346970 by acetcom
* from 29244-h71-modified.docx
******************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -20,7 +20,7 @@
/*******************************************************************************
* This file had been created by pfcp-tlv.py script v0.1.0
* Please do not modify this file but regenerate it via script.
* Created on: 2024-03-23 07:20:44.672650 by acetcom
* Created on: 2024-01-19 23:36:01.327925 by acetcom
* from 29244-h71-modified.docx
******************************************************************************/
@ -41,8 +41,6 @@ extern "C" {
typedef struct ogs_pfcp_header_s {
union {
struct {
#define OGS_PFCP_SEID_NO_PRESENCE 0
#define OGS_PFCP_SEID_PRESENCE 1
ED4(uint8_t version:3;,
uint8_t spare1:3;,
uint8_t mp:1;,

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -140,7 +140,7 @@ int ogs_pfcp_send_heartbeat_request(ogs_pfcp_node_t *node,
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_HEARTBEAT_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_NO_PRESENCE;
h.seid = 0;
xact = ogs_pfcp_xact_local_create(node, cb, node);
if (!xact) {
@ -176,7 +176,7 @@ int ogs_pfcp_send_heartbeat_response(ogs_pfcp_xact_t *xact)
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_HEARTBEAT_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_NO_PRESENCE;
h.seid = 0;
pkbuf = ogs_pfcp_build_heartbeat_response(h.type);
if (!pkbuf) {
@ -217,7 +217,7 @@ int ogs_pfcp_cp_send_association_setup_request(ogs_pfcp_node_t *node,
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_NO_PRESENCE;
h.seid = 0;
xact = ogs_pfcp_xact_local_create(node, cb, node);
if (!xact) {
@ -254,7 +254,7 @@ int ogs_pfcp_cp_send_association_setup_response(ogs_pfcp_xact_t *xact,
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_ASSOCIATION_SETUP_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_NO_PRESENCE;
h.seid = 0;
pkbuf = ogs_pfcp_cp_build_association_setup_response(h.type, cause);
if (!pkbuf) {
@ -286,7 +286,7 @@ int ogs_pfcp_up_send_association_setup_request(ogs_pfcp_node_t *node,
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_NO_PRESENCE;
h.seid = 0;
xact = ogs_pfcp_xact_local_create(node, cb, node);
if (!xact) {
@ -323,7 +323,7 @@ int ogs_pfcp_up_send_association_setup_response(ogs_pfcp_xact_t *xact,
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_ASSOCIATION_SETUP_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_NO_PRESENCE;
h.seid = 0;
pkbuf = ogs_pfcp_up_build_association_setup_response(h.type, cause);
if (!pkbuf) {
@ -468,7 +468,7 @@ void ogs_pfcp_send_buffered_packet(ogs_pfcp_pdr_t *pdr)
}
void ogs_pfcp_send_error_message(
ogs_pfcp_xact_t *xact, int seid_presence, uint64_t seid, uint8_t type,
ogs_pfcp_xact_t *xact, uint64_t seid, uint8_t type,
uint8_t cause_value, uint16_t offending_ie_value)
{
int rv;
@ -480,7 +480,6 @@ void ogs_pfcp_send_error_message(
ogs_assert(xact);
memset(&errmsg, 0, sizeof(ogs_pfcp_message_t));
errmsg.h.seid_presence = seid_presence;
errmsg.h.seid = seid;
errmsg.h.type = type;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -86,7 +86,7 @@ int ogs_pfcp_send_end_marker(ogs_pfcp_pdr_t *pdr);
void ogs_pfcp_send_buffered_packet(ogs_pfcp_pdr_t *pdr);
void ogs_pfcp_send_error_message(
ogs_pfcp_xact_t *xact, int seid_presence, uint64_t seid, uint8_t type,
ogs_pfcp_xact_t *xact, uint64_t seid, uint8_t type,
uint8_t cause_value, uint16_t offending_ie_value);
#ifdef __cplusplus

View File

@ -1,4 +1,4 @@
# Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
# Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
@ -54,7 +54,7 @@ def write_file(f, string):
def output_header_to_file(f):
now = datetime.datetime.now()
f.write("""/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -541,8 +541,6 @@ extern "C" {
typedef struct ogs_pfcp_header_s {
union {
struct {
#define OGS_PFCP_SEID_NO_PRESENCE 0
#define OGS_PFCP_SEID_PRESENCE 1
ED4(uint8_t version:3;,
uint8_t spare1:3;,
uint8_t mp:1;,

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -246,7 +246,7 @@ int ogs_pfcp_xact_update_tx(ogs_pfcp_xact_t *xact,
return OGS_ERROR;
}
if (hdesc->seid_presence) {
if (hdesc->type >= OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE) {
pfcp_hlen = OGS_PFCP_HEADER_LEN;
} else {
pfcp_hlen = OGS_PFCP_HEADER_LEN - OGS_PFCP_SEID_LEN;
@ -259,7 +259,7 @@ int ogs_pfcp_xact_update_tx(ogs_pfcp_xact_t *xact,
h->version = OGS_PFCP_VERSION;
h->type = hdesc->type;
if (hdesc->seid_presence) {
if (h->type >= OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE) {
h->seid_presence = 1;
h->seid = htobe64(hdesc->seid);
h->sqn = OGS_PFCP_XID_TO_SQN(xact->xid);

View File

@ -331,7 +331,7 @@ int hss_context_parse_config(void)
self.sms_over_ims =
ogs_yaml_iter_value(&hss_iter);
} else if (!strcmp(hss_key, "use_mongodb_change_stream")) {
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
#if MONGOC_CHECK_VERSION(1, 9, 0)
self.use_mongodb_change_stream =
ogs_yaml_iter_bool(&hss_iter);
#else
@ -1201,7 +1201,7 @@ int hss_db_poll_change_stream(void)
static int poll_change_stream(void)
{
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
#if MONGOC_CHECK_VERSION(1, 9, 0)
int rv;
const bson_t *document;

View File

@ -32,7 +32,7 @@ void hss_state_initial(ogs_fsm_t *s, hss_event_t *e)
ogs_assert(s);
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
#if MONGOC_CHECK_VERSION(1, 9, 0)
if (hss_self()->use_mongodb_change_stream) {
ogs_dbi_collection_watch_init();

View File

@ -124,7 +124,6 @@ ogs_pkbuf_t *esm_build_activate_default_bearer_context_request(
ogs_assert(session->name);
bearer = mme_default_bearer_in_sess(sess);
ogs_assert(bearer);
ogs_assert(mme_bearer_next(bearer) == NULL);
ogs_debug("Activate default bearer context request");
ogs_debug(" IMSI[%s] PTI[%d] EBI[%d]",
@ -254,6 +253,7 @@ ogs_pkbuf_t *esm_build_activate_dedicated_bearer_context_request(
mme_bearer_t *bearer)
{
mme_ue_t *mme_ue = NULL;
mme_sess_t *sess = NULL;
mme_bearer_t *linked_bearer = NULL;
ogs_nas_eps_message_t message;
@ -269,6 +269,8 @@ ogs_pkbuf_t *esm_build_activate_dedicated_bearer_context_request(
&activate_dedicated_eps_bearer_context_request->tft;
ogs_assert(bearer);
sess = bearer->sess;
ogs_assert(sess);
mme_ue = bearer->mme_ue;
ogs_assert(mme_ue);
linked_bearer = mme_linked_bearer(bearer);
@ -284,7 +286,21 @@ ogs_pkbuf_t *esm_build_activate_dedicated_bearer_context_request(
message.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.esm.h.eps_bearer_identity = bearer->ebi;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
message.esm.h.procedure_transaction_identity = 0;
/*
* Issue #3072
*
* PTI 0 is set here to prevent a InitialContextSetupRequest message
* with a PTI of 0 from being created when the Create Bearer Request occurs
* and InitialContextSetupRequest occurs.
*
* If you implement the creation of a dedicated bearer
* in the ESM procedure reqeusted by the UE,
* you will need to refactor the part that sets the PTI.
*/
message.esm.h.procedure_transaction_identity =
sess->pti = OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED;
message.esm.h.message_type =
OGS_NAS_EPS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST;

View File

@ -4287,7 +4287,8 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
}
if (pti == OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED) {
ogs_error("Both PTI[%d] and EBI[%d] are 0", pti, ebi);
ogs_error("ESM message type: %d, Both PTI[%d] and EBI[%d] are 0",
message->esm.h.message_type, pti, ebi);
r = nas_eps_send_attach_reject(mme_ue->enb_ue, mme_ue,
OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
@ -4373,6 +4374,9 @@ mme_bearer_t *mme_bearer_find_or_add_by_message(
sess = mme_sess_find_by_apn(mme_ue,
pdn_connectivity_request->access_point_name.apn);
if (sess && create_action != OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
sess->pti = pti;
r = nas_eps_send_pdn_connectivity_reject(
sess,
OGS_NAS_ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED,

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -203,6 +203,8 @@ int mme_gtp_open(void)
}
OGS_SETUP_GTPC_SERVER;
ogs_assert(ogs_gtp_self()->gtpc_sock || ogs_gtp_self()->gtpc_sock6);
ogs_assert(ogs_gtp_self()->gtpc_addr || ogs_gtp_self()->gtpc_addr6);
mme_self()->pgw_addr = mme_pgw_addr_find_by_apn_enb(
&mme_self()->pgw_list, AF_INET, NULL);
@ -254,7 +256,6 @@ int mme_gtp_send_create_session_request(mme_sess_t *sess, int create_action)
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_CREATE_SESSION_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_create_session_request(h.type, sess, create_action);
@ -294,7 +295,6 @@ int mme_gtp_send_modify_bearer_request(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_MODIFY_BEARER_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_modify_bearer_request(h.type, mme_ue, uli_presence);
@ -334,7 +334,6 @@ int mme_gtp_send_delete_session_request(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DELETE_SESSION_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
s11buf = mme_s11_build_delete_session_request(h.type, sess, action);
@ -403,7 +402,6 @@ int mme_gtp_send_create_bearer_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_create_bearer_response(h.type, bearer, cause_value);
@ -449,7 +447,6 @@ int mme_gtp_send_update_bearer_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_update_bearer_response(h.type, bearer, cause_value);
@ -495,7 +492,6 @@ int mme_gtp_send_delete_bearer_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_delete_bearer_response(h.type, bearer, cause_value);
@ -531,7 +527,6 @@ int mme_gtp_send_release_access_bearers_request(mme_ue_t *mme_ue, int action)
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_RELEASE_ACCESS_BEARERS_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_release_access_bearers_request(h.type);
@ -629,7 +624,6 @@ int mme_gtp_send_downlink_data_notification_ack(
/* Build Downlink data notification ack */
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
s11buf = mme_s11_build_downlink_data_notification_ack(h.type, cause_value);
@ -665,7 +659,6 @@ int mme_gtp_send_create_indirect_data_forwarding_tunnel_request(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_create_indirect_data_forwarding_tunnel_request(
@ -705,7 +698,6 @@ int mme_gtp_send_delete_indirect_data_forwarding_tunnel_request(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = ogs_pkbuf_alloc(NULL, OGS_TLV_MAX_HEADROOM);
@ -748,7 +740,6 @@ int mme_gtp_send_bearer_resource_command(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_BEARER_RESOURCE_COMMAND_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgw_ue->sgw_s11_teid;
pkbuf = mme_s11_build_bearer_resource_command(h.type, bearer, nas_message);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -793,7 +793,7 @@ void mme_s11_handle_create_bearer_request(
ogs_assert(xact);
ogs_assert(req);
ogs_debug("Create Bearer Response");
ogs_debug("Create Bearer Request");
/***********************
* Check MME-UE Context
@ -823,9 +823,7 @@ void mme_s11_handle_create_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(xact,
sgw_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgw_ue ? sgw_ue->sgw_s11_teid : 0,
ogs_gtp2_send_error_message(xact, sgw_ue ? sgw_ue->sgw_s11_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -861,9 +859,7 @@ void mme_s11_handle_create_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(xact,
sgw_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgw_ue ? sgw_ue->sgw_s11_teid : 0,
ogs_gtp2_send_error_message(xact, sgw_ue ? sgw_ue->sgw_s11_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -881,12 +877,25 @@ void mme_s11_handle_create_bearer_request(
ogs_debug(" MME_S11_TEID[%d] SGW_S11_TEID[%d]",
mme_ue->mme_s11_teid, sgw_ue->sgw_s11_teid);
/*
* DEPRECATED : Issues #3072
*
* PTI 0 is set here to prevent a InitialContextSetupRequest message
* with a PTI of 0 from being created when the Create Bearer Request occurs
* and InitialContextSetupRequest occurs.
*
* If you implement the creation of a dedicated bearer
* in the ESM procedure reqeusted by the UE,
* you will need to refactor the part that sets the PTI.
*/
#if 0
/* Set PTI */
sess->pti = OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED;
if (req->procedure_transaction_id.presence) {
sess->pti = req->procedure_transaction_id.u8;
ogs_debug(" PTI[%d]", sess->pti);
}
#endif
/* Data Plane(UL) : SGW-S1U */
sgw_s1u_teid = req->bearer_contexts.s1_u_enodeb_f_teid.data;
@ -1019,9 +1028,7 @@ void mme_s11_handle_update_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(xact,
sgw_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgw_ue ? sgw_ue->sgw_s11_teid : 0,
ogs_gtp2_send_error_message(xact, sgw_ue ? sgw_ue->sgw_s11_teid : 0,
OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -1192,9 +1199,7 @@ void mme_s11_handle_delete_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(xact,
sgw_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgw_ue ? sgw_ue->sgw_s11_teid : 0,
ogs_gtp2_send_error_message(xact, sgw_ue ? sgw_ue->sgw_s11_teid : 0,
OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
return;
@ -1451,9 +1456,7 @@ void mme_s11_handle_downlink_data_notification(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(xact,
sgw_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgw_ue ? sgw_ue->sgw_s11_teid : 0,
ogs_gtp2_send_error_message(xact, sgw_ue ? sgw_ue->sgw_s11_teid : 0,
OGS_GTP2_DOWNLINK_DATA_NOTIFICATION_ACKNOWLEDGE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
return;

View File

@ -106,7 +106,6 @@ int nas_eps_send_attach_accept(mme_ue_t *mme_ue)
{
int rv;
mme_sess_t *sess = NULL;
mme_bearer_t *bearer = NULL;
ogs_pkbuf_t *s1apbuf = NULL;
ogs_pkbuf_t *esmbuf = NULL, *emmbuf = NULL;
@ -122,10 +121,10 @@ int nas_eps_send_attach_accept(mme_ue_t *mme_ue)
sess = mme_sess_first(mme_ue);
ogs_assert(sess);
ogs_assert(mme_sess_next(sess) == NULL);
bearer = mme_default_bearer_in_sess(sess);
ogs_assert(bearer);
ogs_assert(mme_bearer_next(bearer) == NULL);
if (mme_sess_next(sess)) {
ogs_error("There should only be one SESSION");
return OGS_ERROR;
}
ogs_debug("[%s] Attach accept", mme_ue->imsi_bcd);

View File

@ -343,11 +343,72 @@ ogs_pkbuf_t *s1ap_build_downlink_nas_transport(
return ogs_s1ap_encode(&pdu);
}
static void fill_e_rab_to_be_setup(
S1AP_E_RABToBeSetupItemCtxtSUReq_t *e_rab, mme_bearer_t *bearer)
{
int rv;
S1AP_GBR_QosInformation_t *gbrQosInformation = NULL;
ogs_assert(e_rab);
ogs_assert(bearer);
e_rab->e_RAB_ID = bearer->ebi;
e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.index;
ogs_debug(" EBI[%d] QCI[%d] SGW-S1U-TEID[%d]",
bearer->ebi, bearer->qos.index, bearer->sgw_s1u_teid);
ogs_debug(" ARP[%d:%d:%d]",
bearer->qos.arp.priority_level,
bearer->qos.arp.pre_emption_capability,
bearer->qos.arp.pre_emption_vulnerability);
e_rab->e_RABlevelQoSParameters.allocationRetentionPriority.
priorityLevel = bearer->qos.arp.priority_level;
e_rab->e_RABlevelQoSParameters.allocationRetentionPriority.
pre_emptionCapability =
!(bearer->qos.arp.pre_emption_capability);
e_rab->e_RABlevelQoSParameters.allocationRetentionPriority.
pre_emptionVulnerability =
!(bearer->qos.arp.pre_emption_vulnerability);
if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink ||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) {
ogs_assert(bearer->qos.mbr.downlink);
ogs_assert(bearer->qos.mbr.uplink);
ogs_assert(bearer->qos.gbr.downlink);
ogs_assert(bearer->qos.gbr.uplink);
ogs_debug(" MBR[DL:%lld,UL:%lld]",
(long long)bearer->qos.mbr.downlink,
(long long)bearer->qos.mbr.uplink);
ogs_debug(" GBR[DL:%lld,UL:%lld]",
(long long)bearer->qos.gbr.downlink,
(long long)bearer->qos.gbr.uplink);
gbrQosInformation =
CALLOC(1, sizeof(struct S1AP_GBR_QosInformation));
asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL,
bearer->qos.mbr.downlink);
asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL,
bearer->qos.mbr.uplink);
asn_uint642INTEGER(&gbrQosInformation->
e_RAB_GuaranteedBitrateDL, bearer->qos.gbr.downlink);
asn_uint642INTEGER(&gbrQosInformation->
e_RAB_GuaranteedBitrateUL, bearer->qos.gbr.uplink);
e_rab->e_RABlevelQoSParameters.gbrQosInformation =
gbrQosInformation;
}
rv = ogs_asn_ip_to_BIT_STRING(
&bearer->sgw_s1u_ip, &e_rab->transportLayerAddress);
ogs_assert(rv == OGS_OK);
ogs_asn_uint32_to_OCTET_STRING(
bearer->sgw_s1u_teid, &e_rab->gTP_TEID);
}
ogs_pkbuf_t *s1ap_build_initial_context_setup_request(
mme_ue_t *mme_ue, ogs_pkbuf_t *emmbuf)
{
int rv;
S1AP_S1AP_PDU_t pdu;
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
S1AP_InitialContextSetupRequest_t *InitialContextSetupRequest = NULL;
@ -443,50 +504,26 @@ ogs_pkbuf_t *s1ap_build_initial_context_setup_request(
&UEAggregateMaximumBitrate->uEaggregateMaximumBitRateDL,
mme_ue->ambr.downlink);
ogs_list_for_each(&mme_ue->sess_list, sess) {
ogs_list_for_each(&sess->bearer_list, bearer) {
S1AP_E_RABToBeSetupItemCtxtSUReqIEs_t *item = NULL;
S1AP_E_RABToBeSetupItemCtxtSUReq_t *e_rab = NULL;
S1AP_NAS_PDU_t *nasPdu = NULL;
S1AP_E_RABToBeSetupItemCtxtSUReqIEs_t *item = NULL;
S1AP_E_RABToBeSetupItemCtxtSUReq_t *e_rab = NULL;
S1AP_GBR_QosInformation_t *gbrQosInformation = NULL;
S1AP_NAS_PDU_t *nasPdu = NULL;
if (mme_ue->nas_eps.type == MME_EPS_TYPE_ATTACH_REQUEST) {
/*
* For Attach Request,
* Delete Session Request/Response removes ALL session/bearers.
*
* Since all bearers are INACTIVE,
* we should not check the bearer activation.
*/
} else if (OGS_FSM_CHECK(&bearer->sm, esm_state_inactive)) {
/*
* For Service Request/TAU Request/Extended Service Request,
* Only the active EPS bearer can be included.
*
* If MME received Create Bearer Request and
* if MME does not receive Activate EPS Bearer Context Accept,
* We should not include the INACTIVE bearer.
*
* For example,
* 1. SGW->MME : Create Bearer Request
* 2. MME->UE : S1 Paging
* 3. UE->MME : Service Request
* 4. MME->UE : Initial Context Setup Request
* (We should not include INACTIVE BEARER)
* 5. UE->MME : Initial Context Setup Response
* 6. MME->UE : Activate dedicated EPS Bearer Context Request
* 7. UE->MME : Activate dedicated EPS Bearer Context Accept
* 8. MME->SGW : Create Bearer Response
*/
ogs_warn("No active EPS bearer [%d]", bearer->ebi);
ogs_warn(" IMSI[%s] NAS-EPS Type[%d] "
"ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
mme_ue->imsi_bcd, mme_ue->nas_eps.type,
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
continue;
}
if (mme_ue->nas_eps.type == MME_EPS_TYPE_ATTACH_REQUEST) {
/*
* For Attach Request,
* Delete Session Request/Response removes ALL session/bearers.
*
* Since all bearers are INACTIVE,
* we should not check the bearer activation.
*/
sess = ogs_list_first(&mme_ue->sess_list);
/*
* Issue #3072 : Only first Bearer should be included.
*/
if (sess)
bearer = ogs_list_first(&sess->bearer_list);
if (sess && bearer) {
item = CALLOC(1, sizeof(S1AP_E_RABToBeSetupItemCtxtSUReqIEs_t));
ASN_SEQUENCE_ADD(&E_RABToBeSetupListCtxtSUReq->list, item);
@ -496,58 +533,7 @@ ogs_pkbuf_t *s1ap_build_initial_context_setup_request(
e_rab = &item->value.choice.E_RABToBeSetupItemCtxtSUReq;
e_rab->e_RAB_ID = bearer->ebi;
e_rab->e_RABlevelQoSParameters.qCI = bearer->qos.index;
ogs_debug(" EBI[%d] QCI[%d] SGW-S1U-TEID[%d]",
bearer->ebi, bearer->qos.index, bearer->sgw_s1u_teid);
ogs_debug(" ARP[%d:%d:%d]",
bearer->qos.arp.priority_level,
bearer->qos.arp.pre_emption_capability,
bearer->qos.arp.pre_emption_vulnerability);
e_rab->e_RABlevelQoSParameters.allocationRetentionPriority.
priorityLevel = bearer->qos.arp.priority_level;
e_rab->e_RABlevelQoSParameters.allocationRetentionPriority.
pre_emptionCapability =
!(bearer->qos.arp.pre_emption_capability);
e_rab->e_RABlevelQoSParameters.allocationRetentionPriority.
pre_emptionVulnerability =
!(bearer->qos.arp.pre_emption_vulnerability);
if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink ||
bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) {
ogs_assert(bearer->qos.mbr.downlink);
ogs_assert(bearer->qos.mbr.uplink);
ogs_assert(bearer->qos.gbr.downlink);
ogs_assert(bearer->qos.gbr.uplink);
ogs_debug(" MBR[DL:%lld,UL:%lld]",
(long long)bearer->qos.mbr.downlink,
(long long)bearer->qos.mbr.uplink);
ogs_debug(" GBR[DL:%lld,UL:%lld]",
(long long)bearer->qos.gbr.downlink,
(long long)bearer->qos.gbr.uplink);
gbrQosInformation =
CALLOC(1, sizeof(struct S1AP_GBR_QosInformation));
asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL,
bearer->qos.mbr.downlink);
asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL,
bearer->qos.mbr.uplink);
asn_uint642INTEGER(&gbrQosInformation->
e_RAB_GuaranteedBitrateDL, bearer->qos.gbr.downlink);
asn_uint642INTEGER(&gbrQosInformation->
e_RAB_GuaranteedBitrateUL, bearer->qos.gbr.uplink);
e_rab->e_RABlevelQoSParameters.gbrQosInformation =
gbrQosInformation;
}
rv = ogs_asn_ip_to_BIT_STRING(
&bearer->sgw_s1u_ip, &e_rab->transportLayerAddress);
ogs_assert(rv == OGS_OK);
ogs_asn_uint32_to_OCTET_STRING(
bearer->sgw_s1u_teid, &e_rab->gTP_TEID);
fill_e_rab_to_be_setup(e_rab, bearer);
if (emmbuf && emmbuf->len) {
ogs_debug(" NASPdu[%p:%d]", emmbuf, emmbuf->len);
@ -566,6 +552,66 @@ ogs_pkbuf_t *s1ap_build_initial_context_setup_request(
emmbuf = NULL;
}
}
} else {
/*
* For Service Request/TAU Request/Extended Service Request,
* Only the active EPS bearer can be included.
*
* If MME received Create Bearer Request and
* if MME does not receive Activate EPS Bearer Context Accept,
* We should not include the INACTIVE bearer.
*
* For example,
* 1. SGW->MME : Create Bearer Request
* 2. MME->UE : S1 Paging
* 3. UE->MME : Service Request
* 4. MME->UE : Initial Context Setup Request
* (We should not include INACTIVE BEARER)
* 5. UE->MME : Initial Context Setup Response
* 6. MME->UE : Activate dedicated EPS Bearer Context Request
* 7. UE->MME : Activate dedicated EPS Bearer Context Accept
* 8. MME->SGW : Create Bearer Response
*/
ogs_list_for_each(&mme_ue->sess_list, sess) {
ogs_list_for_each(&sess->bearer_list, bearer) {
if (OGS_FSM_CHECK(&bearer->sm, esm_state_inactive)) {
ogs_warn("No active EPS bearer [%d]", bearer->ebi);
ogs_warn(" IMSI[%s] NAS-EPS Type[%d] "
"ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]",
mme_ue->imsi_bcd, mme_ue->nas_eps.type,
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
continue;
}
item = CALLOC(1, sizeof(S1AP_E_RABToBeSetupItemCtxtSUReqIEs_t));
ASN_SEQUENCE_ADD(&E_RABToBeSetupListCtxtSUReq->list, item);
item->id = S1AP_ProtocolIE_ID_id_E_RABToBeSetupItemCtxtSUReq;
item->criticality = S1AP_Criticality_reject;
item->value.present = S1AP_E_RABToBeSetupItemCtxtSUReqIEs__value_PR_E_RABToBeSetupItemCtxtSUReq;
e_rab = &item->value.choice.E_RABToBeSetupItemCtxtSUReq;
fill_e_rab_to_be_setup(e_rab, bearer);
if (emmbuf && emmbuf->len) {
ogs_debug(" NASPdu[%p:%d]", emmbuf, emmbuf->len);
nasPdu = (S1AP_NAS_PDU_t *)CALLOC(1, sizeof(S1AP_NAS_PDU_t));
nasPdu->size = emmbuf->len;
nasPdu->buf = CALLOC(nasPdu->size, sizeof(uint8_t));
memcpy(nasPdu->buf, emmbuf->data, nasPdu->size);
e_rab->nAS_PDU = nasPdu;
ogs_pkbuf_free(emmbuf);
ogs_log_hexdump(OGS_LOG_DEBUG, nasPdu->buf, nasPdu->size);
/* Since Tracking area update accept is used only once,
* set emmbuf to NULL as shown below */
emmbuf = NULL;
}
}
}
}
if (emmbuf && emmbuf->len) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -129,6 +129,8 @@ int sgwc_gtp_open(void)
}
OGS_SETUP_GTPC_SERVER;
ogs_assert(ogs_gtp_self()->gtpc_sock || ogs_gtp_self()->gtpc_sock6);
ogs_assert(ogs_gtp_self()->gtpc_addr || ogs_gtp_self()->gtpc_addr6);
return OGS_OK;
}
@ -182,7 +184,6 @@ int sgwc_gtp_send_create_session_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgwc_ue->mme_s11_teid;
pkbuf = sgwc_s11_build_create_session_response(h.type, sess);
@ -230,7 +231,6 @@ int sgwc_gtp_send_downlink_data_notification(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DOWNLINK_DATA_NOTIFICATION_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sgwc_ue->mme_s11_teid;
pkbuf = sgwc_s11_build_downlink_data_notification(cause_value, bearer);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -222,7 +222,6 @@ int sgwc_pfcp_send_bearer_to_modify_list(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwu_sxa_seid;
sxabuf = sgwc_sxa_build_bearer_to_modify_list(h.type, sess, xact);
@ -303,7 +302,6 @@ int sgwc_pfcp_send_session_establishment_request(
* over N4 towards another SMF or another PFCP entity in the SMF
* as specified in clause 5.22.2 and clause 5.22.3.
*/
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwu_sxa_seid;
sxabuf = sgwc_sxa_build_session_establishment_request(h.type, sess);
@ -391,7 +389,6 @@ int sgwc_pfcp_send_bearer_modification_request(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwu_sxa_seid;
sxabuf = sgwc_sxa_build_bearer_to_modify_list(h.type, sess, xact);
@ -440,7 +437,6 @@ int sgwc_pfcp_send_session_deletion_request(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_DELETION_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwu_sxa_seid;
sxabuf = sgwc_sxa_build_session_deletion_request(h.type, sess);
@ -470,7 +466,6 @@ int sgwc_pfcp_send_session_report_response(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwu_sxa_seid;
sxabuf = ogs_pfcp_build_session_report_response(h.type, cause);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -173,9 +173,8 @@ void sgwc_s11_handle_create_session_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
@ -215,9 +214,8 @@ void sgwc_s11_handle_create_session_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
@ -264,9 +262,8 @@ void sgwc_s11_handle_create_session_request(
/* Check if selected SGW-U is associated with SGW-C */
ogs_assert(sess->pfcp_node);
if (!OGS_FSM_CHECK(&sess->pfcp_node->sm, sgwc_pfcp_state_associated)) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_REMOTE_PEER_NOT_RESPONDING);
return;
@ -426,9 +423,8 @@ void sgwc_s11_handle_modify_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -535,9 +531,8 @@ void sgwc_s11_handle_modify_bearer_request(
if (i == 0) {
ogs_error("No Bearer");
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -614,9 +609,8 @@ void sgwc_s11_handle_delete_session_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
@ -635,9 +629,8 @@ void sgwc_s11_handle_delete_session_request(
indication->operation_indication == 1 &&
indication->scope_indication == 1) {
ogs_error("Invalid Indication");
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_INVALID_MESSAGE_FORMAT);
return;
@ -663,7 +656,6 @@ void sgwc_s11_handle_delete_session_request(
} else {
message->h.type = OGS_GTP2_DELETE_SESSION_REQUEST_TYPE;
message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
message->h.teid = sess->pgw_s5c_teid;
gtpbuf = ogs_gtp2_build_msg(message);
@ -770,9 +762,7 @@ void sgwc_s11_handle_create_bearer_response(
sgwc_pfcp_send_bearer_modification_request(
bearer, NULL, NULL,
OGS_PFCP_MODIFY_UL_ONLY|OGS_PFCP_MODIFY_REMOVE));
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -791,9 +781,7 @@ void sgwc_s11_handle_create_bearer_response(
sgwc_pfcp_send_bearer_modification_request(
bearer, NULL, NULL,
OGS_PFCP_MODIFY_UL_ONLY|OGS_PFCP_MODIFY_REMOVE));
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -927,9 +915,7 @@ void sgwc_s11_handle_update_bearer_response(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -944,9 +930,7 @@ void sgwc_s11_handle_update_bearer_response(
cause_value = cause->value;
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_error("GTP Bearer Cause [VALUE:%d]", cause_value);
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -956,9 +940,7 @@ void sgwc_s11_handle_update_bearer_response(
cause_value = cause->value;
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_error("GTP Cause [Value:%d]", cause_value);
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -975,7 +957,6 @@ void sgwc_s11_handle_update_bearer_response(
sess->sgw_s5c_teid, sess->pgw_s5c_teid);
message->h.type = OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE;
message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
message->h.teid = sess->pgw_s5c_teid;
pkbuf = ogs_gtp2_build_msg(message);
@ -1147,9 +1128,8 @@ void sgwc_s11_handle_release_access_bearers_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_RELEASE_ACCESS_BEARERS_RESPONSE_TYPE, cause_value);
return;
}
@ -1255,9 +1235,8 @@ void sgwc_s11_handle_create_indirect_data_forwarding_tunnel_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE,
cause_value);
return;
@ -1274,9 +1253,8 @@ void sgwc_s11_handle_create_indirect_data_forwarding_tunnel_request(
for (i = 0; req->bearer_contexts[i].presence; i++) {
if (req->bearer_contexts[i].eps_bearer_id.presence == 0) {
ogs_error("No EBI");
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE,
OGS_GTP2_CAUSE_MANDATORY_IE_MISSING);
return;
@ -1298,9 +1276,8 @@ void sgwc_s11_handle_create_indirect_data_forwarding_tunnel_request(
rv = ogs_gtp2_f_teid_to_ip(req_teid, &tunnel->remote_ip);
if (rv != OGS_OK) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(s11_xact,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE,
OGS_GTP2_CAUSE_MANDATORY_IE_MISSING);
return;
@ -1334,9 +1311,8 @@ void sgwc_s11_handle_create_indirect_data_forwarding_tunnel_request(
rv = ogs_gtp2_f_teid_to_ip(req_teid, &tunnel->remote_ip);
if (rv != OGS_OK) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(s11_xact,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE,
OGS_GTP2_CAUSE_MANDATORY_IE_MISSING);
return;
@ -1390,9 +1366,8 @@ void sgwc_s11_handle_delete_indirect_data_forwarding_tunnel_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE,
cause_value);
return;
@ -1466,9 +1441,8 @@ void sgwc_s11_handle_bearer_resource_command(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE, cause_value);
return;
}
@ -1488,9 +1462,8 @@ void sgwc_s11_handle_bearer_resource_command(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE, cause_value);
return;
}
@ -1510,7 +1483,6 @@ void sgwc_s11_handle_bearer_resource_command(
sess->sgw_s5c_teid, sess->pgw_s5c_teid);
message->h.type = OGS_GTP2_BEARER_RESOURCE_COMMAND_TYPE;
message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
message->h.teid = sess->pgw_s5c_teid;
pkbuf = ogs_gtp2_build_msg(message);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024444 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -122,9 +122,8 @@ void sgwc_s5c_handle_create_session_response(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
@ -161,9 +160,8 @@ void sgwc_s5c_handle_create_session_response(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
@ -187,10 +185,8 @@ void sgwc_s5c_handle_create_session_response(
bearer_cause = cause->value;
if (bearer_cause != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_error("GTP Bearer Cause [VALUE:%d]", bearer_cause);
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE :
OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, bearer_cause);
return;
}
@ -203,9 +199,8 @@ void sgwc_s5c_handle_create_session_response(
session_cause !=
OGS_GTP2_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) {
ogs_error("GTP Cause [VALUE:%d]", session_cause);
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, session_cause);
return;
}
@ -238,10 +233,8 @@ void sgwc_s5c_handle_create_session_response(
bearer = sgwc_bearer_find_by_sess_ebi(sess,
rsp->bearer_contexts_created[i].eps_bearer_id.u8);
if (!bearer) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE :
OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_MANDATORY_IE_MISSING);
return;
@ -260,10 +253,8 @@ void sgwc_s5c_handle_create_session_response(
rv = ogs_gtp2_f_teid_to_ip(pgw_s5u_teid, &ul_tunnel->remote_ip);
if (rv != OGS_OK) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE :
OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_MANDATORY_IE_MISSING);
return;
@ -363,15 +354,13 @@ void sgwc_s5c_handle_modify_bearer_response(
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST)
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
else
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -387,15 +376,13 @@ void sgwc_s5c_handle_modify_bearer_response(
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST)
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
else
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -407,15 +394,13 @@ void sgwc_s5c_handle_modify_bearer_response(
if (session_cause != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_error("GTP Cause [VALUE:%d]", session_cause);
if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST)
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, session_cause);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, session_cause);
else
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, session_cause);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, session_cause);
return;
}
@ -435,7 +420,6 @@ void sgwc_s5c_handle_modify_bearer_response(
sgwc_gtp_send_create_session_response(sess, s11_xact));
} else {
message->h.type = OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE;
message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
message->h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(message);
@ -509,9 +493,8 @@ void sgwc_s5c_handle_delete_session_response(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
@ -590,9 +573,7 @@ void sgwc_s5c_handle_create_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -620,9 +601,7 @@ void sgwc_s5c_handle_create_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -652,9 +631,7 @@ void sgwc_s5c_handle_create_bearer_request(
rv = ogs_gtp2_f_teid_to_ip(pgw_s5u_teid, &ul_tunnel->remote_ip);
if (rv != OGS_OK) {
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE,
OGS_GTP2_CAUSE_MANDATORY_IE_MISSING);
return;
@ -732,9 +709,7 @@ void sgwc_s5c_handle_update_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -754,7 +729,6 @@ void sgwc_s5c_handle_update_bearer_request(
sess->sgw_s5c_teid, sess->pgw_s5c_teid);
message->h.type = OGS_GTP2_UPDATE_BEARER_REQUEST_TYPE;
message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
message->h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(message);
@ -876,9 +850,7 @@ void sgwc_s5c_handle_delete_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -898,7 +870,6 @@ void sgwc_s5c_handle_delete_bearer_request(
sess->sgw_s5c_teid, sess->pgw_s5c_teid);
message->h.type = OGS_GTP2_DELETE_BEARER_REQUEST_TYPE;
message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
message->h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(message);
@ -999,8 +970,6 @@ void sgwc_s5c_handle_bearer_resource_failure_indication(
cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
}
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE, cause_value);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -245,9 +245,8 @@ void sgwc_sxa_handle_session_establishment_response(
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
if (sess) sgwc_ue = sess->sgwc_ue;
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
return;
}
@ -270,11 +269,10 @@ void sgwc_sxa_handle_session_establishment_response(
if (dl_tunnel->local_addr == NULL && dl_tunnel->local_addr6 == NULL) {
ogs_error("No UP F-TEID");
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_GRE_KEY_NOT_FOUND);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_GRE_KEY_NOT_FOUND);
return;
}
@ -349,7 +347,6 @@ void sgwc_sxa_handle_session_establishment_response(
memset(&send_message, 0, sizeof(ogs_gtp2_message_t));
send_message.h.type = OGS_GTP2_MODIFY_BEARER_REQUEST_TYPE;
send_message.h.teid_presence = OGS_GTP2_TEID_PRESENCE;
send_message.h.teid = sess->pgw_s5c_teid;
/* Send Control Plane(DL) : SGW-S5C */
@ -399,7 +396,6 @@ void sgwc_sxa_handle_session_establishment_response(
/* Create Session Request */
recv_message->h.type = OGS_GTP2_CREATE_SESSION_REQUEST_TYPE;
recv_message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
recv_message->h.teid = sess->pgw_s5c_teid;
/* Send Control Plane(DL) : SGW-S5C */
@ -585,10 +581,9 @@ void sgwc_sxa_handle_session_modification_response(
s5c_xact = pfcp_xact->assoc_xact;
if (s5c_xact) {
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE, cause_value);
ogs_gtp_send_error_message(
s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE, cause_value);
}
sgwc_bearer_remove(bearer);
@ -596,9 +591,8 @@ void sgwc_sxa_handle_session_modification_response(
s5c_xact = pfcp_xact->assoc_xact;
ogs_assert(s5c_xact);
ogs_gtp2_send_error_message(s5c_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->pgw_s5c_teid : 0,
ogs_gtp_send_error_message(
s5c_xact, sess ? sess->pgw_s5c_teid : 0,
OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
@ -607,20 +601,16 @@ void sgwc_sxa_handle_session_modification_response(
s11_xact = pfcp_xact->assoc_xact;
ogs_assert(s11_xact);
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE :
OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
} else if (flags & OGS_PFCP_MODIFY_DL_ONLY) {
s11_xact = pfcp_xact->assoc_xact;
ogs_assert(s11_xact);
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE :
OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
} else {
ogs_fatal("Invalid modify_flags[0x%llx]", (long long)flags);
@ -630,10 +620,9 @@ void sgwc_sxa_handle_session_modification_response(
s11_xact = pfcp_xact->assoc_xact;
ogs_assert(s11_xact);
ogs_gtp2_send_error_message(s11_xact,
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_RELEASE_ACCESS_BEARERS_RESPONSE_TYPE, cause_value);
ogs_gtp_send_error_message(
s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
OGS_GTP2_RELEASE_ACCESS_BEARERS_RESPONSE_TYPE, cause_value);
}
ogs_pfcp_xact_commit(pfcp_xact);
@ -705,7 +694,6 @@ void sgwc_sxa_handle_session_modification_response(
send_message.h.type =
OGS_GTP2_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE;
send_message.h.teid_presence = OGS_GTP2_TEID_PRESENCE;
send_message.h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(&send_message);
@ -732,7 +720,6 @@ void sgwc_sxa_handle_session_modification_response(
if (s5c_xact) {
ogs_assert(recv_message);
recv_message->h.type = OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE;
recv_message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
recv_message->h.teid = sess->pgw_s5c_teid;
pkbuf = ogs_gtp2_build_msg(recv_message);
@ -782,7 +769,6 @@ void sgwc_sxa_handle_session_modification_response(
gtp_req->bearer_contexts.s1_u_enodeb_f_teid.len = len;
recv_message->h.type = OGS_GTP2_CREATE_BEARER_REQUEST_TYPE;
recv_message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
recv_message->h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(recv_message);
@ -850,7 +836,6 @@ void sgwc_sxa_handle_session_modification_response(
gtp_rsp->bearer_contexts.s5_s8_u_pgw_f_teid.len = len;
recv_message->h.type = OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE;
recv_message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
recv_message->h.teid = sess->pgw_s5c_teid;
pkbuf = ogs_gtp2_build_msg(recv_message);
@ -977,7 +962,6 @@ void sgwc_sxa_handle_session_modification_response(
send_message.h.type =
OGS_GTP2_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE;
send_message.h.teid_presence = OGS_GTP2_TEID_PRESENCE;
send_message.h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(&send_message);
@ -1062,7 +1046,6 @@ void sgwc_sxa_handle_session_modification_response(
}
recv_message->h.type = OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE;
recv_message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
recv_message->h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(recv_message);
@ -1100,7 +1083,6 @@ void sgwc_sxa_handle_session_modification_response(
if (indication && indication->handover_indication) {
recv_message->h.type = OGS_GTP2_MODIFY_BEARER_REQUEST_TYPE;
recv_message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
recv_message->h.teid = sess->pgw_s5c_teid;
pkbuf = ogs_gtp2_build_msg(recv_message);
@ -1186,7 +1168,6 @@ void sgwc_sxa_handle_session_modification_response(
}
send_message.h.type = OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE;
send_message.h.teid_presence = OGS_GTP2_TEID_PRESENCE;
send_message.h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(&send_message);
@ -1252,7 +1233,6 @@ void sgwc_sxa_handle_session_modification_response(
send_message.h.type =
OGS_GTP2_RELEASE_ACCESS_BEARERS_RESPONSE_TYPE;
send_message.h.teid_presence = OGS_GTP2_TEID_PRESENCE;
send_message.h.teid = sgwc_ue->mme_s11_teid;
pkbuf = ogs_gtp2_build_msg(&send_message);
@ -1284,7 +1264,6 @@ void sgwc_sxa_handle_session_deletion_response(
{
int rv;
uint8_t cause_value = 0;
int teid_presence = OGS_GTP2_TEID_NO_PRESENCE;
uint32_t teid = 0;
sgwc_ue_t *sgwc_ue = NULL;
@ -1336,8 +1315,6 @@ void sgwc_sxa_handle_session_deletion_response(
* 2. SMF sends Delete Session Response to SGW/MME.
*/
if (sess) sgwc_ue = sess->sgwc_ue;
teid_presence =
sgwc_ue ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE;
teid = sgwc_ue ? sgwc_ue->mme_s11_teid : 0;
break;
case OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE:
@ -1354,8 +1331,6 @@ void sgwc_sxa_handle_session_deletion_response(
* - Bearer Resource Command
* - Delete Bearer Request/Response with DEDICATED BEARER.
*/
teid_presence =
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE;
teid = sess ? sess->pgw_s5c_teid : 0;
break;
default:
@ -1365,8 +1340,8 @@ void sgwc_sxa_handle_session_deletion_response(
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
if (gtp_xact) {
ogs_gtp2_send_error_message(gtp_xact,
teid_presence, teid, gtp_message->h.type, cause_value);
ogs_gtp_send_error_message(
gtp_xact, teid, gtp_message->h.type, cause_value);
}
return;
}
@ -1383,7 +1358,6 @@ void sgwc_sxa_handle_session_deletion_response(
* If gtp_message->h.type == OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE
* Then gtp_xact is S5C-XACT
*/
gtp_message->h.teid_presence = OGS_GTP2_TEID_PRESENCE;
gtp_message->h.teid = teid;
pkbuf = ogs_gtp2_build_msg(gtp_message);
@ -1445,8 +1419,7 @@ void sgwc_sxa_handle_session_report_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_pfcp_send_error_message(pfcp_xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(pfcp_xact, 0,
OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE,
cause_value, 0);
return;
@ -1458,9 +1431,7 @@ void sgwc_sxa_handle_session_report_request(
if (!sgwc_ue->gnode) {
ogs_error("No SGWC-UE GTP Node");
ogs_pfcp_send_error_message(pfcp_xact,
sess ? OGS_PFCP_SEID_PRESENCE : OGS_PFCP_SEID_NO_PRESENCE,
sess ? sess->sgwu_sxa_seid : 0,
ogs_pfcp_send_error_message(pfcp_xact, sess ? sess->sgwu_sxa_seid : 0,
OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -180,7 +180,6 @@ int sgwu_pfcp_send_session_establishment_response(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwc_sxa_f_seid.seid;
sxabuf = sgwu_sxa_build_session_establishment_response(
@ -214,7 +213,6 @@ int sgwu_pfcp_send_session_modification_response(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwc_sxa_f_seid.seid;
sxabuf = sgwu_sxa_build_session_modification_response(
@ -247,7 +245,6 @@ int sgwu_pfcp_send_session_deletion_response(ogs_pfcp_xact_t *xact,
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwc_sxa_f_seid.seid;
sxabuf = sgwu_sxa_build_session_deletion_response(h.type, sess);
@ -298,7 +295,6 @@ int sgwu_pfcp_send_session_report_request(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_REPORT_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->sgwc_sxa_f_seid.seid;
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_timeout, sess);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -45,8 +45,7 @@ void sgwu_sxa_handle_session_establishment_request(
if (!sess) {
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(xact, 0,
OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE,
OGS_PFCP_CAUSE_MANDATORY_IE_MISSING, 0);
return;
@ -143,9 +142,7 @@ void sgwu_sxa_handle_session_establishment_request(
cleanup:
ogs_pfcp_sess_clear(&sess->pfcp);
ogs_pfcp_send_error_message(xact,
sess ? OGS_PFCP_SEID_PRESENCE : OGS_PFCP_SEID_NO_PRESENCE,
sess ? sess->sgwu_sxa_seid : 0,
ogs_pfcp_send_error_message(xact, sess ? sess->sgwu_sxa_seid : 0,
OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE,
cause_value, offending_ie_value);
}
@ -171,8 +168,7 @@ void sgwu_sxa_handle_session_modification_request(
if (!sess) {
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(xact, 0,
OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;
@ -313,9 +309,7 @@ void sgwu_sxa_handle_session_modification_request(
cleanup:
ogs_pfcp_sess_clear(&sess->pfcp);
ogs_pfcp_send_error_message(xact,
sess ? OGS_PFCP_SEID_PRESENCE : OGS_PFCP_SEID_NO_PRESENCE,
sess ? sess->sgwu_sxa_seid : 0,
ogs_pfcp_send_error_message(xact, sess ? sess->sgwu_sxa_seid : 0,
OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE,
cause_value, offending_ie_value);
}
@ -331,8 +325,7 @@ void sgwu_sxa_handle_session_deletion_request(
if (!sess) {
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(xact, 0,
OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -363,7 +363,6 @@ void smf_bearer_binding(smf_sess_t *sess)
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_UPDATE_BEARER_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->sgw_s5c_teid;
pkbuf = smf_s5c_build_update_bearer_request(
@ -440,7 +439,6 @@ int smf_gtp2_send_create_bearer_request(smf_bearer_t *bearer)
ogs_assert(sess);
h.type = OGS_GTP2_CREATE_BEARER_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->sgw_s5c_teid;
memset(&tft, 0, sizeof tft);

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -73,9 +74,7 @@ static void send_gtp_create_err_msg(const smf_sess_t *sess,
ogs_gtp1_send_error_message(gtp_xact, sess->sgw_s5c_teid,
OGS_GTP1_CREATE_PDP_CONTEXT_RESPONSE_TYPE, gtp_cause);
else
ogs_gtp2_send_error_message(gtp_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess->sgw_s5c_teid,
ogs_gtp2_send_error_message(gtp_xact, sess->sgw_s5c_teid,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, gtp_cause);
}
@ -86,9 +85,7 @@ static void send_gtp_delete_err_msg(const smf_sess_t *sess,
ogs_gtp1_send_error_message(gtp_xact, sess->sgw_s5c_teid,
OGS_GTP1_DELETE_PDP_CONTEXT_RESPONSE_TYPE, gtp_cause);
else
ogs_gtp2_send_error_message(gtp_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess->sgw_s5c_teid,
ogs_gtp2_send_error_message(gtp_xact, sess->sgw_s5c_teid,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, gtp_cause);
}
@ -778,10 +775,8 @@ void smf_gsm_state_operational(ogs_fsm_t *s, smf_event_t *e)
sess, e->gtp_xact,
&gtp2_message->delete_session_request);
if (gtp2_cause != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(e->gtp_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess->sgw_s5c_teid,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, gtp2_cause);
ogs_gtp2_send_error_message(e->gtp_xact, sess->sgw_s5c_teid,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, gtp2_cause);
return;
}
OGS_FSM_TRAN(s, smf_gsm_state_wait_pfcp_deletion);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -251,6 +251,9 @@ int smf_gtp_open(void)
}
OGS_SETUP_GTPC_SERVER;
/* If we only use 5G, we don't need GTP-C, so there is no check routine. */
if (!ogs_gtp_self()->gtpc_sock && !ogs_gtp_self()->gtpc_sock6)
ogs_warn("No GTP-C configuration");
ogs_list_for_each(&ogs_gtp_self()->gtpu_list, node) {
sock = ogs_gtp_server(node);
@ -444,7 +447,6 @@ int smf_gtp2_send_create_session_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->sgw_s5c_teid;
pkbuf = smf_s5c_build_create_session_response(h.type, sess);
@ -479,7 +481,6 @@ int smf_gtp2_send_modify_bearer_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->sgw_s5c_teid;
pkbuf = smf_s5c_build_modify_bearer_response(
@ -513,7 +514,6 @@ int smf_gtp2_send_delete_session_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->sgw_s5c_teid;
pkbuf = smf_s5c_build_delete_session_response(h.type, sess);
@ -551,7 +551,6 @@ int smf_gtp2_send_delete_bearer_request(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DELETE_BEARER_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->sgw_s5c_teid;
pkbuf = smf_s5c_build_delete_bearer_request(

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -971,7 +971,6 @@ void smf_epc_n4_handle_session_modification_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.teid = sess->sgw_s5c_teid;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.type = OGS_GTP2_DELETE_BEARER_REQUEST_TYPE;
pkbuf = smf_s5c_build_delete_bearer_request(
@ -1183,8 +1182,7 @@ void smf_n4_handle_session_report_request(
}
if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
ogs_pfcp_send_error_message(pfcp_xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(pfcp_xact, 0,
OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE,
cause_value, 0);
return;
@ -1224,8 +1222,7 @@ void smf_n4_handle_session_report_request(
if (paging_policy_indication_value) {
ogs_warn("Not implement - "
"Paging Policy Indication Value");
ogs_pfcp_send_error_message(pfcp_xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(pfcp_xact, 0,
OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SERVICE_NOT_SUPPORTED, 0);
return;
@ -1235,8 +1232,7 @@ void smf_n4_handle_session_report_request(
qos_flow = smf_qos_flow_find_by_qfi(sess, qfi);
if (!qos_flow) {
ogs_error("Cannot find the QoS Flow[%d]", qfi);
ogs_pfcp_send_error_message(pfcp_xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(pfcp_xact, 0,
OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;
@ -1261,8 +1257,7 @@ void smf_n4_handle_session_report_request(
if (!pdr) {
ogs_error("No Context");
ogs_pfcp_send_error_message(pfcp_xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(pfcp_xact, 0,
OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -370,7 +370,6 @@ int smf_pfcp_send_modify_list(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->upf_n4_seid;
n4buf = (*modify_list)(h.type, sess, xact);
@ -448,7 +447,6 @@ int smf_5gc_pfcp_send_session_establishment_request(
* over N4 towards another SMF or another PFCP entity in the SMF
* as specified in clause 5.22.2 and clause 5.22.3.
*/
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->upf_n4_seid;
n4buf = smf_n4_build_session_establishment_request(h.type, sess, xact);
@ -551,7 +549,6 @@ int smf_5gc_pfcp_send_session_deletion_request(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_DELETION_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->upf_n4_seid;
n4buf = smf_n4_build_session_deletion_request(h.type, sess);
@ -625,7 +622,6 @@ int smf_epc_pfcp_send_session_establishment_request(
* over N4 towards another SMF or another PFCP entity in the SMF
* as specified in clause 5.22.2 and clause 5.22.3.
*/
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->upf_n4_seid;
n4buf = smf_n4_build_session_establishment_request(h.type, sess, xact);
@ -769,7 +765,6 @@ int smf_epc_pfcp_send_session_deletion_request(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_DELETION_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->upf_n4_seid;
n4buf = smf_n4_build_session_deletion_request(h.type, sess);
@ -868,7 +863,6 @@ int smf_pfcp_send_session_report_response(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->upf_n4_seid;
sxabuf = ogs_pfcp_build_session_report_response(h.type, cause);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -324,8 +324,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
OGS_GTP1_CREATE_PDP_CONTEXT_RESPONSE_TYPE,
OGS_GTP1_CAUSE_CONTEXT_NOT_FOUND);
else
ogs_gtp2_send_error_message(gtp_xact,
OGS_GTP2_TEID_NO_PRESENCE, 0,
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
break;
@ -360,8 +359,7 @@ void smf_pfcp_state_associated(ogs_fsm_t *s, smf_event_t *e)
OGS_GTP1_DELETE_PDP_CONTEXT_RESPONSE_TYPE,
OGS_GTP1_CAUSE_CONTEXT_NOT_FOUND);
else
ogs_gtp2_send_error_message(gtp_xact,
OGS_GTP2_TEID_NO_PRESENCE, 0,
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -504,9 +504,7 @@ void smf_s5c_handle_modify_bearer_request(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(gtp_xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->sgw_s5c_teid : 0,
ogs_gtp2_send_error_message(gtp_xact, sess ? sess->sgw_s5c_teid : 0,
OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
return;
}
@ -1188,9 +1186,7 @@ void smf_s5c_handle_bearer_resource_command(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->sgw_s5c_teid : 0,
ogs_gtp2_send_error_message(xact, sess ? sess->sgw_s5c_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE, cause_value);
return;
}
@ -1215,9 +1211,7 @@ void smf_s5c_handle_bearer_resource_command(
}
if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
ogs_gtp2_send_error_message(xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->sgw_s5c_teid : 0,
ogs_gtp2_send_error_message(xact, sess ? sess->sgw_s5c_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE, cause_value);
return;
}
@ -1246,10 +1240,8 @@ void smf_s5c_handle_bearer_resource_command(
pf = smf_pf_find_by_id(bearer, tft.pf[i].identifier+1);
if (pf) {
if (reconfigure_packet_filter(pf, &tft, i) < 0) {
ogs_gtp2_send_error_message(xact,
sess ? OGS_GTP2_TEID_PRESENCE :
OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->sgw_s5c_teid : 0,
ogs_gtp2_send_error_message(
xact, sess ? sess->sgw_s5c_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE,
OGS_GTP2_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER);
return;
@ -1317,9 +1309,8 @@ void smf_s5c_handle_bearer_resource_command(
ogs_assert(pf);
if (reconfigure_packet_filter(pf, &tft, i) < 0) {
ogs_gtp2_send_error_message(xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->sgw_s5c_teid : 0,
ogs_gtp2_send_error_message(
xact, sess ? sess->sgw_s5c_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE,
OGS_GTP2_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTER);
return;
@ -1405,9 +1396,7 @@ void smf_s5c_handle_bearer_resource_command(
if (tft_update == 0 && tft_delete == 0 && qos_update == 0) {
/* No modification */
ogs_gtp2_send_error_message(xact,
sess ? OGS_GTP2_TEID_PRESENCE : OGS_GTP2_TEID_NO_PRESENCE,
sess ? sess->sgw_s5c_teid : 0,
ogs_gtp2_send_error_message(xact, sess ? sess->sgw_s5c_teid : 0,
OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE,
OGS_GTP2_CAUSE_SERVICE_NOT_SUPPORTED);
return;
@ -1433,7 +1422,6 @@ void smf_s5c_handle_bearer_resource_command(
} else {
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.teid = sess->sgw_s5c_teid;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.type = OGS_GTP2_UPDATE_BEARER_REQUEST_TYPE;
pkbuf = smf_s5c_build_update_bearer_request(

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -144,8 +144,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
}
if (!sess) {
ogs_error("No Session");
ogs_gtp2_send_error_message(gtp_xact,
OGS_GTP2_TEID_NO_PRESENCE, 0,
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
break;
@ -159,8 +158,7 @@ void smf_state_operational(ogs_fsm_t *s, smf_event_t *e)
smf_metrics_inst_gtp_node_inc(smf_gnode->metrics, SMF_METR_GTP_NODE_CTR_S5C_RX_DELETESESSIONREQ);
if (!sess) {
ogs_error("No Session");
ogs_gtp2_send_error_message(gtp_xact,
OGS_GTP2_TEID_NO_PRESENCE, 0,
ogs_gtp2_send_error_message(gtp_xact, 0,
OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE,
OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -69,8 +69,7 @@ void upf_n4_handle_session_establishment_request(
if (!sess) {
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(xact, 0,
OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE,
OGS_PFCP_CAUSE_MANDATORY_IE_MISSING, 0);
upf_metrics_inst_by_cause_add(OGS_PFCP_CAUSE_MANDATORY_IE_MISSING,
@ -215,9 +214,7 @@ cleanup:
upf_metrics_inst_by_cause_add(cause_value,
UPF_METR_CTR_SM_N4SESSIONESTABFAIL, 1);
ogs_pfcp_sess_clear(&sess->pfcp);
ogs_pfcp_send_error_message(xact,
sess ? OGS_PFCP_SEID_PRESENCE : OGS_PFCP_SEID_NO_PRESENCE,
sess ? sess->smf_n4_f_seid.seid : 0,
ogs_pfcp_send_error_message(xact, sess ? sess->smf_n4_f_seid.seid : 0,
OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE,
cause_value, offending_ie_value);
}
@ -243,8 +240,7 @@ void upf_n4_handle_session_modification_request(
if (!sess) {
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(xact, 0,
OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;
@ -417,9 +413,7 @@ void upf_n4_handle_session_modification_request(
cleanup:
ogs_pfcp_sess_clear(&sess->pfcp);
ogs_pfcp_send_error_message(xact,
sess ? OGS_PFCP_SEID_PRESENCE : OGS_PFCP_SEID_NO_PRESENCE,
sess ? sess->smf_n4_f_seid.seid : 0,
ogs_pfcp_send_error_message(xact, sess ? sess->smf_n4_f_seid.seid : 0,
OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE,
cause_value, offending_ie_value);
}
@ -437,8 +431,7 @@ void upf_n4_handle_session_deletion_request(
if (!sess) {
ogs_error("No Context");
ogs_pfcp_send_error_message(xact,
OGS_PFCP_SEID_NO_PRESENCE, 0,
ogs_pfcp_send_error_message(xact, 0,
OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE,
OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND, 0);
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -183,7 +183,6 @@ int upf_pfcp_send_session_establishment_response(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->smf_n4_f_seid.seid;
n4buf = upf_n4_build_session_establishment_response(
@ -217,7 +216,6 @@ int upf_pfcp_send_session_modification_response(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->smf_n4_f_seid.seid;
n4buf = upf_n4_build_session_modification_response(
@ -250,7 +248,6 @@ int upf_pfcp_send_session_deletion_response(ogs_pfcp_xact_t *xact,
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->smf_n4_f_seid.seid;
n4buf = upf_n4_build_session_deletion_response(h.type, sess);
@ -303,7 +300,6 @@ int upf_pfcp_send_session_report_request(
memset(&h, 0, sizeof(ogs_pfcp_header_t));
h.type = OGS_PFCP_SESSION_REPORT_REQUEST_TYPE;
h.seid_presence = OGS_PFCP_SEID_PRESENCE;
h.seid = sess->smf_n4_f_seid.seid;
xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_timeout, sess);

View File

@ -196,6 +196,8 @@ static void test1_func(abts_case *tc, void *data)
tests1ap_recv(test_ue, recvbuf);
/* Send Attach Request */
sess->pti = 1;
sess->pdn_connectivity_param.eit = 1;
sess->pdn_connectivity_param.pco = 1;
sess->pdn_connectivity_param.request_type =
@ -269,6 +271,8 @@ static void test1_func(abts_case *tc, void *data)
tests1ap_recv(test_ue, recvbuf);
/* Send Attach Request - No Integrity */
sess->pti = 1;
sess->pdn_connectivity_param.eit = 1;
sess->pdn_connectivity_param.pco = 1;
sess->pdn_connectivity_param.request_type =

View File

@ -225,6 +225,8 @@ static void test1_func(abts_case *tc, void *data)
#endif
/* Send Attach Request */
sess->pti = 1;
memset(&sess->pdn_connectivity_param,
0, sizeof(sess->pdn_connectivity_param));
sess->pdn_connectivity_param.eit = 1;
@ -364,6 +366,7 @@ static void test1_func(abts_case *tc, void *data)
/* Send Attach Request - INVALID GUTI */
test_ue->nas_eps_guti.m_tmsi = 0x1234;
sess->pti = 1;
memset(&sess->pdn_connectivity_param,
0, sizeof(sess->pdn_connectivity_param));
@ -618,6 +621,8 @@ static void test2_func(abts_case *tc, void *data)
tests1ap_recv(test_ue, recvbuf);
/* Send Attach Request - No Integrity */
sess->pti = 1;
sess->pdn_connectivity_param.eit = 1;
sess->pdn_connectivity_param.pco = 1;
sess->pdn_connectivity_param.request_type =
@ -751,6 +756,8 @@ static void test2_func(abts_case *tc, void *data)
tests1ap_recv(test_ue, recvbuf);
/* Send Attach Request */
sess->pti = 1;
memset(&sess->pdn_connectivity_param,
0, sizeof(sess->pdn_connectivity_param));
sess->pdn_connectivity_param.eit = 1;
@ -1507,6 +1514,8 @@ static void test4_func(abts_case *tc, void *data)
tests1ap_recv(test_ue, recvbuf);
/* Send Attach Request */
sess->pti = 1;
memset(&sess->pdn_connectivity_param,
0, sizeof(sess->pdn_connectivity_param));
sess->pdn_connectivity_param.eit = 1;

View File

@ -1295,6 +1295,18 @@ test_sess_t *test_sess_find_by_apn(
return NULL;
}
test_sess_t *test_sess_find_by_pti(test_ue_t *test_ue, uint8_t pti)
{
test_sess_t *sess = NULL;
ogs_assert(test_ue);
ogs_list_for_each(&test_ue->sess_list, sess)
if (sess->pti == pti) return sess;
return NULL;
}
test_sess_t *test_sess_find_by_psi(test_ue_t *test_ue, uint8_t psi)
{
test_sess_t *sess = NULL;

View File

@ -513,6 +513,7 @@ void test_sess_remove_all(test_ue_t *test_ue);
test_sess_t *test_sess_find_by_apn(
test_ue_t *test_ue, char *apn, uint8_t rat_type);
test_sess_t *test_sess_find_by_pti(test_ue_t *test_ue, uint8_t pti);
test_sess_t *test_sess_find_by_psi(test_ue_t *test_ue, uint8_t psi);
test_bearer_t *test_bearer_add(test_sess_t *sess, uint8_t ebi);

View File

@ -63,7 +63,13 @@ ogs_pkbuf_t *testesm_build_pdn_connectivity_request(
}
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
if (!sess->pti) {
ogs_error("PTI should be not NULL in PDU Connectivity Request");
return NULL;
}
message.esm.h.procedure_transaction_identity = sess->pti;
message.esm.h.message_type = OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST;
request_type->type = OGS_NAS_EPS_PDN_TYPE_IPV4V6;
@ -136,7 +142,13 @@ ogs_pkbuf_t *testesm_build_pdn_disconnect_request(test_sess_t *sess)
message.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
if (!sess->pti) {
ogs_error("PTI should be not NULL in PDU Disonnectivity Request");
return NULL;
}
message.esm.h.procedure_transaction_identity = sess->pti;
message.esm.h.message_type = OGS_NAS_EPS_PDN_DISCONNECT_REQUEST;
linked_eps_bearer_identity->eps_bearer_identity = bearer->ebi;
@ -194,7 +206,13 @@ ogs_pkbuf_t *testesm_build_esm_information_response(test_sess_t *sess)
message.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
if (!sess->pti) {
ogs_error("PTI should be not 0 in ESM Information Response");
return NULL;
}
message.esm.h.procedure_transaction_identity = sess->pti;
message.esm.h.message_type = OGS_NAS_EPS_ESM_INFORMATION_RESPONSE;
esm_information_response->presencemask |= OGS_NAS_EPS_ESM_INFORMATION_RESPONSE_ACCESS_POINT_NAME_PRESENT;
@ -254,6 +272,7 @@ ogs_pkbuf_t *testesm_build_activate_default_eps_bearer_context_accept(
message.esm.h.eps_bearer_identity = bearer->ebi;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
message.esm.h.procedure_transaction_identity = sess->pti = 0;
message.esm.h.message_type =
OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT;
@ -289,6 +308,7 @@ ogs_pkbuf_t *testesm_build_activate_dedicated_eps_bearer_context_accept(
message.esm.h.eps_bearer_identity = bearer->ebi;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
message.esm.h.procedure_transaction_identity = sess->pti = 0;
message.esm.h.message_type =
OGS_NAS_EPS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT;
@ -321,6 +341,7 @@ ogs_pkbuf_t *testesm_build_activate_dedicated_eps_bearer_context_reject(
message.esm.h.eps_bearer_identity = bearer->ebi;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
message.esm.h.procedure_transaction_identity = sess->pti = 0;
message.esm.h.message_type =
OGS_NAS_EPS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT;
@ -352,7 +373,7 @@ ogs_pkbuf_t *testesm_build_modify_eps_bearer_context_accept(
message.esm.h.eps_bearer_identity = bearer->ebi;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
message.esm.h.procedure_transaction_identity = sess->pti;
message.esm.h.procedure_transaction_identity = sess->pti = 0;
message.esm.h.message_type = OGS_NAS_EPS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT;
return test_nas_eps_security_encode(test_ue, &message);
@ -381,6 +402,7 @@ ogs_pkbuf_t *testesm_build_deactivate_eps_bearer_context_accept(
message.esm.h.eps_bearer_identity = bearer->ebi;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
message.esm.h.procedure_transaction_identity = sess->pti = 0;
message.esm.h.message_type =
OGS_NAS_EPS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT;
@ -422,7 +444,13 @@ ogs_pkbuf_t *testesm_build_bearer_resource_allocation_request(
message.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
if (!sess->pti) {
ogs_error("PTI should be not 0 in Bearer Resource Allocation Request");
return NULL;
}
message.esm.h.procedure_transaction_identity = sess->pti;
message.esm.h.message_type = OGS_NAS_EPS_BEARER_RESOURCE_ALLOCATION_REQUEST;
linked_eps_bearer_identity->eps_bearer_identity = bearer->ebi;
@ -473,7 +501,14 @@ ogs_pkbuf_t *testesm_build_bearer_resource_modification_request(
message.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_EMM;
message.esm.h.protocol_discriminator = OGS_NAS_PROTOCOL_DISCRIMINATOR_ESM;
if (!sess->pti) {
ogs_error("PTI should be not 0 "
"in Bearer Resource Modification Request");
return NULL;
}
message.esm.h.procedure_transaction_identity = sess->pti;
message.esm.h.message_type =
OGS_NAS_EPS_BEARER_RESOURCE_MODIFICATION_REQUEST;

View File

@ -19,6 +19,38 @@
#include "test-common.h"
void testesm_handle_esm_information_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message)
{
test_sess_t *sess = NULL;
ogs_assert(test_ue);
ogs_assert(message);
ogs_assert(message->esm.h.procedure_transaction_identity !=
OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED);
sess = test_sess_find_by_pti(
test_ue, message->esm.h.procedure_transaction_identity);
ogs_assert(sess);
}
void testesm_handle_pdn_connectivity_reject(
test_ue_t *test_ue, ogs_nas_eps_message_t *message)
{
test_sess_t *sess = NULL;
ogs_assert(test_ue);
ogs_assert(message);
ogs_assert(message->esm.h.procedure_transaction_identity !=
OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED);
sess = test_sess_find_by_pti(
test_ue, message->esm.h.procedure_transaction_identity);
ogs_assert(sess);
}
void testesm_handle_activate_default_eps_bearer_context_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message)
{
@ -43,6 +75,9 @@ void testesm_handle_activate_default_eps_bearer_context_request(
sess = test_sess_find_by_apn(
test_ue, access_point_name->apn, OGS_GTP2_RAT_TYPE_EUTRAN);
ogs_assert(sess);
ogs_assert(sess->pti == message->esm.h.procedure_transaction_identity);
bearer = test_bearer_find_by_sess_ebi(
sess, message->esm.h.eps_bearer_identity);
if (!bearer)
@ -96,6 +131,8 @@ void testesm_handle_activate_dedicated_eps_bearer_context_request(
sess = bearer->sess;
ogs_assert(sess);
ogs_assert(sess->pti == message->esm.h.procedure_transaction_identity);
bearer = test_bearer_find_by_sess_ebi(
sess, message->esm.h.eps_bearer_identity);
if (!bearer)
@ -103,6 +140,26 @@ void testesm_handle_activate_dedicated_eps_bearer_context_request(
ogs_assert(bearer);
}
void testesm_handle_modify_eps_bearer_context_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message)
{
test_sess_t *sess = NULL;
test_bearer_t *bearer = NULL;
uint8_t ebi;
ogs_assert(message);
ebi = message->esm.h.eps_bearer_identity;
ogs_assert(ebi);
bearer = test_bearer_find_by_ue_ebi(test_ue, ebi);
ogs_assert(bearer);
sess = bearer->sess;
ogs_assert(sess);
ogs_assert(sess->pti == message->esm.h.procedure_transaction_identity);
}
void testesm_handle_deactivate_eps_bearer_context_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message)
{
@ -117,4 +174,40 @@ void testesm_handle_deactivate_eps_bearer_context_request(
bearer = test_bearer_find_by_ue_ebi(test_ue, ebi);
ogs_assert(bearer);
sess = bearer->sess;
ogs_assert(sess);
ogs_assert(sess->pti == message->esm.h.procedure_transaction_identity);
}
void testesm_handle_bearer_resource_allocation(
test_ue_t *test_ue, ogs_nas_eps_message_t *message)
{
test_sess_t *sess = NULL;
ogs_assert(test_ue);
ogs_assert(message);
ogs_assert(message->esm.h.procedure_transaction_identity !=
OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED);
sess = test_sess_find_by_pti(
test_ue, message->esm.h.procedure_transaction_identity);
ogs_assert(sess);
}
void testesm_handle_bearer_resource_modification(
test_ue_t *test_ue, ogs_nas_eps_message_t *message)
{
test_sess_t *sess = NULL;
ogs_assert(test_ue);
ogs_assert(message);
ogs_assert(message->esm.h.procedure_transaction_identity !=
OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED);
sess = test_sess_find_by_pti(
test_ue, message->esm.h.procedure_transaction_identity);
ogs_assert(sess);
}

View File

@ -24,12 +24,22 @@
extern "C" {
#endif
void testesm_handle_esm_information_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
void testesm_handle_pdn_connectivity_reject(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
void testesm_handle_activate_default_eps_bearer_context_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
void testesm_handle_activate_dedicated_eps_bearer_context_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
void testesm_handle_modify_eps_bearer_context_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
void testesm_handle_deactivate_eps_bearer_context_request(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
void testesm_handle_bearer_resource_allocation(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
void testesm_handle_bearer_resource_modification(
test_ue_t *test_ue, ogs_nas_eps_message_t *message);
#ifdef __cplusplus
}

View File

@ -196,8 +196,10 @@ void testesm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf)
test_ue->esm_message_type = message.esm.h.message_type;
switch (message.esm.h.message_type) {
case OGS_NAS_EPS_ESM_INFORMATION_REQUEST:
testesm_handle_esm_information_request(test_ue, &message);
break;
case OGS_NAS_EPS_PDN_CONNECTIVITY_REJECT:
testesm_handle_pdn_connectivity_reject(test_ue, &message);
break;
case OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST:
testesm_handle_activate_default_eps_bearer_context_request(
@ -208,13 +210,16 @@ void testesm_recv(test_ue_t *test_ue, ogs_pkbuf_t *pkbuf)
test_ue, &message);
break;
case OGS_NAS_EPS_MODIFY_EPS_BEARER_CONTEXT_REQUEST:
testesm_handle_modify_eps_bearer_context_request(test_ue, &message);
break;
case OGS_NAS_EPS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST:
testesm_handle_deactivate_eps_bearer_context_request(test_ue, &message);
break;
case OGS_NAS_EPS_BEARER_RESOURCE_ALLOCATION_REJECT:
testesm_handle_bearer_resource_allocation(test_ue, &message);
break;
case OGS_NAS_EPS_BEARER_RESOURCE_MODIFICATION_REJECT:
testesm_handle_bearer_resource_modification(test_ue, &message);
break;
default:
ogs_error("Unknown message[%d]", message.esm.h.message_type);

View File

@ -305,6 +305,273 @@ static void test1_func(abts_case *tc, void *data)
test_ue_remove(test_ue);
}
static void test_issues3072_func(abts_case *tc, void *data)
{
int rv;
ogs_socknode_t *s1ap;
ogs_socknode_t *gtpu;
ogs_pkbuf_t *emmbuf;
ogs_pkbuf_t *esmbuf;
ogs_pkbuf_t *sendbuf;
ogs_pkbuf_t *recvbuf;
ogs_s1ap_message_t message;
ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci;
test_ue_t *test_ue = NULL;
test_sess_t *sess = NULL;
test_bearer_t *bearer = NULL;
bson_t *doc = NULL;
/* Setup Test UE & Session Context */
memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci));
mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI;
mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI;
mobile_identity_suci.routing_indicator1 = 0;
mobile_identity_suci.routing_indicator2 = 0xf;
mobile_identity_suci.routing_indicator3 = 0xf;
mobile_identity_suci.routing_indicator4 = 0xf;
mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL;
mobile_identity_suci.home_network_pki_value = 0;
test_ue = test_ue_add_by_suci(&mobile_identity_suci, "3746000006");
ogs_assert(test_ue);
test_ue->e_cgi.cell_id = 0x19b010;
test_ue->nas.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE;
test_ue->nas.value = OGS_NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTACH;
test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc";
test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca";
sess = test_sess_add_by_apn(test_ue, "internet", OGS_GTP2_RAT_TYPE_EUTRAN);
ogs_assert(sess);
/* eNB connects to MME */
s1ap = tests1ap_client(AF_INET);
ABTS_PTR_NOTNULL(tc, s1ap);
/* eNB connects to SGW */
gtpu = test_gtpu_server(1, AF_INET);
ABTS_PTR_NOTNULL(tc, gtpu);
/* Send S1-Setup Reqeust */
sendbuf = test_s1ap_build_s1_setup_request(
S1AP_ENB_ID_PR_macroENB_ID, 0x19b0);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive S1-Setup Response */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(NULL, recvbuf);
/********** Insert Subscriber in Database */
doc = test_db_new_qos_flow(test_ue);
ABTS_PTR_NOTNULL(tc, doc);
ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc));
/* Send Attach Request */
memset(&sess->pdn_connectivity_param,
0, sizeof(sess->pdn_connectivity_param));
sess->pdn_connectivity_param.eit = 1;
sess->pdn_connectivity_param.pco = 1;
sess->pdn_connectivity_param.request_type =
OGS_NAS_EPS_REQUEST_TYPE_INITIAL;
esmbuf = testesm_build_pdn_connectivity_request(sess, false);
ABTS_PTR_NOTNULL(tc, esmbuf);
memset(&test_ue->attach_request_param,
0, sizeof(test_ue->attach_request_param));
test_ue->attach_request_param.guti = 1;
test_ue->attach_request_param.last_visited_registered_tai = 1;
test_ue->attach_request_param.drx_parameter = 1;
test_ue->attach_request_param.ms_network_capability = 1;
test_ue->attach_request_param.tmsi_status = 1;
test_ue->attach_request_param.mobile_station_classmark_2 = 1;
test_ue->attach_request_param.mobile_station_classmark_3 = 1;
test_ue->attach_request_param.supported_codecs = 1;
test_ue->attach_request_param.ue_usage_setting = 1;
test_ue->attach_request_param.old_guti_type = 1;
test_ue->attach_request_param.ms_network_feature_support = 1;
emmbuf = testemm_build_attach_request(test_ue, esmbuf, true, false);
ABTS_PTR_NOTNULL(tc, emmbuf);
memset(&test_ue->initial_ue_param, 0, sizeof(test_ue->initial_ue_param));
sendbuf = test_s1ap_build_initial_ue_message(
test_ue, emmbuf, S1AP_RRC_Establishment_Cause_mo_Signalling, false);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive Identity Request */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);
/* Send Identity response */
emmbuf = testemm_build_identity_response(test_ue);
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 Authentication Request */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);
/* Send Authentication response */
emmbuf = testemm_build_authentication_response(test_ue);
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 Security mode Command */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);
/* Send Security mode complete */
test_ue->mobile_identity_imeisv_presence = true;
emmbuf = testemm_build_security_mode_complete(test_ue);
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 ESM Information Request */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);
/* Send ESM Information Response */
esmbuf = testesm_build_esm_information_response(sess);
ABTS_PTR_NOTNULL(tc, esmbuf);
sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Receive SGsAP-Location-Update-Request */
recvbuf = testvlr_sgsap_read(sgsap);
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/*
* To raise the RACE CONDITION
* for the Create Bearer Request and InitialContextSetupRequest
*/
ogs_msleep(100);
/* Send SGsAP-Location-Update-Accept */
sendbuf = test_sgsap_location_update_accept(0);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testvlr_sgsap_send(sgsap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* 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);
/* Receive SGsAP TMSI-REALLOCATION-COMPLETE */
recvbuf = testvlr_sgsap_read(sgsap);
ABTS_PTR_NOTNULL(tc, recvbuf);
ogs_pkbuf_free(recvbuf);
/* Receive E-RABSetupRequest +
* Activate dedicated EPS bearer context request */
recvbuf = testenb_s1ap_read(s1ap);
ABTS_PTR_NOTNULL(tc, recvbuf);
tests1ap_recv(test_ue, recvbuf);
ABTS_INT_EQUAL(tc,
S1AP_ProcedureCode_id_E_RABSetup,
test_ue->s1ap_procedure_code);
/* Send E-RABSetupResponse */
bearer = test_bearer_find_by_ue_ebi(test_ue, 6);
ogs_assert(bearer);
sendbuf = test_s1ap_build_e_rab_setup_response(bearer);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
/* Send Activate dedicated EPS bearer context accept */
esmbuf = testesm_build_activate_dedicated_eps_bearer_context_accept(bearer);
ABTS_PTR_NOTNULL(tc, esmbuf);
sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf);
ABTS_PTR_NOTNULL(tc, sendbuf);
rv = testenb_s1ap_send(s1ap, sendbuf);
ABTS_INT_EQUAL(tc, OGS_OK, rv);
ogs_msleep(100);
/* 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);
ogs_msleep(100);
/********** Remove Subscriber in Database */
ABTS_INT_EQUAL(tc, OGS_OK, test_db_remove_ue(test_ue));
/* eNB disonncect from MME */
testenb_s1ap_close(s1ap);
/* eNB disonncect from SGW */
test_gtpu_close(gtpu);
test_ue_remove(test_ue);
}
static void test2_func(abts_case *tc, void *data)
{
int rv;
@ -1043,6 +1310,7 @@ abts_suite *test_mo_idle(abts_suite *suite)
suite = ADD_SUITE(suite)
abts_run_test(suite, test1_func, NULL);
abts_run_test(suite, test_issues3072_func, NULL);
abts_run_test(suite, test2_func, NULL);
abts_run_test(suite, test3_func, NULL);
abts_run_test(suite, test4_func, NULL);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -135,7 +135,6 @@ int test_s2b_send_create_session_request(test_sess_t *sess, bool handover_ind)
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_CREATE_SESSION_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->smf_s2b_c_teid;
pkbuf = test_s2b_build_create_session_request(h.type, sess, handover_ind);
@ -167,7 +166,6 @@ int test_s2b_send_delete_session_request(test_sess_t *sess)
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DELETE_SESSION_REQUEST_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->smf_s2b_c_teid;
pkbuf = test_s2b_build_delete_session_request(h.type, sess);
@ -203,7 +201,6 @@ int test_s2b_send_create_bearer_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->smf_s2b_c_teid;
pkbuf = test_s2b_build_create_bearer_response(h.type, bearer);
@ -239,7 +236,6 @@ int test_s2b_send_delete_bearer_response(
memset(&h, 0, sizeof(ogs_gtp2_header_t));
h.type = OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE;
h.teid_presence = OGS_GTP2_TEID_PRESENCE;
h.teid = sess->smf_s2b_c_teid;
pkbuf = test_s2b_build_delete_bearer_response(h.type, bearer);