Projects
osmocom:latest
open5gs
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 16
View file
open5gs_2.6.2.dsc -> open5gs_2.6.3.dsc
Changed
@@ -2,7 +2,7 @@ Source: open5gs Binary: open5gs-common, open5gs-mme, open5gs-sgwc, open5gs-smf, open5gs-amf, open5gs-sgwu, open5gs-upf, open5gs-hss, open5gs-pcrf, open5gs-nrf, open5gs-scp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg Architecture: any -Version: 2.6.2 +Version: 2.6.3 Maintainer: Harald Welte <laforge@gnumonks.org> Uploaders: Sukchan Lee <acetcom@gmail.com> Homepage: https://open5gs.org @@ -31,8 +31,8 @@ open5gs-udr deb net optional arch=any open5gs-upf deb net optional arch=any Checksums-Sha1: - a370923fa23cc91f422b84f2ea46d7f52442979c 14113060 open5gs_2.6.2.tar.xz + 062b6374186956af41192a4b297ea3c7e85ad80c 14116892 open5gs_2.6.3.tar.xz Checksums-Sha256: - 139b4785625ff07b6713ec57713438c288655c848b5285734f90088eec0bc769 14113060 open5gs_2.6.2.tar.xz + 7c07cabbe9cb5d0886993cddb16aaee7d97007a3fd1998e234cccd4dd69c2933 14116892 open5gs_2.6.3.tar.xz Files: - f83b2666ecb6f0c8261292c4084904ad 14113060 open5gs_2.6.2.tar.xz + d931a2b8835315104148d14efb21adb0 14116892 open5gs_2.6.3.tar.xz
View file
open5gs_2.6.2.tar.xz/.tarball-version -> open5gs_2.6.3.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -2.6.2 +2.6.3
View file
open5gs_2.6.2.tar.xz/debian/changelog -> open5gs_2.6.3.tar.xz/debian/changelog
Changed
@@ -1,3 +1,33 @@ +open5gs (2.6.3) unstable; urgency=medium + + * PFCP restoration + + -- Sukchan Lee <acetcom@gmail.com> Wed, 26 Apr 2023 10:45:45 +0900 + +open5gs (2.6.3~kinetic) kinetic; urgency=medium + + * PFCP restoration + + -- Sukchan Lee <acetcom@gmail.com> Wed, 26 Apr 2023 10:43:45 +0900 + +open5gs (2.6.3~jammy) jammy; urgency=medium + + * PFCP restoration + + -- Sukchan Lee <acetcom@gmail.com> Wed, 26 Apr 2023 10:41:51 +0900 + +open5gs (2.6.3~focal) focal; urgency=medium + + * PFCP restoration + + -- Sukchan Lee <acetcom@gmail.com> Wed, 26 Apr 2023 10:39:56 +0900 + +open5gs (2.6.3~bionic) bionic; urgency=medium + + * PFCP restoration + + -- Sukchan Lee <acetcom@gmail.com> Wed, 26 Apr 2023 10:37:04 +0900 + open5gs (2.6.2) unstable; urgency=medium * Bug Fixed
View file
open5gs_2.6.2.tar.xz/docs/_docs/guide/01-quickstart.md -> open5gs_2.6.3.tar.xz/docs/_docs/guide/01-quickstart.md
Changed
@@ -79,13 +79,14 @@ ```bash $ sudo apt update $ sudo apt install wget gnupg -$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - +$ wget -qO - https://pgp.mongodb.com/server-6.0.asc | sudo apt-key add - ``` Create the list file /etc/apt/sources.list.d/mongodb-org-6.0.list for your version of Ubuntu. +On ubuntu 22.04 (Jammy) ```bash -$ echo "deb arch=amd64,arm64 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list +$ echo "deb arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list ``` Install the MongoDB packages.
View file
open5gs_2.6.2.tar.xz/docs/_docs/guide/02-building-open5gs-from-sources.md -> open5gs_2.6.3.tar.xz/docs/_docs/guide/02-building-open5gs-from-sources.md
Changed
@@ -18,13 +18,14 @@ ```bash $ sudo apt update $ sudo apt install wget gnupg -$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - +$ wget -qO - https://pgp.mongodb.com/server-6.0.asc | sudo apt-key add - ``` Create the list file /etc/apt/sources.list.d/mongodb-org-6.0.list for your version of Ubuntu. +On ubuntu 22.04 (Jammy) ```bash -$ echo "deb arch=amd64,arm64 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list +$ echo "deb arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list ``` Install the MongoDB packages.
View file
open5gs_2.6.2.tar.xz/docs/_docs/tutorial/01-your-first-lte.md -> open5gs_2.6.3.tar.xz/docs/_docs/tutorial/01-your-first-lte.md
Changed
@@ -165,8 +165,8 @@ The Open5GS package is available on the recent versions of *Ubuntu*. ```bash # Install the MongoDB Packages -$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - -$ echo "deb arch=amd64,arm64 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list +$ wget -qO - https://pgp.mongodb.com/server-6.0.asc | sudo apt-key add - +$ echo "deb arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list $ sudo apt update $ sudo apt install mongodb-org
View file
open5gs_2.6.2.tar.xz/docs/_pages/docs.md -> open5gs_2.6.3.tar.xz/docs/_pages/docs.md
Changed
@@ -40,6 +40,7 @@ - @infinitydon - Open5GS on Amazon Elastic Kubernetes Service(https://aws.amazon.com/blogs/opensource/open-source-mobile-core-network-implementation-on-amazon-elastic-kubernetes-service/) - Kubernetes Open5GS Deployment(https://dev.to/infinitydon/virtual-4g-simulation-using-kubernetes-and-gns3-3b7k?fbclid=IwAR1p99h13a-mCfejanbBQe0H0-jp5grXkn5mWf1WrTHf47UtegB2-UHGGZQ) + - 5G Core SBI mTLS Using External Certificate PKI(https://futuredon.medium.com/5g-core-sbi-mtls-using-external-certificate-pki-4ffc02ac7728) - @nickvsnetworking - My first 5G Core : Open5GS and UERANSIM(http://nickvsnetworking.com/my-first-5g-core-open5gs-and-ueransim/)
View file
open5gs_2.6.2.tar.xz/docs/_pages/support.md -> open5gs_2.6.3.tar.xz/docs/_pages/support.md
Changed
@@ -21,7 +21,7 @@ We work with leading partners in mobile communications to offer our customers complete solutions. -**NextEPC(https://nextepc.com/)**: Established in U.S. in 2019, NextEPC Inc. provides the latest wireless telecommunications technologies and outstanding support to wireless solution providers and vendors around the world. Their solutions include scalable and versatile 4G/5G core network systems. They also offer professional development and customization services for Enterprise users. +**NextEPC(https://nextepc.com/)**: Established in U.S. in 2019, NextEPC Inc. provides the latest wireless telecommunications technologies and outstanding support to wireless solution providers and vendors around the world. Their solutions include scalable and versatile 4G/5G core network systems, recently a commercial-grade DPDK-accelerated UPF is also available. They offer professional development and customization services for Enterprise users. Please contact sales@nextepc.com(mailto:sales@nextepc.com) for more informations.
View file
open5gs_2.6.3.tar.xz/docs/_posts/2023-04-04-release-v2.6.2.md
Added
@@ -0,0 +1,15 @@ +--- +title: "v2.6.2 - Bug Fixes" +date: 2023-04-04 22:19:00 +0900 +categories: + - Release +tags: + - News + - Release +head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>" +--- + +See Release Note(https://github.com/open5gs/open5gs/releases/tag/v2.6.2) + +Download -- v2.6.2.tar.gz(https://github.com/open5gs/open5gs/archive/v2.6.2.tar.gz) +{: .notice--info}
View file
open5gs_2.6.3.tar.xz/docs/_posts/2023-04-26-release-v2.6.3.md
Added
@@ -0,0 +1,15 @@ +--- +title: "v2.6.3 - PFCP Restoration" +date: 2023-04-26 10:52:00 +0900 +categories: + - Release +tags: + - News + - Release +head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>" +--- + +See Release Note(https://github.com/open5gs/open5gs/releases/tag/v2.6.3) + +Download -- v2.6.3.tar.gz(https://github.com/open5gs/open5gs/archive/v2.6.3.tar.gz) +{: .notice--info}
View file
open5gs_2.6.2.tar.xz/docs/assets/webui/install -> open5gs_2.6.3.tar.xz/docs/assets/webui/install
Changed
@@ -10,7 +10,7 @@ # PACKAGE="open5gs" -VERSION="2.6.1" +VERSION="2.6.3" print_status() { echo
View file
open5gs_2.6.2.tar.xz/lib/app/ogs-context.c -> open5gs_2.6.3.tar.xz/lib/app/ogs-context.c
Changed
@@ -76,13 +76,13 @@ self.pool.message = self.max.ue * POOL_NUM_PER_UE; self.pool.event = self.max.ue * POOL_NUM_PER_UE; self.pool.socket = self.max.ue * POOL_NUM_PER_UE; - self.pool.subscription = self.max.ue * POOL_NUM_PER_UE; self.pool.xact = self.max.ue * POOL_NUM_PER_UE; self.pool.stream = self.max.ue * POOL_NUM_PER_UE; self.pool.nf = self.max.peer; #define NF_SERVICE_PER_NF_INSTANCE 16 self.pool.nf_service = self.pool.nf * NF_SERVICE_PER_NF_INSTANCE; + self.pool.subscription = self.pool.nf * NF_SERVICE_PER_NF_INSTANCE; self.pool.gtp_node = self.pool.nf; if (self.max.gtp_peer)
View file
open5gs_2.6.2.tar.xz/lib/core/ogs-core.c -> open5gs_2.6.3.tar.xz/lib/core/ogs-core.c
Changed
@@ -38,9 +38,9 @@ void ogs_core_initialize(void) { + ogs_mem_init(); ogs_log_init(); ogs_pkbuf_init(); - ogs_mem_init(); ogs_socket_init(); ogs_tlv_init(); @@ -56,9 +56,9 @@ { ogs_tlv_final(); ogs_socket_final(); - ogs_mem_final(); ogs_pkbuf_final(); ogs_log_final(); + ogs_mem_final(); } ogs_core_context_t *ogs_core(void)
View file
open5gs_2.6.2.tar.xz/lib/core/ogs-memory.h -> open5gs_2.6.3.tar.xz/lib/core/ogs-memory.h
Changed
@@ -58,7 +58,7 @@ void *ptr, size_t size, const char *file_line); int ogs_free_debug(void *ptr); -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 /***************************************** * Memory Pool - Use talloc library
View file
open5gs_2.6.2.tar.xz/lib/core/ogs-pkbuf.c -> open5gs_2.6.3.tar.xz/lib/core/ogs-pkbuf.c
Changed
@@ -99,6 +99,7 @@ { #if OGS_USE_TALLOC == 0 ogs_pool_init(&pkbuf_pool, ogs_core()->pkbuf.pool); + #endif } @@ -219,7 +220,7 @@ ogs_pkbuf_t *ogs_pkbuf_alloc_debug( ogs_pkbuf_pool_t *pool, unsigned int size, const char *file_line) { -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 ogs_pkbuf_t *pkbuf = NULL; pkbuf = ogs_talloc_zero_size(pool, sizeof(*pkbuf) + size, file_line); @@ -287,7 +288,7 @@ void ogs_pkbuf_free(ogs_pkbuf_t *pkbuf) { -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 ogs_talloc_free(pkbuf, OGS_FILE_LINE); #else ogs_pkbuf_pool_t *pool = NULL; @@ -315,7 +316,7 @@ ogs_pkbuf_t *ogs_pkbuf_copy_debug(ogs_pkbuf_t *pkbuf, const char *file_line) { -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 ogs_pkbuf_t *newbuf; #else ogs_pkbuf_pool_t *pool = NULL; @@ -331,7 +332,7 @@ return NULL; } -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 newbuf = ogs_pkbuf_alloc_debug(NULL, size, file_line); if (!newbuf) { ogs_error("ogs_pkbuf_alloc() failed size=%d", size);
View file
open5gs_2.6.2.tar.xz/lib/core/ogs-pkbuf.h -> open5gs_2.6.3.tar.xz/lib/core/ogs-pkbuf.h
Changed
@@ -35,7 +35,7 @@ unsigned int reference_count; } ogs_cluster_t; -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 typedef void ogs_pkbuf_pool_t; #else typedef struct ogs_pkbuf_pool_s ogs_pkbuf_pool_t;
View file
open5gs_2.6.2.tar.xz/lib/core/ogs-pool.h -> open5gs_2.6.3.tar.xz/lib/core/ogs-pool.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -28,7 +28,15 @@ extern "C" { #endif -typedef unsigned int ogs_index_t; +#if OGS_USE_TALLOC == 1 +#define ogs_pool_create ogs_malloc +#define ogs_pool_destroy ogs_free +#else +#define ogs_pool_create malloc +#define ogs_pool_destroy free +#endif + +typedef uint32_t ogs_pool_id_t; #define OGS_POOL(pool, type) \ struct { \ @@ -41,11 +49,11 @@ #define ogs_pool_init(pool, _size) do { \ int i; \ (pool)->name = #pool; \ - (pool)->free = malloc(sizeof(*(pool)->free) * _size); \ + (pool)->free = ogs_pool_create(sizeof(*(pool)->free) * _size); \ ogs_assert((pool)->free); \ - (pool)->array = malloc(sizeof(*(pool)->array) * _size); \ + (pool)->array = ogs_pool_create(sizeof(*(pool)->array) * _size); \ ogs_assert((pool)->array); \ - (pool)->index = malloc(sizeof(*(pool)->index) * _size); \ + (pool)->index = ogs_pool_create(sizeof(*(pool)->index) * _size); \ ogs_assert((pool)->index); \ (pool)->size = (pool)->avail = _size; \ (pool)->head = (pool)->tail = 0; \ @@ -59,9 +67,9 @@ if (((pool)->size != (pool)->avail)) \ ogs_error("%d in '%s%d' were not released.", \ (pool)->size - (pool)->avail, (pool)->name, (pool)->size); \ - free((pool)->free); \ - free((pool)->array); \ - free((pool)->index); \ + ogs_pool_destroy((pool)->free); \ + ogs_pool_destroy((pool)->array); \ + ogs_pool_destroy((pool)->index); \ } while (0) #define ogs_pool_index(pool, node) (((node) - (pool)->array)+1) @@ -93,30 +101,23 @@ #define ogs_pool_size(pool) ((pool)->size) #define ogs_pool_avail(pool) ((pool)->avail) -#define ogs_index_init(pool, _size) do { \ +#define ogs_pool_sequence_id_generate(pool) do { \ int i; \ - (pool)->name = #pool; \ - (pool)->free = ogs_malloc(sizeof(*(pool)->free) * _size); \ - ogs_assert((pool)->free); \ - (pool)->array = ogs_malloc(sizeof(*(pool)->array) * _size); \ - ogs_assert((pool)->array); \ - (pool)->index = ogs_malloc(sizeof(*(pool)->index) * _size); \ - ogs_assert((pool)->index); \ - (pool)->size = (pool)->avail = _size; \ - (pool)->head = (pool)->tail = 0; \ - for (i = 0; i < _size; i++) { \ - (pool)->freei = &((pool)->arrayi); \ - (pool)->indexi = NULL; \ - } \ + for (i = 0; i < (pool)->size; i++) \ + (pool)->arrayi = i+1; \ } while (0) -#define ogs_index_final(pool) do { \ - if (((pool)->size != (pool)->avail)) \ - ogs_error("%d in '%s%d' were not released.", \ - (pool)->size - (pool)->avail, (pool)->name, (pool)->size); \ - ogs_free((pool)->free); \ - ogs_free((pool)->array); \ - ogs_free((pool)->index); \ +#define ogs_pool_random_id_generate(pool) do { \ + int i, j; \ + ogs_pool_id_t temp; \ + for (i = 0; i < (pool)->size; i++) \ + (pool)->arrayi = i+1; \ + for (i = (pool)->size - 1; i > 0; i--) { \ + j = ogs_random32() % (i + 1); \ + temp = (pool)->arrayi; \ + (pool)->arrayi = (pool)->arrayj; \ + (pool)->arrayj = temp; \ + } \ } while (0) #ifdef __cplusplus
View file
open5gs_2.6.2.tar.xz/lib/core/ogs-strings.h -> open5gs_2.6.3.tar.xz/lib/core/ogs-strings.h
Changed
@@ -110,7 +110,7 @@ char *source, const char *file_line, const char *message, ...) OGS_GNUC_PRINTF(3, 4); -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 /***************************************** * Memory Pool - Use talloc library
View file
open5gs_2.6.2.tar.xz/lib/gtp/v1/build.c -> open5gs_2.6.3.tar.xz/lib/gtp/v1/build.c
Changed
@@ -1,6 +1,7 @@ /* * 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 Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. *
View file
open5gs_2.6.2.tar.xz/lib/gtp/v1/build.h -> open5gs_2.6.3.tar.xz/lib/gtp/v1/build.h
Changed
@@ -1,6 +1,7 @@ /* * 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 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -31,6 +32,7 @@ ogs_pkbuf_t *ogs_gtp1_build_echo_request(uint8_t type); ogs_pkbuf_t *ogs_gtp1_build_echo_response(uint8_t type, uint8_t recovery); + #ifdef __cplusplus } #endif
View file
open5gs_2.6.2.tar.xz/lib/gtp/v1/path.c -> open5gs_2.6.3.tar.xz/lib/gtp/v1/path.c
Changed
@@ -1,6 +1,7 @@ /* * 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 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -143,8 +144,7 @@ ogs_expect(rv == OGS_OK); } -void ogs_gtp1_send_echo_request( - ogs_gtp_node_t *gnode) +void ogs_gtp1_send_echo_request(ogs_gtp_node_t *gnode) { int rv; ogs_pkbuf_t *pkbuf = NULL;
View file
open5gs_2.6.2.tar.xz/lib/gtp/v2/build.c -> open5gs_2.6.3.tar.xz/lib/gtp/v2/build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -57,7 +57,7 @@ return ogs_gtp2_build_msg(>p_message); } -ogs_pkbuf_t *ogs_gtp2_build_error_indication( +ogs_pkbuf_t *ogs_gtp1_build_error_indication( uint32_t teid, ogs_sockaddr_t *addr) { ogs_pkbuf_t *pkbuf = NULL; @@ -112,3 +112,91 @@ return pkbuf; } + +void ogs_gtp2_fill_header( + ogs_gtp2_header_t *gtp_hdesc, ogs_gtp2_extension_header_t *ext_hdesc, + ogs_pkbuf_t *pkbuf) +{ + ogs_gtp2_header_t *gtp_h = NULL; + ogs_gtp2_extension_header_t *ext_h = NULL; + uint8_t flags; + uint8_t gtp_hlen = 0; + + ogs_assert(gtp_hdesc); + ogs_assert(ext_hdesc); + ogs_assert(pkbuf); + + /* Processing GTP Flags */ + flags = gtp_hdesc->flags; + flags |= OGS_GTPU_FLAGS_V | OGS_GTPU_FLAGS_PT; + if (ext_hdesc->qos_flow_identifier) flags |= OGS_GTPU_FLAGS_E; + + /* Define GTP Header Size */ + if (flags & OGS_GTPU_FLAGS_E) + gtp_hlen = OGS_GTPV1U_HEADER_LEN+8; + else if (flags & (OGS_GTPU_FLAGS_S|OGS_GTPU_FLAGS_PN)) + gtp_hlen = OGS_GTPV1U_HEADER_LEN+4; + else + gtp_hlen = OGS_GTPV1U_HEADER_LEN; + + ogs_pkbuf_push(pkbuf, gtp_hlen); + + /* Fill GTP Header */ + gtp_h = (ogs_gtp2_header_t *)pkbuf->data; + ogs_assert(gtp_h); + memset(gtp_h, 0, gtp_hlen); + + gtp_h->flags = flags; + gtp_h->type = gtp_hdesc->type; + + if (gtp_h->type == OGS_GTPU_MSGTYPE_ECHO_REQ || + gtp_h->type == OGS_GTPU_MSGTYPE_ECHO_RSP || + gtp_h->type == OGS_GTPU_MSGTYPE_ERR_IND) { + /* + * TS29.281 5.1 General format in GTP-U header + * + * - The Echo Request/Response and Supported Extension Headers + * notification messages, where the Tunnel Endpoint Identifier + * shall be set to all zeroes. + * - The Error Indication message where the Tunnel Endpoint Identifier + * shall be set to all zeros. + */ + ogs_assert(gtp_hdesc->teid == 0); + } + + gtp_h->teid = htobe32(gtp_hdesc->teid); + + /* + * TS29.281 5.1 General format in GTP-U header + * + * Length: This field indicates the length in octets of the payload, + * i.e. the rest of the packet following the mandatory part of + * the GTP header (that is the first 8 octets). The Sequence Number, + * the N-PDU Number or any Extension headers shall be considered + * to be part of the payload, i.e. included in the length count. + */ + gtp_h->length = htobe16(pkbuf->len - OGS_GTPV1U_HEADER_LEN); + + /* Fill Extention Header */ + if (gtp_h->flags & OGS_GTPU_FLAGS_E) { + ext_h = (ogs_gtp2_extension_header_t *) + (pkbuf->data + OGS_GTPV1U_HEADER_LEN); + ogs_assert(ext_h); + + if (ext_hdesc->qos_flow_identifier) { + /* 5G Core */ + ext_h->type = OGS_GTP2_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER; + ext_h->len = 1; + ext_h->pdu_type = ext_hdesc->pdu_type; + ext_h->qos_flow_identifier = ext_hdesc->qos_flow_identifier; + ext_h->next_type = + OGS_GTP2_EXTENSION_HEADER_TYPE_NO_MORE_EXTENSION_HEADERS; + } else { + /* EPC */ + ext_h->type = ext_hdesc->type; + ext_h->len = 1; + ext_h->next_type = + OGS_GTP2_EXTENSION_HEADER_TYPE_NO_MORE_EXTENSION_HEADERS; + } + } +}
View file
open5gs_2.6.2.tar.xz/lib/gtp/v2/build.h -> open5gs_2.6.3.tar.xz/lib/gtp/v2/build.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -33,9 +33,13 @@ ogs_pkbuf_t *ogs_gtp2_build_echo_response( uint8_t type, uint8_t recovery, uint8_t features); -ogs_pkbuf_t *ogs_gtp2_build_error_indication( +ogs_pkbuf_t *ogs_gtp1_build_error_indication( uint32_t teid, ogs_sockaddr_t *addr); +void ogs_gtp2_fill_header( + ogs_gtp2_header_t *gtp_hdesc, ogs_gtp2_extension_header_t *ext_hdesc, + ogs_pkbuf_t *pkbuf); + #ifdef __cplusplus } #endif
View file
open5gs_2.6.2.tar.xz/lib/gtp/v2/path.c -> open5gs_2.6.3.tar.xz/lib/gtp/v2/path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -27,92 +27,11 @@ char bufOGS_ADDRSTRLEN; int rv; - ogs_gtp2_header_t *gtp_h = NULL; - ogs_gtp2_extension_header_t *ext_h = NULL; - uint8_t flags; - uint8_t gtp_hlen = 0; - - ogs_assert(gnode); - ogs_assert(gtp_hdesc); - ogs_assert(ext_hdesc); - ogs_assert(pkbuf); - - /* Processing GTP Flags */ - flags = gtp_hdesc->flags; - flags |= OGS_GTPU_FLAGS_V | OGS_GTPU_FLAGS_PT; - if (ext_hdesc->qos_flow_identifier) flags |= OGS_GTPU_FLAGS_E; - - /* Define GTP Header Size */ - if (flags & OGS_GTPU_FLAGS_E) - gtp_hlen = OGS_GTPV1U_HEADER_LEN+8; - else if (flags & (OGS_GTPU_FLAGS_S|OGS_GTPU_FLAGS_PN)) - gtp_hlen = OGS_GTPV1U_HEADER_LEN+4; - else - gtp_hlen = OGS_GTPV1U_HEADER_LEN; - - ogs_pkbuf_push(pkbuf, gtp_hlen); - - /* Fill GTP Header */ - gtp_h = (ogs_gtp2_header_t *)pkbuf->data; - ogs_assert(gtp_h); - memset(gtp_h, 0, gtp_hlen); - - gtp_h->flags = flags; - gtp_h->type = gtp_hdesc->type; - - if (gtp_h->type == OGS_GTPU_MSGTYPE_ECHO_REQ || - gtp_h->type == OGS_GTPU_MSGTYPE_ECHO_RSP || - gtp_h->type == OGS_GTPU_MSGTYPE_ERR_IND) { - /* - * TS29.281 5.1 General format in GTP-U header - * - * - The Echo Request/Response and Supported Extension Headers - * notification messages, where the Tunnel Endpoint Identifier - * shall be set to all zeroes. - * - The Error Indication message where the Tunnel Endpoint Identifier - * shall be set to all zeros. - */ - ogs_assert(gtp_hdesc->teid == 0); - } - - gtp_h->teid = htobe32(gtp_hdesc->teid); - - /* - * TS29.281 5.1 General format in GTP-U header - * - * Length: This field indicates the length in octets of the payload, - * i.e. the rest of the packet following the mandatory part of - * the GTP header (that is the first 8 octets). The Sequence Number, - * the N-PDU Number or any Extension headers shall be considered - * to be part of the payload, i.e. included in the length count. - */ - gtp_h->length = htobe16(pkbuf->len - OGS_GTPV1U_HEADER_LEN); - - /* Fill Extention Header */ - if (gtp_h->flags & OGS_GTPU_FLAGS_E) { - ext_h = (ogs_gtp2_extension_header_t *) - (pkbuf->data + OGS_GTPV1U_HEADER_LEN); - ogs_assert(ext_h); - - if (ext_hdesc->qos_flow_identifier) { - /* 5G Core */ - ext_h->type = OGS_GTP2_EXTENSION_HEADER_TYPE_PDU_SESSION_CONTAINER; - ext_h->len = 1; - ext_h->pdu_type = ext_hdesc->pdu_type; - ext_h->qos_flow_identifier = ext_hdesc->qos_flow_identifier; - ext_h->next_type = - OGS_GTP2_EXTENSION_HEADER_TYPE_NO_MORE_EXTENSION_HEADERS; - } else { - /* EPC */ - ext_h->type = ext_hdesc->type; - ext_h->len = 1; - ext_h->next_type = - OGS_GTP2_EXTENSION_HEADER_TYPE_NO_MORE_EXTENSION_HEADERS; - } - } + ogs_gtp2_fill_header(gtp_hdesc, ext_hdesc, pkbuf); ogs_trace("SEND GTP-U%d to Peer%s : TEID0x%x", gtp_hdesc->type, OGS_ADDR(&gnode->addr, buf), gtp_hdesc->teid); + rv = ogs_gtp_sendto(gnode, pkbuf); if (rv != OGS_OK) { if (ogs_socket_errno != OGS_EAGAIN) { @@ -342,3 +261,39 @@ rv = ogs_gtp_xact_commit(xact); ogs_expect(rv == OGS_OK); } + +void ogs_gtp1_send_error_indication( + ogs_sock_t *sock, uint32_t teid, uint8_t qfi, const ogs_sockaddr_t *to) +{ + ssize_t sent; + ogs_pkbuf_t *pkbuf = NULL; + + ogs_gtp2_header_t gtp_hdesc; + ogs_gtp2_extension_header_t ext_hdesc; + + ogs_assert(sock); + ogs_assert(to); + + pkbuf = ogs_gtp1_build_error_indication(teid, &sock->local_addr); + if (!pkbuf) { + ogs_error("ogs_gtp1_build_error_indication() failed"); + return; + } + + memset(>p_hdesc, 0, sizeof(gtp_hdesc)); + memset(&ext_hdesc, 0, sizeof(ext_hdesc)); + + gtp_hdesc.type = OGS_GTPU_MSGTYPE_ERR_IND; + gtp_hdesc.flags = OGS_GTPU_FLAGS_S|OGS_GTPU_FLAGS_E; + ext_hdesc.type = OGS_GTP2_EXTENSION_HEADER_TYPE_UDP_PORT; + ext_hdesc.qos_flow_identifier = qfi; + + ogs_gtp2_fill_header(>p_hdesc, &ext_hdesc, pkbuf); + + sent = ogs_sendto(sock->fd, pkbuf->data, pkbuf->len, 0, to); + if (sent < 0 || sent != pkbuf->len) { + ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno, + "ogs_sendto() failed"); + } + ogs_pkbuf_free(pkbuf); +}
View file
open5gs_2.6.2.tar.xz/lib/gtp/v2/path.h -> open5gs_2.6.3.tar.xz/lib/gtp/v2/path.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -44,6 +44,9 @@ void ogs_gtp2_send_echo_response(ogs_gtp_xact_t *xact, uint8_t recovery, uint8_t features); +void ogs_gtp1_send_error_indication( + ogs_sock_t *sock, uint32_t teid, uint8_t qfi, const ogs_sockaddr_t *to); + #ifdef __cplusplus } #endif
View file
open5gs_2.6.2.tar.xz/lib/gtp/xact.h -> open5gs_2.6.3.tar.xz/lib/gtp/xact.h
Changed
@@ -1,6 +1,7 @@ /* * 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 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -57,7 +58,7 @@ */ typedef struct ogs_gtp_xact_s { ogs_lnode_t node; /**< A node of list */ - ogs_index_t index; + ogs_pool_id_t index; uint8_t gtp_version; /**< 1 or 2 */
View file
open5gs_2.6.2.tar.xz/lib/pfcp/build.c -> open5gs_2.6.3.tar.xz/lib/pfcp/build.c
Changed
@@ -446,17 +446,15 @@ ogs_assert(pdr); - if (ogs_pfcp_self()->up_function_features.ftup) { - if (pdr->f_teid_len) { - memcpy(&pdrbufi.f_teid, &pdr->f_teid, pdr->f_teid_len); - pdrbufi.f_teid.teid = htobe32(pdr->f_teid.teid); + if (pdr->f_teid_len) { + memcpy(&pdrbufi.f_teid, &pdr->f_teid, pdr->f_teid_len); + pdrbufi.f_teid.teid = htobe32(pdr->f_teid.teid); - message->local_f_teid.presence = 1; - message->local_f_teid.data = &pdrbufi.f_teid; - message->local_f_teid.len = pdr->f_teid_len; + message->local_f_teid.presence = 1; + message->local_f_teid.data = &pdrbufi.f_teid; + message->local_f_teid.len = pdr->f_teid_len; - pdr_presence = true; - } + pdr_presence = true; } if (pdr_presence == true) {
View file
open5gs_2.6.2.tar.xz/lib/pfcp/context.c -> open5gs_2.6.3.tar.xz/lib/pfcp/context.c
Changed
@@ -27,18 +27,23 @@ static OGS_POOL(ogs_pfcp_node_pool, ogs_pfcp_node_t); static OGS_POOL(ogs_pfcp_sess_pool, ogs_pfcp_sess_t); -static OGS_POOL(ogs_pfcp_pdr_pool, ogs_pfcp_pdr_t); static OGS_POOL(ogs_pfcp_far_pool, ogs_pfcp_far_t); static OGS_POOL(ogs_pfcp_urr_pool, ogs_pfcp_urr_t); static OGS_POOL(ogs_pfcp_qer_pool, ogs_pfcp_qer_t); static OGS_POOL(ogs_pfcp_bar_pool, ogs_pfcp_bar_t); +static OGS_POOL(ogs_pfcp_pdr_pool, ogs_pfcp_pdr_t); +static OGS_POOL(ogs_pfcp_pdr_teid_pool, ogs_pool_id_t); +static ogs_pool_id_t *pdr_random_to_index; + +static OGS_POOL(ogs_pfcp_rule_pool, ogs_pfcp_rule_t); + static OGS_POOL(ogs_pfcp_dev_pool, ogs_pfcp_dev_t); static OGS_POOL(ogs_pfcp_subnet_pool, ogs_pfcp_subnet_t); -static OGS_POOL(ogs_pfcp_rule_pool, ogs_pfcp_rule_t); void ogs_pfcp_context_init(void) { + int i; ogs_assert(context_initialized == 0); /* Initialize SMF context */ @@ -52,8 +57,6 @@ ogs_pool_init(&ogs_pfcp_sess_pool, ogs_app()->pool.sess); - ogs_pool_init(&ogs_pfcp_pdr_pool, - ogs_app()->pool.sess * OGS_MAX_NUM_OF_PDR); ogs_pool_init(&ogs_pfcp_far_pool, ogs_app()->pool.sess * OGS_MAX_NUM_OF_FAR); ogs_pool_init(&ogs_pfcp_urr_pool, @@ -63,6 +66,17 @@ ogs_pool_init(&ogs_pfcp_bar_pool, ogs_app()->pool.sess * OGS_MAX_NUM_OF_BAR); + ogs_pool_init(&ogs_pfcp_pdr_pool, + ogs_app()->pool.sess * OGS_MAX_NUM_OF_PDR); + ogs_pool_init(&ogs_pfcp_pdr_teid_pool, ogs_pfcp_pdr_pool.size); + ogs_pool_random_id_generate(&ogs_pfcp_pdr_teid_pool); + + pdr_random_to_index = ogs_calloc( + sizeof(ogs_pool_id_t), ogs_pfcp_pdr_pool.size); + ogs_assert(pdr_random_to_index); + for (i = 0; i < ogs_pfcp_pdr_pool.size; i++) + pdr_random_to_indexogs_pfcp_pdr_teid_pool.arrayi = i; + ogs_pool_init(&ogs_pfcp_rule_pool, ogs_app()->pool.sess * OGS_MAX_NUM_OF_PDR * OGS_MAX_NUM_OF_FLOW_IN_PDR); @@ -98,8 +112,11 @@ ogs_pool_final(&ogs_pfcp_subnet_pool); ogs_pool_final(&ogs_pfcp_rule_pool); - ogs_pool_final(&ogs_pfcp_sess_pool); ogs_pool_final(&ogs_pfcp_pdr_pool); + ogs_pool_final(&ogs_pfcp_pdr_teid_pool); + ogs_free(pdr_random_to_index); + + ogs_pool_final(&ogs_pfcp_sess_pool); ogs_pool_final(&ogs_pfcp_far_pool); ogs_pool_final(&ogs_pfcp_urr_pool); ogs_pool_final(&ogs_pfcp_qer_pool); @@ -894,6 +911,16 @@ } memset(pdr, 0, sizeof *pdr); + pdr->obj.type = OGS_PFCP_OBJ_PDR_TYPE; + pdr->src_if = OGS_PFCP_INTERFACE_UNKNOWN; + + /* Set TEID */ + ogs_pool_alloc(&ogs_pfcp_pdr_teid_pool, &pdr->teid_node); + ogs_assert(pdr->teid_node); + + pdr->teid = *(pdr->teid_node); + + /* Set PDR-ID */ ogs_pool_alloc(&sess->pdr_id_pool, &pdr->id_node); if (pdr->id_node == NULL) { ogs_error("pdr_id_pool() failed"); @@ -901,17 +928,9 @@ return NULL; } - pdr->obj.type = OGS_PFCP_OBJ_PDR_TYPE; - - pdr->index = ogs_pool_index(&ogs_pfcp_pdr_pool, pdr); - ogs_assert(pdr->index > 0 && - pdr->index <= ogs_app()->pool.sess * OGS_MAX_NUM_OF_PDR); - pdr->id = *(pdr->id_node); ogs_assert(pdr->id > 0 && pdr->id <= OGS_MAX_NUM_OF_PDR); - pdr->src_if = OGS_PFCP_INTERFACE_UNKNOWN; - pdr->sess = sess; ogs_list_add(&sess->pdr_list, pdr); @@ -948,12 +967,88 @@ return pdr; } +void ogs_pfcp_pdr_swap_teid(ogs_pfcp_pdr_t *pdr) +{ + int i = 0; + + ogs_assert(pdr); + ogs_assert(pdr->f_teid.teid > 0 && + pdr->f_teid.teid <= ogs_pfcp_pdr_teid_pool.size); + + /* Find out the Array Index for the restored TEID. */ + i = pdr_random_to_indexpdr->f_teid.teid; + ogs_assert(i < ogs_pfcp_pdr_teid_pool.size); + + ogs_assert(pdr->teid_node); + /* + * If SWAP has already done this, it will not try this again. + * This situation can occur when multiple PDRs are restored + * with the same TEID. + */ + if (pdr->f_teid.teid == ogs_pfcp_pdr_teid_pool.arrayi) { + ogs_pfcp_pdr_teid_pool.arrayi = *(pdr->teid_node); + *(pdr->teid_node) = pdr->f_teid.teid; + } +} + void ogs_pfcp_object_teid_hash_set( - ogs_pfcp_object_type_e type, ogs_pfcp_pdr_t *pdr) + ogs_pfcp_object_type_e type, ogs_pfcp_pdr_t *pdr, + bool restoration_indication) { ogs_assert(type); ogs_assert(pdr); + if (ogs_pfcp_self()->up_function_features.ftup && pdr->f_teid.ch) { + + ogs_pfcp_pdr_t *choosed_pdr = NULL; + + if (pdr->f_teid.chid) { + choosed_pdr = ogs_pfcp_pdr_find_by_choose_id( + pdr->sess, pdr->f_teid.choose_id); + if (!choosed_pdr) { + pdr->chid = true; + pdr->choose_id = pdr->f_teid.choose_id; + } + } + + if (choosed_pdr) { + pdr->f_teid_len = choosed_pdr->f_teid_len; + memcpy(&pdr->f_teid, &choosed_pdr->f_teid, pdr->f_teid_len); + + } else { + ogs_gtpu_resource_t *resource = NULL; + resource = ogs_pfcp_find_gtpu_resource( + &ogs_gtp_self()->gtpu_resource_list, + pdr->dnn, OGS_PFCP_INTERFACE_ACCESS); + if (resource) { + ogs_assert( + (resource->info.v4 && pdr->f_teid.ipv4) || + (resource->info.v6 && pdr->f_teid.ipv6)); + ogs_assert(OGS_OK == + ogs_pfcp_user_plane_ip_resource_info_to_f_teid( + &resource->info, &pdr->f_teid, &pdr->f_teid_len)); + if (resource->info.teidri) + pdr->f_teid.teid = OGS_PFCP_GTPU_INDEX_TO_TEID( + pdr->teid, resource->info.teidri, + resource->info.teid_range); + else + pdr->f_teid.teid = pdr->teid; + } else { + ogs_assert( + (ogs_gtp_self()->gtpu_addr && pdr->f_teid.ipv4) || + (ogs_gtp_self()->gtpu_addr6 && pdr->f_teid.ipv6)); + ogs_assert(OGS_OK == + ogs_pfcp_sockaddr_to_f_teid( + pdr->f_teid.ipv4 ? + ogs_gtp_self()->gtpu_addr : NULL, + pdr->f_teid.ipv6 ? + ogs_gtp_self()->gtpu_addr6 : NULL, + &pdr->f_teid, &pdr->f_teid_len)); + pdr->f_teid.teid = pdr->teid; + } + } + } + if (pdr->hash.teid.len) ogs_hash_set(self.object_teid_hash, &pdr->hash.teid.key, pdr->hash.teid.len, NULL); @@ -1107,6 +1202,7 @@ ogs_free(pdr->ipv6_framed_routes); } + ogs_pool_free(&ogs_pfcp_pdr_teid_pool, pdr->teid_node); ogs_pool_free(&ogs_pfcp_pdr_pool, pdr); } @@ -1220,7 +1316,7 @@
View file
open5gs_2.6.2.tar.xz/lib/pfcp/context.h -> open5gs_2.6.3.tar.xz/lib/pfcp/context.h
Changed
@@ -137,7 +137,9 @@ typedef struct ogs_pfcp_pdr_s { ogs_pfcp_object_t obj; - uint32_t index; + + ogs_pool_id_t *teid_node; /* A node of TEID */ + ogs_pool_id_t teid; ogs_lnode_t to_create_node; ogs_lnode_t to_modify_node; @@ -399,8 +401,11 @@ ogs_pfcp_pdr_t *ogs_pfcp_pdr_find_or_add( ogs_pfcp_sess_t *sess, ogs_pfcp_pdr_id_t id); +void ogs_pfcp_pdr_swap_teid(ogs_pfcp_pdr_t *pdr); + void ogs_pfcp_object_teid_hash_set( - ogs_pfcp_object_type_e type, ogs_pfcp_pdr_t *pdr); + ogs_pfcp_object_type_e type, ogs_pfcp_pdr_t *pdr, + bool restoration_indication); ogs_pfcp_object_t *ogs_pfcp_object_find_by_teid(uint32_t teid); int ogs_pfcp_object_count_by_teid(ogs_pfcp_sess_t *sess, uint32_t teid); @@ -422,7 +427,11 @@ ogs_pfcp_sess_t *sess, ogs_pfcp_far_id_t id); void ogs_pfcp_far_f_teid_hash_set(ogs_pfcp_far_t *far); -ogs_pfcp_far_t *ogs_pfcp_far_find_by_error_indication(ogs_pkbuf_t *pkbuf); +ogs_pfcp_far_t *ogs_pfcp_far_find_by_gtpu_error_indication( + ogs_pkbuf_t *pkbuf); +ogs_pfcp_far_t *ogs_pfcp_far_find_by_pfcp_session_report( + ogs_pfcp_sess_t *sess, + ogs_pfcp_tlv_error_indication_report_t *error_indication_report); void ogs_pfcp_far_teid_hash_set(ogs_pfcp_far_t *far); ogs_pfcp_far_t *ogs_pfcp_far_find_by_teid(uint32_t teid);
View file
open5gs_2.6.2.tar.xz/lib/pfcp/handler.c -> open5gs_2.6.3.tar.xz/lib/pfcp/handler.c
Changed
@@ -320,6 +320,7 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_create_pdr(ogs_pfcp_sess_t *sess, ogs_pfcp_tlv_create_pdr_t *message, + ogs_pfcp_sereq_flags_t *sereq_flags, uint8_t *cause_value, uint8_t *offending_ie_value) { ogs_pfcp_pdr_t *pdr = NULL; @@ -376,6 +377,18 @@ *offending_ie_value = OGS_PFCP_F_TEID_TYPE; return NULL; } + + if (f_teid.ch == 0) { + if (sereq_flags && sereq_flags->restoration_indication == 1) { + f_teid.teid = be32toh(f_teid.teid); + if (ogs_pfcp_object_find_by_teid(f_teid.teid)) { + ogs_error("TEID:%x had already been allocated", f_teid.teid); + *cause_value = OGS_PFCP_CAUSE_INVALID_F_TEID_ALLOCATION_OPTION; + *offending_ie_value = OGS_PFCP_F_TEID_TYPE; + return NULL; + } + } + } } pdr->src_if = message->pdi.source_interface.u8; @@ -398,7 +411,6 @@ if (sdf_filter.bid) { oppsite_direction_rule = ogs_pfcp_rule_find_by_sdf_filter_id( sess, sdf_filter.sdf_filter_id); - } if (!oppsite_direction_rule && !sdf_filter.fd) {
View file
open5gs_2.6.2.tar.xz/lib/pfcp/handler.h -> open5gs_2.6.3.tar.xz/lib/pfcp/handler.h
Changed
@@ -53,6 +53,7 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_create_pdr(ogs_pfcp_sess_t *sess, ogs_pfcp_tlv_create_pdr_t *message, + ogs_pfcp_sereq_flags_t *sereq_flags, uint8_t *cause_value, uint8_t *offending_ie_value); ogs_pfcp_pdr_t *ogs_pfcp_handle_created_pdr(ogs_pfcp_sess_t *sess, ogs_pfcp_tlv_created_pdr_t *message,
View file
open5gs_2.6.2.tar.xz/lib/pfcp/message.c -> open5gs_2.6.3.tar.xz/lib/pfcp/message.c
Changed
@@ -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: 2023-03-05 22:26:11.716006 by acetcom + * Created on: 2023-04-09 20:37:00.518388 by acetcom * from 29244-h71-modified.docx ******************************************************************************/ @@ -1546,10 +1546,10 @@ ogs_tlv_desc_t ogs_pfcp_tlv_desc_pfcpsereq_flags = { - OGS_TLV_VAR_STR, + OGS_TLV_UINT8, "PFCPSEReq-Flags", OGS_PFCP_PFCPSEREQ_FLAGS_TYPE, - 0, + 1, 0, sizeof(ogs_pfcp_tlv_pfcpsereq_flags_t), { NULL }
View file
open5gs_2.6.2.tar.xz/lib/pfcp/message.h -> open5gs_2.6.3.tar.xz/lib/pfcp/message.h
Changed
@@ -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: 2023-03-05 22:26:11.698310 by acetcom + * Created on: 2023-04-09 20:37:00.506639 by acetcom * from 29244-h71-modified.docx ******************************************************************************/ @@ -903,7 +903,7 @@ typedef ogs_tlv_octet_t ogs_pfcp_tlv_number_of_reports_t; typedef ogs_tlv_octet_t ogs_pfcp_tlv_pfcpasrsp_flags_t; typedef ogs_tlv_octet_t ogs_pfcp_tlv_cp_pfcp_entity_ip_address_t; -typedef ogs_tlv_octet_t ogs_pfcp_tlv_pfcpsereq_flags_t; +typedef ogs_tlv_uint8_t ogs_pfcp_tlv_pfcpsereq_flags_t; typedef ogs_tlv_octet_t ogs_pfcp_tlv_ip_multicast_address_t; typedef ogs_tlv_octet_t ogs_pfcp_tlv_source_ip_address_t; typedef ogs_tlv_octet_t ogs_pfcp_tlv_packet_rate_status_t;
View file
open5gs_2.6.2.tar.xz/lib/pfcp/support/pfcp-tlv.py -> open5gs_2.6.3.tar.xz/lib/pfcp/support/pfcp-tlv.py
Changed
@@ -519,6 +519,7 @@ type_list"PFCPSRReq-Flags""size" = 1 # Type 161 type_list"PFCPAUReq-Flags""size" = 1 # Type 162 type_list"Quota Validity Time""size" = 4 # Type 181 +type_list"PFCPSEReq-Flags""size" = 1 # Type 186 type_list"Data Status""size" = 1 # Type 260 f = open(outdir + 'message.h', 'w')
View file
open5gs_2.6.2.tar.xz/lib/pfcp/types.h -> open5gs_2.6.3.tar.xz/lib/pfcp/types.h
Changed
@@ -1651,6 +1651,28 @@ ogs_tlv_octet_t *octet, ogs_pfcp_user_id_t *user_id, void *data, int data_len); +/* + * 8.2.136 PFCPSEReq-Flags + * + * The following bits within Octet 5 shall indicate: + * - Bit 1 – RESTI (Restoration Indication): if this bit is set to "1", + * it indicates to the UP function that the PFCP session to be established is + * to restore an existing PFCP session. + * - Bit 2 – SUMPC (Stop of Usage Measurement to Pause Charging): + * if this bit is set to "1", it indicates that the UP function shall + * stop the usage measurement for all URRs with the "ASPOC" flag set to "1". + */ +typedef struct ogs_pfcp_sereq_flags_s { + union { + struct { +ED3(uint8_t spare:6;, + uint8_t stop_of_usage_measurement_to_pause_charging:1;, + uint8_t restoration_indication:1;) + }; + uint8_t value; + }; +} __attribute__ ((packed)) ogs_pfcp_sereq_flags_t; + #ifdef __cplusplus } #endif
View file
open5gs_2.6.2.tar.xz/lib/pfcp/xact.h -> open5gs_2.6.3.tar.xz/lib/pfcp/xact.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -35,7 +35,7 @@ ogs_lnode_t lnode; /**< A node of list */ ogs_lnode_t tmpnode; /**< A node of temp-list */ - ogs_index_t index; + ogs_pool_id_t index; #define OGS_PFCP_LOCAL_ORIGINATOR 0 #define OGS_PFCP_REMOTE_ORIGINATOR 1 @@ -78,6 +78,9 @@ bool epc; /**< EPC or 5GC */ +#define OGS_PFCP_CREATE_RESTORATION_INDICATION ((uint64_t)1<<0) + uint64_t create_flags; + #define OGS_PFCP_MODIFY_SESSION ((uint64_t)1<<0) #define OGS_PFCP_MODIFY_DL_ONLY ((uint64_t)1<<1) #define OGS_PFCP_MODIFY_UL_ONLY ((uint64_t)1<<2) @@ -110,7 +113,6 @@ #define OGS_PFCP_MODIFY_URR_TIME_QUOTA ((uint64_t)1<<29) #define OGS_PFCP_MODIFY_URR_VOLUME_THRESH ((uint64_t)1<<30) #define OGS_PFCP_MODIFY_URR_TIME_THRESH ((uint64_t)1<<31) - uint64_t modify_flags; #define OGS_PFCP_DELETE_TRIGGER_LOCAL_INITIATED 1
View file
open5gs_2.6.2.tar.xz/lib/proto/types.h -> open5gs_2.6.3.tar.xz/lib/proto/types.h
Changed
@@ -80,6 +80,7 @@ #define OGS_MAX_DNN_LEN 100 #define OGS_MAX_APN_LEN OGS_MAX_DNN_LEN #define OGS_MAX_PCO_LEN 251 +#define OGS_MAX_EPCO_LEN 65535 #define OGS_MAX_FQDN_LEN 256 #define OGS_MAX_NUM_OF_SERVED_GUAMI 8
View file
open5gs_2.6.2.tar.xz/lib/sbi/context.c -> open5gs_2.6.3.tar.xz/lib/sbi/context.c
Changed
@@ -122,8 +122,6 @@ static int ogs_sbi_context_prepare(void) { - self.sbi_port = OGS_SBI_HTTP_PORT; - #if ENABLE_ACCEPT_ENCODING self.content_encoding = "gzip"; #endif @@ -242,7 +240,7 @@ int num_of_advertise = 0; const char *advertiseOGS_MAX_NUM_OF_HOSTNAME; - uint16_t port = self.sbi_port; + uint16_t port = ogs_sbi_server_default_port(); const char *dev = NULL; ogs_sockaddr_t *addr = NULL; @@ -410,7 +408,7 @@ rv = ogs_socknode_probe( ogs_app()->parameter.no_ipv4 ? NULL : &list, ogs_app()->parameter.no_ipv6 ? NULL : &list6, - NULL, self.sbi_port, NULL); + NULL, ogs_sbi_server_default_port(), NULL); ogs_assert(rv == OGS_OK); node = ogs_list_first(&list); @@ -506,7 +504,7 @@ int family = AF_UNSPEC; int i, num = 0; const char *hostnameOGS_MAX_NUM_OF_HOSTNAME; - uint16_t port = self.sbi_port; + uint16_t port = ogs_sbi_client_default_port(); if (ogs_yaml_iter_type(&sbi_array) == YAML_MAPPING_NODE) { @@ -583,10 +581,7 @@ if (addr == NULL) continue; client = ogs_sbi_client_add( - ogs_app()->sbi.client.no_tls == false ? - OpenAPI_uri_scheme_https : - OpenAPI_uri_scheme_http, - addr); + ogs_sbi_client_default_scheme(), addr); ogs_assert(client); OGS_SBI_SETUP_CLIENT(self.nrf_instance, client); @@ -612,7 +607,7 @@ int family = AF_UNSPEC; int i, num = 0; const char *hostnameOGS_MAX_NUM_OF_HOSTNAME; - uint16_t port = self.sbi_port; + uint16_t port = ogs_sbi_client_default_port(); if (ogs_yaml_iter_type(&sbi_array) == YAML_MAPPING_NODE) { @@ -689,10 +684,7 @@ if (addr == NULL) continue; client = ogs_sbi_client_add( - ogs_app()->sbi.client.no_tls == false ? - OpenAPI_uri_scheme_https : - OpenAPI_uri_scheme_http, - addr); + ogs_sbi_client_default_scheme(), addr); ogs_assert(client); OGS_SBI_SETUP_CLIENT(self.scp_instance, client); @@ -1404,6 +1396,7 @@ } if (nf_service->num_of_addr < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { + bool is_port = true; int port = 0; ogs_sockaddr_t *addr = NULL; ogs_assert(OGS_OK == ogs_copyaddrinfo(&addr, advertise)); @@ -1411,11 +1404,12 @@ port = OGS_PORT(addr); if (nf_service->scheme == OpenAPI_uri_scheme_https) { - if (port == OGS_SBI_HTTPS_PORT) port = 0; + if (port == OGS_SBI_HTTPS_PORT) is_port = false; } else if (nf_service->scheme == OpenAPI_uri_scheme_http) { - if (port == OGS_SBI_HTTP_PORT) port = 0; + if (port == OGS_SBI_HTTP_PORT) is_port = false; } + nf_service->addrnf_service->num_of_addr.is_port = is_port; nf_service->addrnf_service->num_of_addr.port = port; if (addr->ogs_sa_family == AF_INET) { nf_service->addrnf_service->num_of_addr.ipv4 = addr; @@ -1439,17 +1433,21 @@ } static ogs_sbi_client_t *find_client_by_fqdn( - OpenAPI_uri_scheme_e scheme, char *fqdn, int port) + OpenAPI_uri_scheme_e scheme, char *fqdn) { int rv; ogs_sockaddr_t *addr = NULL; ogs_sbi_client_t *client = NULL; - ogs_assert(scheme); + ogs_assert(scheme == OpenAPI_uri_scheme_https || + scheme == OpenAPI_uri_scheme_http); ogs_assert(fqdn); - rv = ogs_getaddrinfo(&addr, AF_UNSPEC, fqdn, - port ? port : ogs_sbi_self()->sbi_port, 0); + rv = ogs_getaddrinfo( + &addr, AF_UNSPEC, fqdn, + scheme == OpenAPI_uri_scheme_https ? + OGS_SBI_HTTPS_PORT : OGS_SBI_HTTP_PORT, + 0); if (rv != OGS_OK) { ogs_error("Invalid NFProfile.fqdn"); return NULL; @@ -1473,11 +1471,10 @@ ogs_sockaddr_t *addr = NULL; OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL; - scheme = ogs_app()->sbi.client.no_tls == false ? - OpenAPI_uri_scheme_https : OpenAPI_uri_scheme_http; + scheme = ogs_sbi_client_default_scheme(); if (nf_instance->fqdn) - client = find_client_by_fqdn(scheme, nf_instance->fqdn, 0); + client = find_client_by_fqdn(scheme, nf_instance->fqdn); if (!client) { /* At this point, CLIENT selection method is very simple. */ @@ -1504,7 +1501,7 @@ ogs_assert(nf_service->scheme); if (nf_service->fqdn) - client = find_client_by_fqdn(nf_service->scheme, nf_service->fqdn, 0); + client = find_client_by_fqdn(nf_service->scheme, nf_service->fqdn); if (!client) { /* At this point, CLIENT selection method is very simple. */ @@ -1620,9 +1617,28 @@ nf_service_associate_client_all(nf_instance); } -OpenAPI_uri_scheme_e ogs_sbi_default_uri_scheme(void) +OpenAPI_uri_scheme_e ogs_sbi_server_default_scheme(void) +{ + return ogs_app()->sbi.server.no_tls == false ? + OpenAPI_uri_scheme_https : OpenAPI_uri_scheme_http; +} + +OpenAPI_uri_scheme_e ogs_sbi_client_default_scheme(void) +{ + return ogs_app()->sbi.client.no_tls == false ? + OpenAPI_uri_scheme_https : OpenAPI_uri_scheme_http; +} + +int ogs_sbi_server_default_port(void) +{ + return ogs_app()->sbi.server.no_tls == false ? + OGS_SBI_HTTPS_PORT : OGS_SBI_HTTP_PORT; +} + +int ogs_sbi_client_default_port(void) { - return OpenAPI_uri_scheme_http; + return ogs_app()->sbi.client.no_tls == false ? + OGS_SBI_HTTPS_PORT : OGS_SBI_HTTP_PORT; } ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
View file
open5gs_2.6.2.tar.xz/lib/sbi/context.h -> open5gs_2.6.3.tar.xz/lib/sbi/context.h
Changed
@@ -58,8 +58,6 @@ uint8_t keyOGS_ECCKEY_LEN; /* 32 bytes Private Key */ } hnetOGS_HOME_NETWORK_PKI_VALUE_MAX+1; /* PKI Value : 1 ~ 254 */ - uint16_t sbi_port; /* SBI local port */ - ogs_list_t server_list; ogs_list_t client_list; @@ -218,6 +216,7 @@ struct { ogs_sockaddr_t *ipv4; ogs_sockaddr_t *ipv6; + bool is_port; int port; } addrOGS_SBI_MAX_NUM_OF_IP_ADDRESS; @@ -401,7 +400,10 @@ void ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance); -OpenAPI_uri_scheme_e ogs_sbi_default_uri_scheme(void); +OpenAPI_uri_scheme_e ogs_sbi_server_default_scheme(void); +OpenAPI_uri_scheme_e ogs_sbi_client_default_scheme(void); +int ogs_sbi_server_default_port(void); +int ogs_sbi_client_default_port(void); #define OGS_SBI_SETUP_NF_INSTANCE(__cTX, __nFInstance) \ do { \
View file
open5gs_2.6.2.tar.xz/lib/sbi/nnrf-build.c -> open5gs_2.6.3.tar.xz/lib/sbi/nnrf-build.c
Changed
@@ -569,7 +569,7 @@ return NULL; } } - IpEndPoint->is_port = true; + IpEndPoint->is_port = nf_service->addri.is_port; IpEndPoint->port = nf_service->addri.port; OpenAPI_list_add(IpEndPointList, IpEndPoint); }
View file
open5gs_2.6.2.tar.xz/lib/sbi/nnrf-handler.c -> open5gs_2.6.3.tar.xz/lib/sbi/nnrf-handler.c
Changed
@@ -83,7 +83,7 @@ if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { rv = ogs_getaddrinfo(&addr, AF_UNSPEC, - node->data, ogs_sbi_self()->sbi_port, 0); + node->data, ogs_sbi_client_default_port(), 0); if (rv != OGS_OK) continue; nf_instance->ipv4nf_instance->num_of_ipv4 = addr; @@ -101,7 +101,7 @@ if (nf_instance->num_of_ipv6 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { rv = ogs_getaddrinfo(&addr, AF_UNSPEC, - node->data, ogs_sbi_self()->sbi_port, 0); + node->data, ogs_sbi_client_default_port(), 0); if (rv != OGS_OK) continue; nf_instance->ipv6nf_instance->num_of_ipv6 = addr; @@ -257,18 +257,10 @@ } if (nf_service->num_of_addr < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { - if (!IpEndPoint->is_port) { - if (nf_service->scheme == OpenAPI_uri_scheme_http) - port = OGS_SBI_HTTP_PORT; - else if (nf_service->scheme == OpenAPI_uri_scheme_https) - port = OGS_SBI_HTTPS_PORT; - else { - ogs_error("Invalid scheme %d", nf_service->scheme); - continue; - } - } else { + if (!IpEndPoint->is_port) + port = ogs_sbi_client_default_port(); + else port = IpEndPoint->port; - } if (IpEndPoint->ipv4_address) { rv = ogs_getaddrinfo(&addr, AF_UNSPEC, @@ -291,6 +283,8 @@ if (addr || addr6) { nf_service->addrnf_service->num_of_addr. + is_port = IpEndPoint->is_port; + nf_service->addrnf_service->num_of_addr. port = port; nf_service->addrnf_service->num_of_addr. ipv4 = addr;
View file
open5gs_2.6.2.tar.xz/meson.build -> open5gs_2.6.3.tar.xz/meson.build
Changed
@@ -16,7 +16,7 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. project('open5gs', 'c', 'cpp', - version : '2.6.2', + version : '2.6.3', license : 'AGPL-3.0-or-later', meson_version : '>= 0.43.0', default_options : @@ -25,7 +25,7 @@ , ) -libogslib_version = '2.6.2' +libogslib_version = '2.6.3' prefix = get_option('prefix') bindir = join_paths(prefix, get_option('bindir'))
View file
open5gs_2.6.2.tar.xz/misc/db/open5gs-dbctl -> open5gs_2.6.3.tar.xz/misc/db/open5gs-dbctl
Changed
@@ -1,6 +1,6 @@ #!/bin/bash -version=0.10.2 +version=0.10.3 display_help() { echo "open5gs-dbctl: Open5GS Database Configuration Tool ($version)" @@ -24,6 +24,7 @@ echo " showall: shows the list of subscriber in the db" echo " showpretty: shows the list of subscriber in the db in a pretty json tree format" echo " showfiltered: shows {imsi key opc apn ip} information of subscriber" + echo " ambr_speed {imsi dl_value dl_unit ul_value ul_unit}: Change AMBR speed from a specific user and the unit values are \"0=bps 1=Kbps 2=Mbps 3=Gbps 4=Tbps \"" } @@ -785,4 +786,44 @@ exit $? fi +if "$1" = "ambr_speed" ; then + if "$#" -eq 6 ; then + IMSI=$2 + DL_VALUE=$3 + DL_UNIT=$4 + UL_VALUE=$5 + UL_UNIT=$6 + mongosh --eval "db.subscribers.updateOne({\"imsi\": \"$IMSI\"}, + {\$set: { + \"ambr\" : { + \"downlink\" : { + \"value\" : NumberInt($DL_VALUE), + \"unit\" : NumberInt($DL_UNIT) + }, + \"uplink\" :{ + \"value\": NumberInt($UL_VALUE), + \"unit\" : NumberInt($UL_UNIT) + } + }, + \"slice.0.session.0.ambr\": { + \"downlink\" : { + \"value\" : NumberInt($DL_VALUE), + \"unit\" : NumberInt($DL_UNIT) + }, + \"uplink\" :{ + \"value\": NumberInt($UL_VALUE), + \"unit\" : NumberInt($UL_UNIT) + } + } + } + });" $DB_URI + + + exit $? + fi + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl ambr_speed imsi dl_value dl_unit ul_value ul_unit dl is for download and ul is for upload and the unit values are0=bps 1=Kbps 2=Mbps 3=Gbps 4=Tbps \"" + exit 1 +fi + + display_help
View file
open5gs_2.6.2.tar.xz/src/amf/amf-sm.c -> open5gs_2.6.3.tar.xz/src/amf/amf-sm.c
Changed
@@ -693,6 +693,14 @@ break; } + amf_ue = sess->amf_ue; + ogs_assert(amf_ue); + amf_ue = amf_ue_cycle(amf_ue); + if (!amf_ue) { + ogs_error("UE(amf_ue) Context has already been removed"); + break; + } + ogs_error("%d:%d Cannot receive SBI message", sess->psi, sess->pti); if (sess->payload_container_type) {
View file
open5gs_2.6.2.tar.xz/src/amf/context.c -> open5gs_2.6.3.tar.xz/src/amf/context.c
Changed
@@ -29,6 +29,8 @@ static OGS_POOL(ran_ue_pool, ran_ue_t); static OGS_POOL(amf_sess_pool, amf_sess_t); +static OGS_POOL(m_tmsi_pool, amf_m_tmsi_t); + static int context_initialized = 0; static int num_of_ran_ue = 0; @@ -60,7 +62,8 @@ ogs_pool_init(&amf_ue_pool, ogs_app()->max.ue); ogs_pool_init(&ran_ue_pool, ogs_app()->max.ue); ogs_pool_init(&amf_sess_pool, ogs_app()->pool.sess); - ogs_pool_init(&self.m_tmsi, ogs_app()->max.ue*2); + ogs_pool_init(&m_tmsi_pool, ogs_app()->max.ue*2); + ogs_pool_random_id_generate(&m_tmsi_pool); ogs_list_init(&self.gnb_list); ogs_list_init(&self.amf_ue_list); @@ -98,7 +101,7 @@ ogs_assert(self.supi_hash); ogs_hash_destroy(self.supi_hash); - ogs_pool_final(&self.m_tmsi); + ogs_pool_final(&m_tmsi_pool); ogs_pool_final(&amf_sess_pool); ogs_pool_final(&amf_ue_pool); ogs_pool_final(&ran_ue_pool); @@ -1697,11 +1700,6 @@ self.guti_ue_hash, guti, sizeof(ogs_nas_5gs_guti_t)); } -amf_ue_t *amf_ue_find_by_teid(uint32_t teid) -{ - return ogs_pool_find(&amf_ue_pool, teid); -} - amf_ue_t *amf_ue_find_by_suci(char *suci) { ogs_assert(suci); @@ -2114,9 +2112,6 @@ if (sess->nssf.nrf.client) ogs_sbi_client_remove(sess->nssf.nrf.client); - OGS_NAS_CLEAR_DATA(&sess->ue_pco); - OGS_TLV_CLEAR_DATA(&sess->pgw_pco); - ogs_pool_free(&amf_sess_pool, sess); stats_remove_amf_session(); @@ -2368,6 +2363,7 @@ return NULL; } +#if 0 /* DEPRECATED */ int amf_m_tmsi_pool_generate(void) { int j; @@ -2378,7 +2374,7 @@ amf_m_tmsi_t *m_tmsi = NULL; int conflict = 0; - m_tmsi = &self.m_tmsi.arrayindex; + m_tmsi = &m_tmsi_pool.arrayindex; ogs_assert(m_tmsi); *m_tmsi = ogs_random32(); @@ -2387,10 +2383,10 @@ *m_tmsi &= 0xff00ffff; for (j = 0; j < index; j++) { - if (*m_tmsi == self.m_tmsi.arrayj) { + if (*m_tmsi == m_tmsi_pool.arrayj) { conflict = 1; ogs_trace("M-TMSI CONFLICT %d:0x%x == %d:0x%x", - index, *m_tmsi, j, self.m_tmsi.arrayj); + index, *m_tmsi, j, m_tmsi_pool.arrayj); break; } } @@ -2400,26 +2396,48 @@ index++; } - self.m_tmsi.size = index; + m_tmsi_pool.size = index; ogs_trace("M-TMSI Pool generate...done"); return OGS_OK; } +#endif amf_m_tmsi_t *amf_m_tmsi_alloc(void) { amf_m_tmsi_t *m_tmsi = NULL; - ogs_pool_alloc(&self.m_tmsi, &m_tmsi); + ogs_pool_alloc(&m_tmsi_pool, &m_tmsi); ogs_assert(m_tmsi); + /* TS23.003 + * 2.8.2.1.2 Mapping in the UE + * + * E-UTRAN <M-TMSI> maps as follows: + * - 6 bits of the E-UTRAN <M-TMSI> starting at bit 29 and down to bit 24 + * are mapped into bit 29 and down to bit 24 of the GERAN/UTRAN <P-TMSI>; + * - 16 bits of the E-UTRAN <M-TMSI> starting at bit 15 and down to bit 0 + * are mapped into bit 15 and down to bit 0 of the GERAN/UTRAN <P-TMSI>; + * - and the remaining 8 bits of the E-UTRAN <M-TMSI> are + * mapped into the 8 Most Significant Bits of the <P-TMSI signature> field. + * + * The UE shall fill the remaining 2 octets of the <P-TMSI signature> + * according to clauses 9.1.1, 9.4.1, 10.2.1, or 10.5.1 + * of 3GPP TS.33.401 89 , as appropriate, for RAU/Attach procedures + */ + + ogs_assert(*m_tmsi <= 0x003fffff); + + *m_tmsi = ((*m_tmsi & 0xffff) | ((*m_tmsi & 0x003f0000) << 8)); + *m_tmsi |= 0xc0000000; + return m_tmsi; } int amf_m_tmsi_free(amf_m_tmsi_t *m_tmsi) { ogs_assert(m_tmsi); - ogs_pool_free(&self.m_tmsi, m_tmsi); + ogs_pool_free(&m_tmsi_pool, m_tmsi); return OGS_OK; }
View file
open5gs_2.6.2.tar.xz/src/amf/context.h -> open5gs_2.6.3.tar.xz/src/amf/context.h
Changed
@@ -111,8 +111,6 @@ ogs_hash_t *suci_hash; /* hash table (SUCI) */ ogs_hash_t *supi_hash; /* hash table (SUPI) */ - OGS_POOL(m_tmsi, amf_m_tmsi_t); /* M-TMSI Pool */ - uint16_t ngap_port; /* Default NGAP Port */ ogs_list_t ngap_list; /* AMF NGAP IPv4 Server List */ @@ -650,15 +648,6 @@ ogs_s_nssai_t mapped_hplmn; char *dnn; - /* Save Protocol Configuration Options from UE */ - struct { - uint8_t length; - uint8_t *buffer; - } ue_pco; - - /* Save Protocol Configuration Options from PGW */ - ogs_tlv_octet_t pgw_pco; - } amf_sess_t; void amf_context_init(void); @@ -697,7 +686,6 @@ void amf_ue_fsm_fini(amf_ue_t *amf_ue); amf_ue_t *amf_ue_find_by_guti(ogs_nas_5gs_guti_t *nas_guti); -amf_ue_t *amf_ue_find_by_teid(uint32_t teid); amf_ue_t *amf_ue_find_by_suci(char *suci); amf_ue_t *amf_ue_find_by_supi(char *supi); @@ -823,7 +811,6 @@ ogs_s_nssai_t *amf_find_s_nssai( ogs_plmn_id_t *served_plmn_id, ogs_s_nssai_t *s_nssai); -int amf_m_tmsi_pool_generate(void); amf_m_tmsi_t *amf_m_tmsi_alloc(void); int amf_m_tmsi_free(amf_m_tmsi_t *tmsi);
View file
open5gs_2.6.2.tar.xz/src/amf/init.c -> open5gs_2.6.3.tar.xz/src/amf/init.c
Changed
@@ -46,9 +46,6 @@ rv = amf_context_nf_info(); if (rv != OGS_OK) return rv; - rv = amf_m_tmsi_pool_generate(); - if (rv != OGS_OK) return rv; - rv = ogs_log_config_domain( ogs_app()->logger.domain, ogs_app()->logger.level); if (rv != OGS_OK) return rv;
View file
open5gs_2.6.2.tar.xz/src/amf/ngap-handler.c -> open5gs_2.6.3.tar.xz/src/amf/ngap-handler.c
Changed
@@ -3140,6 +3140,8 @@ target_ue->initial_context_setup_request_sent = source_ue->initial_context_setup_request_sent; + target_ue->psimask.activated = source_ue->psimask.activated; + ogs_debug(" Target : RAN_UE_NGAP_ID%d AMF_UE_NGAP_ID%lld ", target_ue->ran_ue_ngap_id, (long long)target_ue->amf_ue_ngap_id);
View file
open5gs_2.6.2.tar.xz/src/bsf/context.h -> open5gs_2.6.3.tar.xz/src/bsf/context.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -71,6 +71,7 @@ struct { char *addr; char *addr6; + bool is_port; int port; } pcf_ipOGS_SBI_MAX_NUM_OF_IP_ADDRESS;
View file
open5gs_2.6.2.tar.xz/src/bsf/nbsf-handler.c -> open5gs_2.6.3.tar.xz/src/bsf/nbsf-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -148,27 +148,10 @@ OpenAPI_list_for_each(PcfIpEndPointList, node) { OpenAPI_ip_end_point_t *IpEndPoint = node->data; - int port = 0; if (!IpEndPoint) continue; if (sess->num_of_pcf_ip < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { - if (!IpEndPoint->is_port) { - if (ogs_sbi_default_uri_scheme() == - OpenAPI_uri_scheme_http) - port = OGS_SBI_HTTP_PORT; - else if (ogs_sbi_default_uri_scheme() == - OpenAPI_uri_scheme_https) - port = OGS_SBI_HTTPS_PORT; - else { - ogs_fatal("Invalid scheme %d", - ogs_sbi_default_uri_scheme()); - ogs_assert_if_reached(); - } - } else { - port = IpEndPoint->port; - } - if (IpEndPoint->ipv4_address || IpEndPoint->ipv6_address) { if (IpEndPoint->ipv4_address) { @@ -179,7 +162,12 @@ sess->pcf_ipsess->num_of_pcf_ip.addr6 = ogs_strdup(IpEndPoint->ipv6_address); } - sess->pcf_ipsess->num_of_pcf_ip.port = port; + if (IpEndPoint->is_port) { + sess->pcf_ipsess->num_of_pcf_ip.is_port = + IpEndPoint->is_port; + sess->pcf_ipsess->num_of_pcf_ip.port = + IpEndPoint->port; + } sess->num_of_pcf_ip++; } } @@ -259,7 +247,7 @@ PcfIpEndPoint->ipv4_address = sess->pcf_ipi.addr; PcfIpEndPoint->ipv6_address = sess->pcf_ipi.addr6; - PcfIpEndPoint->is_port = true; + PcfIpEndPoint->is_port = sess->pcf_ipi.is_port; PcfIpEndPoint->port = sess->pcf_ipi.port; OpenAPI_list_add(PcfIpEndPointList, PcfIpEndPoint);
View file
open5gs_2.6.2.tar.xz/src/mme/esm-build.c -> open5gs_2.6.3.tar.xz/src/mme/esm-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -228,21 +228,20 @@ apn_ambr_build(apn_ambr, session->ambr.downlink, session->ambr.uplink); } - if (sess->pgw_pco.presence && sess->pgw_pco.len && sess->pgw_pco.data) { - if (mme_ue->ue_network_capability. - extended_protocol_configuration_options) { - activate_default_eps_bearer_context_request->presencemask |= - OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - extended_protocol_configuration_options->length = sess->pgw_pco.len; - extended_protocol_configuration_options->buffer = - sess->pgw_pco.data; - } else { - activate_default_eps_bearer_context_request->presencemask |= - OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - protocol_configuration_options->length = sess->pgw_pco.len; - memcpy(protocol_configuration_options->buffer, - sess->pgw_pco.data, protocol_configuration_options->length); - } + if (sess->pgw_epco.presence && sess->pgw_epco.len && sess->pgw_epco.data) { + activate_default_eps_bearer_context_request->presencemask |= + OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + extended_protocol_configuration_options->length = + sess->pgw_epco.len; + extended_protocol_configuration_options->buffer = + sess->pgw_epco.data; + } else if (sess->pgw_pco.presence && sess->pgw_pco.len && + sess->pgw_pco.data) { + activate_default_eps_bearer_context_request->presencemask |= + OGS_NAS_EPS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + protocol_configuration_options->length = sess->pgw_pco.len; + memcpy(protocol_configuration_options->buffer, + sess->pgw_pco.data, protocol_configuration_options->length); } if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST)
View file
open5gs_2.6.2.tar.xz/src/mme/esm-handler.c -> open5gs_2.6.3.tar.xz/src/mme/esm-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -106,9 +106,17 @@ } if (req->presencemask & + OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + ogs_nas_extended_protocol_configuration_options_t + *extended_protocol_configuration_options = + &req->extended_protocol_configuration_options; + + OGS_NAS_STORE_DATA(&sess->ue_epco, + extended_protocol_configuration_options); + } else if (req->presencemask & OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { ogs_nas_protocol_configuration_options_t - *protocol_configuration_options = + *protocol_configuration_options = &req->protocol_configuration_options; OGS_NAS_STORE_DATA(&sess->ue_pco, protocol_configuration_options); @@ -182,9 +190,17 @@ } if (rsp->presencemask & + OGS_NAS_EPS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { + ogs_nas_extended_protocol_configuration_options_t + *extended_protocol_configuration_options = + &rsp->extended_protocol_configuration_options; + + OGS_NAS_STORE_DATA(&sess->ue_epco, + extended_protocol_configuration_options); + } else if (rsp->presencemask & OGS_NAS_EPS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { ogs_nas_protocol_configuration_options_t - *protocol_configuration_options = + *protocol_configuration_options = &rsp->protocol_configuration_options; OGS_NAS_STORE_DATA(&sess->ue_pco, protocol_configuration_options); }
View file
open5gs_2.6.2.tar.xz/src/mme/mme-context.c -> open5gs_2.6.3.tar.xz/src/mme/mme-context.c
Changed
@@ -44,11 +44,14 @@ static OGS_POOL(mme_enb_pool, mme_enb_t); static OGS_POOL(mme_ue_pool, mme_ue_t); +static OGS_POOL(mme_s11_teid_pool, ogs_pool_id_t); static OGS_POOL(enb_ue_pool, enb_ue_t); static OGS_POOL(sgw_ue_pool, sgw_ue_t); static OGS_POOL(mme_sess_pool, mme_sess_t); static OGS_POOL(mme_bearer_pool, mme_bearer_t); +static OGS_POOL(m_tmsi_pool, mme_m_tmsi_t); + static int context_initialized = 0; static int num_of_enb_ue = 0; @@ -100,11 +103,15 @@ ogs_pool_init(&mme_enb_pool, ogs_app()->max.peer*2); ogs_pool_init(&mme_ue_pool, ogs_app()->max.ue); + ogs_pool_init(&mme_s11_teid_pool, ogs_app()->max.ue); + ogs_pool_random_id_generate(&mme_s11_teid_pool); + ogs_pool_init(&enb_ue_pool, ogs_app()->max.ue); ogs_pool_init(&sgw_ue_pool, ogs_app()->max.ue); ogs_pool_init(&mme_sess_pool, ogs_app()->pool.sess); ogs_pool_init(&mme_bearer_pool, ogs_app()->pool.bearer); - ogs_pool_init(&self.m_tmsi, ogs_app()->max.ue*2); + ogs_pool_init(&m_tmsi_pool, ogs_app()->max.ue*2); + ogs_pool_random_id_generate(&m_tmsi_pool); self.enb_addr_hash = ogs_hash_make(); ogs_assert(self.enb_addr_hash); @@ -114,6 +121,8 @@ ogs_assert(self.imsi_ue_hash); self.guti_ue_hash = ogs_hash_make(); ogs_assert(self.guti_ue_hash); + self.mme_s11_teid_hash = ogs_hash_make(); + ogs_assert(self.mme_s11_teid_hash); ogs_list_init(&self.mme_ue_list); @@ -141,11 +150,14 @@ ogs_hash_destroy(self.imsi_ue_hash); ogs_assert(self.guti_ue_hash); ogs_hash_destroy(self.guti_ue_hash); + ogs_assert(self.mme_s11_teid_hash); + ogs_hash_destroy(self.mme_s11_teid_hash); - ogs_pool_final(&self.m_tmsi); + ogs_pool_final(&m_tmsi_pool); ogs_pool_final(&mme_bearer_pool); ogs_pool_final(&mme_sess_pool); ogs_pool_final(&mme_ue_pool); + ogs_pool_final(&mme_s11_teid_pool); ogs_pool_final(&enb_ue_pool); ogs_pool_final(&sgw_ue_pool); @@ -2327,11 +2339,6 @@ sgw_ue->sgw = new_sgw; } -sgw_ue_t *sgw_ue_find(uint32_t index) -{ - return ogs_pool_find(&sgw_ue_pool, index); -} - sgw_ue_t *sgw_ue_cycle(sgw_ue_t *sgw_ue) { return ogs_pool_cycle(&sgw_ue_pool, sgw_ue); @@ -2564,9 +2571,14 @@ ogs_list_init(&mme_ue->sess_list); - mme_ue->mme_s11_teid = ogs_pool_index(&mme_ue_pool, mme_ue); - ogs_assert(mme_ue->mme_s11_teid > 0 && - mme_ue->mme_s11_teid <= ogs_app()->max.ue); + /* Set MME-S11_TEID */ + ogs_pool_alloc(&mme_s11_teid_pool, &mme_ue->mme_s11_teid_node); + ogs_assert(mme_ue->mme_s11_teid_node); + + mme_ue->mme_s11_teid = *(mme_ue->mme_s11_teid_node); + + ogs_hash_set(self.mme_s11_teid_hash, + &mme_ue->mme_s11_teid, sizeof(mme_ue->mme_s11_teid), mme_ue); /* * When used for the first time, if last node is set, @@ -2609,6 +2621,9 @@ mme_ue_fsm_fini(mme_ue); + ogs_hash_set(self.mme_s11_teid_hash, + &mme_ue->mme_s11_teid, sizeof(mme_ue->mme_s11_teid), NULL); + ogs_assert(mme_ue->sgw_ue); sgw_ue_remove(mme_ue->sgw_ue); @@ -2654,6 +2669,7 @@ mme_ebi_pool_final(mme_ue); + ogs_pool_free(&mme_s11_teid_pool, mme_ue->mme_s11_teid_node); ogs_pool_free(&mme_ue_pool, mme_ue); ogs_info("Removed Number of MME-UEs is now %d", @@ -2729,7 +2745,7 @@ mme_ue_t *mme_ue_find_by_teid(uint32_t teid) { - return ogs_pool_find(&mme_ue_pool, teid); + return ogs_hash_get(self.mme_s11_teid_hash, &teid, sizeof(teid)); } mme_ue_t *mme_ue_find_by_message(ogs_nas_eps_message_t *message) @@ -3244,7 +3260,9 @@ mme_bearer_remove_all(sess); OGS_NAS_CLEAR_DATA(&sess->ue_pco); + OGS_NAS_CLEAR_DATA(&sess->ue_epco); OGS_TLV_CLEAR_DATA(&sess->pgw_pco); + OGS_TLV_CLEAR_DATA(&sess->pgw_epco); ogs_pool_free(&mme_sess_pool, sess); @@ -3743,6 +3761,7 @@ return -1; } +#if 0 /* DEPRECATED */ int mme_m_tmsi_pool_generate(void) { int j; @@ -3753,7 +3772,7 @@ mme_m_tmsi_t *m_tmsi = NULL; int conflict = 0; - m_tmsi = &self.m_tmsi.arrayindex; + m_tmsi = &m_tmsi_pool.arrayindex; ogs_assert(m_tmsi); *m_tmsi = ogs_random32(); @@ -3762,10 +3781,10 @@ *m_tmsi &= 0xff00ffff; for (j = 0; j < index; j++) { - if (*m_tmsi == self.m_tmsi.arrayj) { + if (*m_tmsi == m_tmsi_pool.arrayj) { conflict = 1; ogs_trace("M-TMSI CONFLICT %d:0x%x == %d:0x%x", - index, *m_tmsi, j, self.m_tmsi.arrayj); + index, *m_tmsi, j, m_tmsi_pool.arrayj); break; } } @@ -3775,26 +3794,48 @@ index++; } - self.m_tmsi.size = index; + m_tmsi_pool.size = index; ogs_trace("M-TMSI Pool generate...done"); return OGS_OK; } +#endif mme_m_tmsi_t *mme_m_tmsi_alloc(void) { mme_m_tmsi_t *m_tmsi = NULL; - ogs_pool_alloc(&self.m_tmsi, &m_tmsi); + ogs_pool_alloc(&m_tmsi_pool, &m_tmsi); ogs_assert(m_tmsi); + /* TS23.003 + * 2.8.2.1.2 Mapping in the UE + * + * E-UTRAN <M-TMSI> maps as follows: + * - 6 bits of the E-UTRAN <M-TMSI> starting at bit 29 and down to bit 24 + * are mapped into bit 29 and down to bit 24 of the GERAN/UTRAN <P-TMSI>; + * - 16 bits of the E-UTRAN <M-TMSI> starting at bit 15 and down to bit 0 + * are mapped into bit 15 and down to bit 0 of the GERAN/UTRAN <P-TMSI>; + * - and the remaining 8 bits of the E-UTRAN <M-TMSI> are + * mapped into the 8 Most Significant Bits of the <P-TMSI signature> field. + * + * The UE shall fill the remaining 2 octets of the <P-TMSI signature> + * according to clauses 9.1.1, 9.4.1, 10.2.1, or 10.5.1 + * of 3GPP TS.33.401 89 , as appropriate, for RAU/Attach procedures + */ + + ogs_assert(*m_tmsi <= 0x003fffff); + + *m_tmsi = ((*m_tmsi & 0xffff) | ((*m_tmsi & 0x003f0000) << 8)); + *m_tmsi |= 0xc0000000; + return m_tmsi; } int mme_m_tmsi_free(mme_m_tmsi_t *m_tmsi) {
View file
open5gs_2.6.2.tar.xz/src/mme/mme-context.h -> open5gs_2.6.3.tar.xz/src/mme/mme-context.h
Changed
@@ -145,15 +145,14 @@ /* Generator for unique identification */ uint32_t mme_ue_s1ap_id; /* mme_ue_s1ap_id generator */ - /* M-TMSI Pool */ - OGS_POOL(m_tmsi, mme_m_tmsi_t); - ogs_list_t mme_ue_list; - ogs_hash_t *enb_addr_hash; /* hash table for ENB Address */ - ogs_hash_t *enb_id_hash; /* hash table for ENB-ID */ - ogs_hash_t *imsi_ue_hash; /* hash table (IMSI : MME_UE) */ - ogs_hash_t *guti_ue_hash; /* hash table (GUTI : MME_UE) */ + ogs_hash_t *enb_addr_hash; /* hash table for ENB Address */ + ogs_hash_t *enb_id_hash; /* hash table for ENB-ID */ + ogs_hash_t *imsi_ue_hash; /* hash table (IMSI : MME_UE) */ + ogs_hash_t *guti_ue_hash; /* hash table (GUTI : MME_UE) */ + + ogs_hash_t *mme_s11_teid_hash; /* hash table (MME-S11-TEID : MME_UE) */ struct { struct { @@ -286,7 +285,6 @@ struct sgw_ue_s { ogs_lnode_t lnode; - uint32_t index; sgw_ue_t *source_ue; sgw_ue_t *target_ue; @@ -371,7 +369,8 @@ ogs_nas_eps_guti_t guti; } current, next; - uint32_t mme_s11_teid; /* MME-S11-TEID is derived from INDEX */ + ogs_pool_id_t *mme_s11_teid_node; /* A node of MME-S11-TEID */ + uint32_t mme_s11_teid; /* MME-S11-TEID is derived from NODE */ uint16_t vlr_ostream_id; /* SCTP output stream id for VLR */ @@ -642,8 +641,17 @@ uint8_t *buffer; } ue_pco; + /* Save Extended Protocol Configuration Options from UE */ + struct { + uint16_t length; + uint8_t *buffer; + } ue_epco; + /* Save Protocol Configuration Options from PGW */ ogs_tlv_octet_t pgw_pco; + + /* Save Extended Protocol Configuration Options from PGW */ + ogs_tlv_octet_t pgw_epco; } mme_sess_t; #define MME_HAVE_ENB_S1U_PATH(__bEARER) \ @@ -685,7 +693,6 @@ ogs_lnode_t lnode; ogs_lnode_t to_modify_node; - uint32_t index; ogs_fsm_t sm; /* State Machine */ uint8_t *ebi_node; /* Pool-Node for EPS Bearer ID */ @@ -794,7 +801,6 @@ sgw_ue_t *sgw_ue_add(mme_sgw_t *sgw); void sgw_ue_remove(sgw_ue_t *sgw_ue); void sgw_ue_switch_to_sgw(sgw_ue_t *sgw_ue, mme_sgw_t *new_sgw); -sgw_ue_t *sgw_ue_find(uint32_t index); sgw_ue_t *sgw_ue_cycle(sgw_ue_t *sgw_ue); typedef enum { @@ -923,7 +929,6 @@ int mme_find_served_tai(ogs_eps_tai_t *tai); -int mme_m_tmsi_pool_generate(void); mme_m_tmsi_t *mme_m_tmsi_alloc(void); int mme_m_tmsi_free(mme_m_tmsi_t *tmsi);
View file
open5gs_2.6.2.tar.xz/src/mme/mme-init.c -> open5gs_2.6.3.tar.xz/src/mme/mme-init.c
Changed
@@ -61,9 +61,6 @@ ogs_app()->logger.domain, ogs_app()->logger.level); if (rv != OGS_OK) return rv; - rv = mme_m_tmsi_pool_generate(); - if (rv != OGS_OK) return rv; - ogs_metrics_context_open(ogs_metrics_self()); rv = mme_fd_init();
View file
open5gs_2.6.2.tar.xz/src/mme/mme-s11-build.c -> open5gs_2.6.3.tar.xz/src/mme/mme-s11-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -253,7 +253,13 @@ req->aggregate_maximum_bit_rate.len = sizeof(ambr); } - if (sess->ue_pco.length && sess->ue_pco.buffer) { + if (sess->ue_epco.length && sess->ue_epco.buffer) { + req->extended_protocol_configuration_options.presence = 1; + req->extended_protocol_configuration_options.data = + sess->ue_epco.buffer; + req->extended_protocol_configuration_options.len = + sess->ue_epco.length; + } else if (sess->ue_pco.length && sess->ue_pco.buffer) { req->protocol_configuration_options.presence = 1; req->protocol_configuration_options.data = sess->ue_pco.buffer; req->protocol_configuration_options.len = sess->ue_pco.length;
View file
open5gs_2.6.2.tar.xz/src/mme/mme-s11-handler.c -> open5gs_2.6.3.tar.xz/src/mme/mme-s11-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -373,8 +373,13 @@ rsp->pdn_address_allocation.len); } + /* ePCO */ + if (rsp->extended_protocol_configuration_options.presence) { + OGS_TLV_STORE_DATA(&sess->pgw_epco, + &rsp->extended_protocol_configuration_options); + /* PCO */ - if (rsp->protocol_configuration_options.presence) { + } else if (rsp->protocol_configuration_options.presence) { OGS_TLV_STORE_DATA(&sess->pgw_pco, &rsp->protocol_configuration_options); }
View file
open5gs_2.6.2.tar.xz/src/nssf/context.c -> open5gs_2.6.3.tar.xz/src/nssf/context.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -110,7 +110,7 @@ int family = AF_UNSPEC; int i, num = 0; const char *hostnameOGS_MAX_NUM_OF_HOSTNAME; - uint16_t port = ogs_sbi_self()->sbi_port; + uint16_t port = ogs_sbi_server_default_port(); const char *dev = NULL; ogs_sockaddr_t *addr = NULL; const char *sst = NULL, *sd = NULL;
View file
open5gs_2.6.2.tar.xz/src/pcf/nbsf-build.c -> open5gs_2.6.3.tar.xz/src/pcf/nbsf-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -121,7 +121,7 @@ goto end; } } - IpEndPoint->is_port = true; + IpEndPoint->is_port = nf_service->addri.is_port; IpEndPoint->port = nf_service->addri.port; OpenAPI_list_add(PcfIpEndPointList, IpEndPoint); }
View file
open5gs_2.6.2.tar.xz/src/sgwc/context.c -> open5gs_2.6.3.tar.xz/src/sgwc/context.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -25,11 +25,15 @@ int __sgwc_log_domain; -static OGS_POOL(sgwc_ue_pool, sgwc_ue_t); -static OGS_POOL(sgwc_sess_pool, sgwc_sess_t); static OGS_POOL(sgwc_bearer_pool, sgwc_bearer_t); static OGS_POOL(sgwc_tunnel_pool, sgwc_tunnel_t); +static OGS_POOL(sgwc_ue_pool, sgwc_ue_t); +static OGS_POOL(sgwc_s11_teid_pool, ogs_pool_id_t); + +static OGS_POOL(sgwc_sess_pool, sgwc_sess_t); +static OGS_POOL(sgwc_sxa_seid_pool, ogs_pool_id_t); + static int context_initialized = 0; static int num_of_sgwc_sess = 0; @@ -45,13 +49,23 @@ ogs_log_install_domain(&__sgwc_log_domain, "sgwc", ogs_core()->log.level); - ogs_pool_init(&sgwc_ue_pool, ogs_app()->max.ue); - ogs_pool_init(&sgwc_sess_pool, ogs_app()->pool.sess); ogs_pool_init(&sgwc_bearer_pool, ogs_app()->pool.bearer); ogs_pool_init(&sgwc_tunnel_pool, ogs_app()->pool.tunnel); + ogs_pool_init(&sgwc_ue_pool, ogs_app()->max.ue); + ogs_pool_init(&sgwc_s11_teid_pool, ogs_app()->max.ue); + ogs_pool_random_id_generate(&sgwc_s11_teid_pool); + + ogs_pool_init(&sgwc_sess_pool, ogs_app()->pool.sess); + ogs_pool_init(&sgwc_sxa_seid_pool, ogs_app()->pool.sess); + ogs_pool_random_id_generate(&sgwc_sxa_seid_pool); + self.imsi_ue_hash = ogs_hash_make(); ogs_assert(self.imsi_ue_hash); + self.sgw_s11_teid_hash = ogs_hash_make(); + ogs_assert(self.sgw_s11_teid_hash); + self.sgwc_sxa_seid_hash = ogs_hash_make(); + ogs_assert(self.sgwc_sxa_seid_hash); ogs_list_init(&self.sgw_ue_list); @@ -66,11 +80,19 @@ ogs_assert(self.imsi_ue_hash); ogs_hash_destroy(self.imsi_ue_hash); + ogs_assert(self.sgw_s11_teid_hash); + ogs_hash_destroy(self.sgw_s11_teid_hash); + ogs_assert(self.sgwc_sxa_seid_hash); + ogs_hash_destroy(self.sgwc_sxa_seid_hash); ogs_pool_final(&sgwc_tunnel_pool); ogs_pool_final(&sgwc_bearer_pool); - ogs_pool_final(&sgwc_sess_pool); + ogs_pool_final(&sgwc_ue_pool); + ogs_pool_final(&sgwc_s11_teid_pool); + + ogs_pool_final(&sgwc_sess_pool); + ogs_pool_final(&sgwc_sxa_seid_pool); ogs_gtp_node_remove_all(&self.mme_s11_list); ogs_gtp_node_remove_all(&self.pgw_s5c_list); @@ -192,9 +214,14 @@ ogs_assert(sgwc_ue); memset(sgwc_ue, 0, sizeof *sgwc_ue); - sgwc_ue->sgw_s11_teid = ogs_pool_index(&sgwc_ue_pool, sgwc_ue); - ogs_assert(sgwc_ue->sgw_s11_teid > 0 && - sgwc_ue->sgw_s11_teid <= ogs_app()->max.ue); + /* Set SGW-S11-TEID */ + ogs_pool_alloc(&sgwc_s11_teid_pool, &sgwc_ue->sgw_s11_teid_node); + ogs_assert(sgwc_ue->sgw_s11_teid_node); + + sgwc_ue->sgw_s11_teid = *(sgwc_ue->sgw_s11_teid_node); + + ogs_hash_set(self.sgw_s11_teid_hash, + &sgwc_ue->sgw_s11_teid, sizeof(sgwc_ue->sgw_s11_teid), sgwc_ue); /* Set IMSI */ sgwc_ue->imsi_len = imsi_len; @@ -219,10 +246,13 @@ ogs_list_remove(&self.sgw_ue_list, sgwc_ue); + ogs_hash_set(self.sgw_s11_teid_hash, + &sgwc_ue->sgw_s11_teid, sizeof(sgwc_ue->sgw_s11_teid), NULL); ogs_hash_set(self.imsi_ue_hash, sgwc_ue->imsi, sgwc_ue->imsi_len, NULL); sgwc_sess_remove_all(sgwc_ue); + ogs_pool_free(&sgwc_s11_teid_pool, sgwc_ue->sgw_s11_teid_node); ogs_pool_free(&sgwc_ue_pool, sgwc_ue); ogs_info("Removed Number of SGWC-UEs is now %d", @@ -255,12 +285,12 @@ { ogs_assert(imsi && imsi_len); - return (sgwc_ue_t *)ogs_hash_get(self.imsi_ue_hash, imsi, imsi_len); + return ogs_hash_get(self.imsi_ue_hash, imsi, imsi_len); } sgwc_ue_t *sgwc_ue_find_by_teid(uint32_t teid) { - return ogs_pool_find(&sgwc_ue_pool, teid); + return ogs_hash_get(self.sgw_s11_teid_hash, &teid, sizeof(teid)); } sgwc_sess_t *sgwc_sess_add(sgwc_ue_t *sgwc_ue, char *apn) @@ -279,12 +309,15 @@ ogs_pfcp_pool_init(&sess->pfcp); - sess->index = ogs_pool_index(&sgwc_sess_pool, sess); - ogs_assert(sess->index > 0 && sess->index <= ogs_app()->pool.sess); - /* Set TEID & SEID */ - sess->sgw_s5c_teid = sess->index; - sess->sgwc_sxa_seid = sess->index; + ogs_pool_alloc(&sgwc_sxa_seid_pool, &sess->sgwc_sxa_seid_node); + ogs_assert(sess->sgwc_sxa_seid_node); + + sess->sgw_s5c_teid = *(sess->sgwc_sxa_seid_node); + sess->sgwc_sxa_seid = *(sess->sgwc_sxa_seid_node); + + ogs_hash_set(self.sgwc_sxa_seid_hash, + &sess->sgwc_sxa_seid, sizeof(sess->sgwc_sxa_seid), sess); /* Create BAR in PFCP Session */ ogs_pfcp_bar_new(&sess->pfcp); @@ -400,6 +433,9 @@ ogs_list_remove(&sgwc_ue->sess_list, sess); + ogs_hash_set(self.sgwc_sxa_seid_hash, &sess->sgwc_sxa_seid, + sizeof(sess->sgwc_sxa_seid), NULL); + sgwc_bearer_remove_all(sess); ogs_assert(sess->pfcp.bar); @@ -410,6 +446,7 @@ ogs_assert(sess->session.name); ogs_free(sess->session.name); + ogs_pool_free(&sgwc_sxa_seid_pool, sess->sgwc_sxa_seid_node); ogs_pool_free(&sgwc_sess_pool, sess); stats_remove_sgwc_session(); @@ -426,19 +463,14 @@ sgwc_sess_remove(sess); } -sgwc_sess_t *sgwc_sess_find(uint32_t index) -{ - return ogs_pool_find(&sgwc_sess_pool, index); -} - sgwc_sess_t* sgwc_sess_find_by_teid(uint32_t teid) { - return ogs_pool_find(&sgwc_sess_pool, teid); + return sgwc_sess_find_by_seid(teid); } sgwc_sess_t *sgwc_sess_find_by_seid(uint64_t seid) { - return sgwc_sess_find(seid); + return ogs_hash_get(self.sgwc_sxa_seid_hash, &seid, sizeof(seid)); } sgwc_sess_t* sgwc_sess_find_by_apn(sgwc_ue_t *sgwc_ue, char *apn) @@ -578,71 +610,6 @@ return NULL; } -sgwc_bearer_t *sgwc_bearer_find_by_error_indication_report( - sgwc_sess_t *sess, - ogs_pfcp_tlv_error_indication_report_t *error_indication_report) -{ - ogs_pfcp_f_teid_t *remote_f_teid = NULL; - sgwc_bearer_t *bearer = NULL; - sgwc_tunnel_t *tunnel = NULL; - - uint32_t teid; - uint16_t len; /* OGS_IPV4_LEN or OGS_IPV6_LEN */ - uint32_t addr4; - - ogs_assert(sess); - ogs_assert(error_indication_report); - - if (error_indication_report->presence == 0) {
View file
open5gs_2.6.2.tar.xz/src/sgwc/context.h -> open5gs_2.6.3.tar.xz/src/sgwc/context.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -39,18 +39,21 @@ typedef struct sgwc_tunnel_s sgwc_tunnel_t; typedef struct sgwc_context_s { - ogs_list_t mme_s11_list; /* MME GTPC Node List */ - ogs_list_t pgw_s5c_list; /* PGW GTPC Node List */ + ogs_list_t mme_s11_list; /* MME GTPC Node List */ + ogs_list_t pgw_s5c_list; /* PGW GTPC Node List */ - ogs_hash_t *imsi_ue_hash; /* hash table (IMSI : SGW_UE) */ + ogs_hash_t *imsi_ue_hash; /* hash table (IMSI : SGW_UE) */ + ogs_hash_t *sgw_s11_teid_hash; /* hash table (SGW-S11-TEID : SGW_UE) */ + ogs_hash_t *sgwc_sxa_seid_hash; /* hash table (SGWC-SXA-SEID : Session) */ - ogs_list_t sgw_ue_list; /* SGW_UE List */ + ogs_list_t sgw_ue_list; /* SGW_UE List */ } sgwc_context_t; typedef struct sgwc_ue_s { ogs_lnode_t lnode; + ogs_pool_id_t *sgw_s11_teid_node; /* A node of SGW-S11-TEID */ - uint32_t sgw_s11_teid; /* SGW-S11-TEID is derived from INDEX */ + uint32_t sgw_s11_teid; /* SGW-S11-TEID is derived from NODE */ uint32_t mme_s11_teid; /* MME-S11-TEID is received from MME */ /* UE identity */ @@ -70,15 +73,15 @@ #define SGWC_SESS(pfcp_sess) ogs_container_of(pfcp_sess, sgwc_sess_t, pfcp) typedef struct sgwc_sess_s { - ogs_lnode_t lnode; /* A node of list_t */ - uint32_t index; /**< An index of this node */ + ogs_lnode_t lnode; /* A node of list_t */ + ogs_pool_id_t *sgwc_sxa_seid_node; /* A node of SGWC-SXA-SEID */ ogs_pfcp_sess_t pfcp; /* PFCP session context */ - uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is derived from INDEX */ + uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is derived from NODE */ uint32_t pgw_s5c_teid; /* PGW-S5C-TEID is received from PGW */ - uint64_t sgwc_sxa_seid; /* SGW-C SEID is dervied from INDEX */ + uint64_t sgwc_sxa_seid; /* SGW-C SEID is dervied from NODE */ uint64_t sgwu_sxa_seid; /* SGW-U SEID is received from Peer */ /* APN Configuration */ @@ -106,7 +109,6 @@ typedef struct sgwc_tunnel_s { ogs_lnode_t lnode; - uint32_t index; /**< An index of this node */ uint8_t interface_type; @@ -147,7 +149,6 @@ int sgwc_sess_remove(sgwc_sess_t *sess); void sgwc_sess_remove_all(sgwc_ue_t *sgwc_ue); -sgwc_sess_t *sgwc_sess_find(uint32_t index); sgwc_sess_t *sgwc_sess_find_by_teid(uint32_t teid); sgwc_sess_t *sgwc_sess_find_by_seid(uint64_t seid); @@ -167,9 +168,6 @@ sgwc_sess_t *sess, uint8_t ebi); sgwc_bearer_t *sgwc_bearer_find_by_ue_ebi( sgwc_ue_t *sgwc_ue, uint8_t ebi); -sgwc_bearer_t *sgwc_bearer_find_by_error_indication_report( - sgwc_sess_t *sess, - ogs_pfcp_tlv_error_indication_report_t *error_indication_report); sgwc_bearer_t *sgwc_default_bearer_in_sess(sgwc_sess_t *sess); sgwc_bearer_t *sgwc_bearer_cycle(sgwc_bearer_t *bearer); @@ -182,6 +180,8 @@ sgwc_bearer_t *bearer, uint8_t interface_type); sgwc_tunnel_t *sgwc_tunnel_find_by_pdr_id( sgwc_sess_t *sess, ogs_pfcp_pdr_id_t pdr_id); +sgwc_tunnel_t *sgwc_tunnel_find_by_far_id( + sgwc_sess_t *sess, ogs_pfcp_far_id_t far_id); sgwc_tunnel_t *sgwc_dl_tunnel_in_bearer(sgwc_bearer_t *bearer); sgwc_tunnel_t *sgwc_ul_tunnel_in_bearer(sgwc_bearer_t *bearer);
View file
open5gs_2.6.2.tar.xz/src/sgwc/gtp-path.c -> open5gs_2.6.3.tar.xz/src/sgwc/gtp-path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. *
View file
open5gs_2.6.2.tar.xz/src/sgwc/pfcp-path.c -> open5gs_2.6.3.tar.xz/src/sgwc/pfcp-path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -238,7 +238,8 @@ } int sgwc_pfcp_send_session_establishment_request( - sgwc_sess_t *sess, ogs_gtp_xact_t *gtp_xact, ogs_pkbuf_t *gtpbuf) + sgwc_sess_t *sess, ogs_gtp_xact_t *gtp_xact, ogs_pkbuf_t *gtpbuf, + uint64_t flags) { int rv; ogs_pkbuf_t *sxabuf = NULL; @@ -262,9 +263,40 @@ } } xact->local_seid = sess->sgwc_sxa_seid; + xact->create_flags = flags; memset(&h, 0, sizeof(ogs_pfcp_header_t)); h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE; + +/* + * 7.2.2.4.2 Conditions for Sending SEID=0 in PFCP Header + * + * If a peer's SEID is not available, the SEID field shall still be present + * in the header and its value shall be set to "0" in the following messages: + * + * - PFCP Session Establishment Request message on Sxa/Sxb/Sxc/N4; + * + * - If a node receives a message for which it has no session, i.e. + * if SEID in the PFCP header is not known, it shall respond + * with "Session context not found" cause in the corresponding + * response message to the sender, the SEID used in the PFCP header + * in the response message shall be then set to "0"; + * + * - If a node receives a request message containing protocol error, + * e.g. Mandatory IE missing, which requires the receiver + * to reject the message as specified in clause 7.6, it shall reject + * the request message. For the response message, the node should look up + * the remote peer's SEID and accordingly set SEID in the PFCP header + * and the message cause code. As an implementation option, + * the node may not look up the remote peer's SEID and + * set the PFCP header SEID to "0" in the response message. + * However in this case, the cause value shall not be set + * to "Session not found". + * + * - When the UP function sends PFCP Session Report Request message + * 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 = sess->sgwu_sxa_seid; sxabuf = sgwc_sxa_build_session_establishment_request(h.type, sess);
View file
open5gs_2.6.2.tar.xz/src/sgwc/pfcp-path.h -> open5gs_2.6.3.tar.xz/src/sgwc/pfcp-path.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -33,7 +33,8 @@ sgwc_sess_t *sess, ogs_pfcp_xact_t *xact); int sgwc_pfcp_send_session_establishment_request( - sgwc_sess_t *sess, ogs_gtp_xact_t *gtp_xact, ogs_pkbuf_t *gtpbuf); + sgwc_sess_t *sess, ogs_gtp_xact_t *gtp_xact, ogs_pkbuf_t *gtpbuf, + uint64_t flags); int sgwc_pfcp_send_session_modification_request( sgwc_sess_t *sess, ogs_gtp_xact_t *gtp_xact,
View file
open5gs_2.6.2.tar.xz/src/sgwc/pfcp-sm.c -> open5gs_2.6.3.tar.xz/src/sgwc/pfcp-sm.c
Changed
@@ -20,6 +20,7 @@ #include "pfcp-path.h" #include "sxa-handler.h" +static void pfcp_restoration(ogs_pfcp_node_t *node); static void node_timeout(ogs_pfcp_xact_t *xact, void *data); void sgwc_pfcp_state_initial(ogs_fsm_t *s, sgwc_event_t *e) @@ -188,6 +189,7 @@ ogs_pfcp_send_heartbeat_request(node, node_timeout)); if (node->restoration_required == true) { + pfcp_restoration(node); node->restoration_required = false; ogs_error("PFCP restoration"); } @@ -220,11 +222,56 @@ ogs_expect(true == ogs_pfcp_handle_heartbeat_request(node, xact, &message->pfcp_heartbeat_request)); + if (node->restoration_required == true) { + if (node->t_association) { + /* + * node->t_association that the PFCP entity attempts an association. + * + * In this case, even if Remote PFCP entity is restarted, + * PFCP restoration must be performed after PFCP association. + * + * Otherwise, Session related PFCP cannot be initiated + * because the peer PFCP entity is in a de-associated state. + */ + OGS_FSM_TRAN(s, sgwc_pfcp_state_will_associate); + } else { + + /* + * If the peer PFCP entity is performing the association, + * Restoration can be performed immediately. + */ + pfcp_restoration(node); + node->restoration_required = false; + ogs_error("PFCP restoration"); + } + } break; case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE: ogs_expect(true == ogs_pfcp_handle_heartbeat_response(node, xact, &message->pfcp_heartbeat_response)); + if (node->restoration_required == true) { + /* + * node->t_association that the PFCP entity attempts an association. + * + * In this case, even if Remote PFCP entity is restarted, + * PFCP restoration must be performed after PFCP association. + * + * Otherwise, Session related PFCP cannot be initiated + * because the peer PFCP entity is in a de-associated state. + */ + if (node->t_association) { + OGS_FSM_TRAN(s, sgwc_pfcp_state_will_associate); + } else { + /* + * If the peer PFCP entity is performing the association, + * Restoration can be performed immediately. + */ + pfcp_restoration(node); + node->restoration_required = false; + ogs_error("PFCP restoration"); + } + } break; case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE: ogs_warn("PFCPREQ has already been associated %s:%d", @@ -243,9 +290,24 @@ case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE: if (!message->h.seid_presence) ogs_error("No SEID"); - sgwc_sxa_handle_session_establishment_response( - sess, xact, e->gtp_message, - &message->pfcp_session_establishment_response); + if ((xact->create_flags & + OGS_PFCP_CREATE_RESTORATION_INDICATION)) { + ogs_pfcp_session_establishment_response_t *rsp = NULL; + ogs_pfcp_f_seid_t *up_f_seid = NULL; + + rsp = &message->pfcp_session_establishment_response; + if (rsp->up_f_seid.presence == 0) { + ogs_error("No UP F-SEID"); + break; + } + up_f_seid = rsp->up_f_seid.data; + ogs_assert(up_f_seid); + sess->sgwu_sxa_seid = be64toh(up_f_seid->seid); + } else { + sgwc_sxa_handle_session_establishment_response( + sess, xact, e->gtp_message, + &message->pfcp_session_establishment_response); + } break; case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE: @@ -326,6 +388,29 @@ } } +static void pfcp_restoration(ogs_pfcp_node_t *node) +{ + sgwc_ue_t *sgwc_ue = NULL; + + ogs_list_for_each(&sgwc_self()->sgw_ue_list, sgwc_ue) { + sgwc_sess_t *sess = NULL; + ogs_assert(sgwc_ue); + + ogs_list_for_each(&sgwc_ue->sess_list, sess) { + ogs_assert(sess); + + if (node == sess->pfcp_node) { + ogs_info("UE IMSI%s APN%s", + sgwc_ue->imsi_bcd, sess->session.name); + ogs_assert(OGS_OK == + sgwc_pfcp_send_session_establishment_request( + sess, NULL, NULL, + OGS_PFCP_CREATE_RESTORATION_INDICATION)); + } + } + } +} + static void node_timeout(ogs_pfcp_xact_t *xact, void *data) { int rv;
View file
open5gs_2.6.2.tar.xz/src/sgwc/s11-handler.c -> open5gs_2.6.3.tar.xz/src/sgwc/s11-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -234,6 +234,8 @@ sess = sgwc_sess_add(sgwc_ue, apn); ogs_assert(sess); + ogs_info("UE IMSI%s APN%s", sgwc_ue->imsi_bcd, sess->session.name); + /* Set User Location Information */ if (req->user_location_information.presence == 1) { decoded = ogs_gtp2_parse_uli(&uli, &req->user_location_information); @@ -376,7 +378,8 @@ sgwc_ue->mme_s11_teid, sgwc_ue->sgw_s11_teid); ogs_assert(OGS_OK == - sgwc_pfcp_send_session_establishment_request(sess, s11_xact, gtpbuf)); + sgwc_pfcp_send_session_establishment_request( + sess, s11_xact, gtpbuf, 0)); } void sgwc_s11_handle_modify_bearer_request(
View file
open5gs_2.6.2.tar.xz/src/sgwc/sxa-handler.c -> open5gs_2.6.3.tar.xz/src/sgwc/sxa-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -1297,10 +1297,7 @@ ogs_pfcp_xact_commit(pfcp_xact); - if (!gtp_message) { - ogs_error("No GTP Message"); - goto cleanup; - } + if (!gtp_message) goto cleanup; if (gtp_message->h.type == OGS_GTP2_DELETE_SESSION_REQUEST_TYPE) { /* @@ -1380,7 +1377,10 @@ } cleanup: - sgwc_sess_remove(sess); + if (sgwc_sess_cycle(sess)) + sgwc_sess_remove(sess); + else + ogs_error("Session has already been removed"); } void sgwc_sxa_handle_session_report_request( @@ -1390,6 +1390,7 @@ sgwc_ue_t *sgwc_ue = NULL; sgwc_bearer_t *bearer = NULL; sgwc_tunnel_t *tunnel = NULL; + ogs_pfcp_far_t *far = NULL; ogs_pfcp_report_type_t report_type; uint8_t cause_value = 0; @@ -1470,22 +1471,44 @@ ogs_error("Cannot find the PDR-ID%d", pdr_id); } else if (report_type.error_indication_report) { - bearer = sgwc_bearer_find_by_error_indication_report( - sess, &pfcp_req->error_indication_report); - - if (!bearer) return; - - ogs_list_for_each(&sgwc_ue->sess_list, sess) { - - ogs_assert(OGS_OK == - sgwc_pfcp_send_session_modification_request(sess, - /* We only use the `assoc_xact` parameter temporarily here - * to pass the `bearer` context. */ - (ogs_gtp_xact_t *)bearer, - NULL, - OGS_PFCP_MODIFY_DL_ONLY|OGS_PFCP_MODIFY_DEACTIVATE| - OGS_PFCP_MODIFY_ERROR_INDICATION)); - } + far = ogs_pfcp_far_find_by_pfcp_session_report( + &sess->pfcp, &pfcp_req->error_indication_report); + if (far) { + tunnel = sgwc_tunnel_find_by_far_id(sess, far->id); + ogs_assert(tunnel); + bearer = tunnel->bearer; + ogs_assert(bearer); + if (far->dst_if == OGS_PFCP_INTERFACE_ACCESS) { + ogs_warn("%s Error Indication from eNB", sgwc_ue->imsi_bcd); + ogs_list_for_each(&sgwc_ue->sess_list, sess) { + ogs_assert(OGS_OK == + sgwc_pfcp_send_session_modification_request(sess, + /* We only use the `assoc_xact` parameter temporarily here + * to pass the `bearer` context. */ + (ogs_gtp_xact_t *)bearer, + NULL, + OGS_PFCP_MODIFY_DL_ONLY|OGS_PFCP_MODIFY_DEACTIVATE| + OGS_PFCP_MODIFY_ERROR_INDICATION)); + } + } else if (far->dst_if == OGS_PFCP_INTERFACE_CORE) { + if (sgwc_default_bearer_in_sess(sess) == bearer) { + ogs_error("%s Error Indication(Default Bearer) from SMF", + sgwc_ue->imsi_bcd); + ogs_assert(OGS_OK == + sgwc_pfcp_send_session_deletion_request( + sess, NULL, NULL)); + } else { + ogs_error("%s Error Indication(Dedicated Bearer) " + "from SMF", sgwc_ue->imsi_bcd); + ogs_assert(OGS_OK == + sgwc_pfcp_send_bearer_modification_request( + bearer, NULL, NULL, OGS_PFCP_MODIFY_REMOVE)); + } + } else { + ogs_error("Error Indication Ignored for Indirect Tunnel"); + } + } else + ogs_error("Cannot find Session in Error Indication"); } else { ogs_error("Not supported Report Type%d", report_type.value);
View file
open5gs_2.6.2.tar.xz/src/sgwu/context.c -> open5gs_2.6.3.tar.xz/src/sgwu/context.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -24,6 +24,7 @@ int __sgwu_log_domain; static OGS_POOL(sgwu_sess_pool, sgwu_sess_t); +static OGS_POOL(sgwu_sxa_seid_pool, ogs_pool_id_t); static int context_initialized = 0; @@ -43,11 +44,15 @@ ogs_list_init(&self.sess_list); ogs_pool_init(&sgwu_sess_pool, ogs_app()->pool.sess); + ogs_pool_init(&sgwu_sxa_seid_pool, ogs_app()->pool.sess); + ogs_pool_random_id_generate(&sgwu_sxa_seid_pool); - self.seid_hash = ogs_hash_make(); - ogs_assert(self.seid_hash); - self.f_seid_hash = ogs_hash_make(); - ogs_assert(self.f_seid_hash); + self.sgwu_sxa_seid_hash = ogs_hash_make(); + ogs_assert(self.sgwu_sxa_seid_hash); + self.sgwc_sxa_seid_hash = ogs_hash_make(); + ogs_assert(self.sgwc_sxa_seid_hash); + self.sgwc_sxa_f_seid_hash = ogs_hash_make(); + ogs_assert(self.sgwc_sxa_f_seid_hash); context_initialized = 1; } @@ -58,12 +63,15 @@ sgwu_sess_remove_all(); - ogs_assert(self.seid_hash); - ogs_hash_destroy(self.seid_hash); - ogs_assert(self.f_seid_hash); - ogs_hash_destroy(self.f_seid_hash); + ogs_assert(self.sgwu_sxa_seid_hash); + ogs_hash_destroy(self.sgwu_sxa_seid_hash); + ogs_assert(self.sgwc_sxa_seid_hash); + ogs_hash_destroy(self.sgwc_sxa_seid_hash); + ogs_assert(self.sgwc_sxa_f_seid_hash); + ogs_hash_destroy(self.sgwc_sxa_f_seid_hash); ogs_pool_final(&sgwu_sess_pool); + ogs_pool_final(&sgwu_sxa_seid_pool); context_initialized = 0; } @@ -137,10 +145,14 @@ ogs_pfcp_pool_init(&sess->pfcp); - sess->index = ogs_pool_index(&sgwu_sess_pool, sess); - ogs_assert(sess->index > 0 && sess->index <= ogs_app()->pool.sess); + /* Set SEID */ + ogs_pool_alloc(&sgwu_sxa_seid_pool, &sess->sgwu_sxa_seid_node); + ogs_assert(sess->sgwu_sxa_seid_node); - sess->sgwu_sxa_seid = sess->index; + sess->sgwu_sxa_seid = *(sess->sgwu_sxa_seid_node); + + ogs_hash_set(self.sgwu_sxa_seid_hash, &sess->sgwu_sxa_seid, + sizeof(sess->sgwu_sxa_seid), sess); /* Since F-SEID is composed of ogs_ip_t and uint64-seid, * all these values must be put into the structure-sgwc_sxa_f_eid @@ -149,9 +161,9 @@ ogs_assert(OGS_OK == ogs_pfcp_f_seid_to_ip(cp_f_seid, &sess->sgwc_sxa_f_seid.ip)); - ogs_hash_set(self.f_seid_hash, &sess->sgwc_sxa_f_seid, + ogs_hash_set(self.sgwc_sxa_f_seid_hash, &sess->sgwc_sxa_f_seid, sizeof(sess->sgwc_sxa_f_seid), sess); - ogs_hash_set(self.seid_hash, &sess->sgwc_sxa_f_seid.seid, + ogs_hash_set(self.sgwc_sxa_seid_hash, &sess->sgwc_sxa_f_seid.seid, sizeof(sess->sgwc_sxa_f_seid.seid), sess); ogs_info("UE F-SEIDUP:0x%lx CP:0x%lx", @@ -172,13 +184,17 @@ ogs_list_remove(&self.sess_list, sess); ogs_pfcp_sess_clear(&sess->pfcp); - ogs_hash_set(self.seid_hash, &sess->sgwc_sxa_f_seid.seid, + ogs_hash_set(self.sgwu_sxa_seid_hash, &sess->sgwu_sxa_seid, + sizeof(sess->sgwu_sxa_seid), NULL); + + ogs_hash_set(self.sgwc_sxa_seid_hash, &sess->sgwc_sxa_f_seid.seid, sizeof(sess->sgwc_sxa_f_seid.seid), NULL); - ogs_hash_set(self.f_seid_hash, &sess->sgwc_sxa_f_seid, + ogs_hash_set(self.sgwc_sxa_f_seid_hash, &sess->sgwc_sxa_f_seid, sizeof(sess->sgwc_sxa_f_seid), NULL); ogs_pfcp_pool_final(&sess->pfcp); + ogs_pool_free(&sgwu_sxa_seid_pool, sess->sgwu_sxa_seid_node); ogs_pool_free(&sgwu_sess_pool, sess); ogs_info("Removed Number of SGWU-sessions is now %d", @@ -196,14 +212,9 @@ } } -sgwu_sess_t *sgwu_sess_find(uint32_t index) -{ - return ogs_pool_find(&sgwu_sess_pool, index); -} - sgwu_sess_t *sgwu_sess_find_by_sgwc_sxa_seid(uint64_t seid) { - return (sgwu_sess_t *)ogs_hash_get(self.seid_hash, &seid, sizeof(seid)); + return ogs_hash_get(self.sgwc_sxa_seid_hash, &seid, sizeof(seid)); } sgwu_sess_t *sgwu_sess_find_by_sgwc_sxa_f_seid(ogs_pfcp_f_seid_t *f_seid) @@ -217,12 +228,12 @@ ogs_assert(OGS_OK == ogs_pfcp_f_seid_to_ip(f_seid, &key.ip)); key.seid = f_seid->seid; - return (sgwu_sess_t *)ogs_hash_get(self.f_seid_hash, &key, sizeof(key)); + return ogs_hash_get(self.sgwc_sxa_f_seid_hash, &key, sizeof(key)); } sgwu_sess_t *sgwu_sess_find_by_sgwu_sxa_seid(uint64_t seid) { - return sgwu_sess_find(seid); + return ogs_hash_get(self.sgwu_sxa_seid_hash, &seid, sizeof(seid)); } sgwu_sess_t *sgwu_sess_add_by_message(ogs_pfcp_message_t *message) @@ -244,7 +255,10 @@ sess = sgwu_sess_find_by_sgwc_sxa_f_seid(f_seid); if (!sess) { sess = sgwu_sess_add(f_seid); - if (!sess) return NULL; + if (!sess) { + ogs_error("No Session Context"); + return NULL; + } } ogs_assert(sess);
View file
open5gs_2.6.2.tar.xz/src/sgwu/context.h -> open5gs_2.6.3.tar.xz/src/sgwu/context.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -37,16 +37,17 @@ #define OGS_LOG_DOMAIN __sgwu_log_domain typedef struct sgwu_context_s { - ogs_hash_t *seid_hash; /* hash table (SEID) */ - ogs_hash_t *f_seid_hash; /* hash table (F-SEID) */ + ogs_hash_t *sgwu_sxa_seid_hash; /* hash table (SGWU-SXA-SEID) */ + ogs_hash_t *sgwc_sxa_seid_hash; /* hash table (SGWC-SXA-SEID) */ + ogs_hash_t *sgwc_sxa_f_seid_hash; /* hash table (SGWC-SXA-F-SEID) */ - ogs_list_t sess_list; + ogs_list_t sess_list; } sgwu_context_t; #define SGWU_SESS(pfcp_sess) ogs_container_of(pfcp_sess, sgwu_sess_t, pfcp) typedef struct sgwu_sess_s { ogs_lnode_t lnode; - uint32_t index; /**< An index of this node */ + ogs_pool_id_t *sgwu_sxa_seid_node; /* A node of SGWU-SXA-SEID */ ogs_pfcp_sess_t pfcp; @@ -70,7 +71,6 @@ sgwu_sess_t *sgwu_sess_add(ogs_pfcp_f_seid_t *f_seid); int sgwu_sess_remove(sgwu_sess_t *sess); void sgwu_sess_remove_all(void); -sgwu_sess_t *sgwu_sess_find(uint32_t index); sgwu_sess_t *sgwu_sess_find_by_sgwc_sxa_seid(uint64_t seid); sgwu_sess_t *sgwu_sess_find_by_sgwc_sxa_f_seid(ogs_pfcp_f_seid_t *f_seid); sgwu_sess_t *sgwu_sess_find_by_sgwu_sxa_seid(uint64_t seid);
View file
open5gs_2.6.2.tar.xz/src/sgwu/gtp-path.c -> open5gs_2.6.3.tar.xz/src/sgwu/gtp-path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -28,11 +28,13 @@ { int len; ssize_t size; - char bufOGS_ADDRSTRLEN; + char buf1OGS_ADDRSTRLEN; + char buf2OGS_ADDRSTRLEN; sgwu_sess_t *sess = NULL; ogs_pkbuf_t *pkbuf = NULL; + ogs_sock_t *sock = NULL; ogs_sockaddr_t from; ogs_gtp2_header_t *gtp_h = NULL; @@ -42,6 +44,8 @@ uint8_t qfi; ogs_assert(fd != INVALID_SOCKET); + sock = data; + ogs_assert(sock); pkbuf = ogs_pkbuf_alloc(packet_pool, OGS_MAX_PKT_LEN); ogs_assert(pkbuf); @@ -69,14 +73,14 @@ if (gtp_h->type == OGS_GTPU_MSGTYPE_ECHO_REQ) { ogs_pkbuf_t *echo_rsp; - ogs_debug("RECV Echo Request from %s", OGS_ADDR(&from, buf)); + ogs_debug("RECV Echo Request from %s", OGS_ADDR(&from, buf1)); echo_rsp = ogs_gtp2_handle_echo_req(pkbuf); ogs_expect(echo_rsp); if (echo_rsp) { ssize_t sent; /* Echo reply */ - ogs_debug("SEND Echo Response to %s", OGS_ADDR(&from, buf)); + ogs_debug("SEND Echo Response to %s", OGS_ADDR(&from, buf1)); sent = ogs_sendto(fd, echo_rsp->data, echo_rsp->len, 0, &from); if (sent < 0 || sent != echo_rsp->len) { @@ -91,7 +95,7 @@ teid = be32toh(gtp_h->teid); ogs_trace("RECV GPU-U Type %d from %s : TEID0x%x", - gtp_h->type, OGS_ADDR(&from, buf), teid); + gtp_h->type, OGS_ADDR(&from, buf1), teid); qfi = 0; if (gtp_h->flags & OGS_GTPU_FLAGS_E) { @@ -139,7 +143,27 @@ pfcp_object = ogs_pfcp_object_find_by_teid(teid); if (!pfcp_object) { - /* TODO : Send Error Indication */ + /* + * Refer to the following 5G standard + * + * TS23.527 Restoration procedures + * 4.3 UPF Restoration Procedures + * 4.3.2 Restoration Procedure for PSA UPF Restart + * + * The UPF shall not send GTP-U Error indication message + * for a configurable period after an UPF restart + * when the UPF receives a G-PDU not matching any PDRs. + */ + if (ogs_time_ntp32_now() > + (ogs_pfcp_self()->local_recovery + + ogs_time_sec( + ogs_app()->time.message.pfcp.association_interval))) { + ogs_error("%s Send Error Indication TEID:0x%x to %s", + OGS_ADDR(&sock->local_addr, buf1), + teid, + OGS_ADDR(&from, buf2)); + ogs_gtp1_send_error_indication(sock, teid, 0, &from); + } goto cleanup; } @@ -164,7 +188,7 @@ } else if (gtp_h->type == OGS_GTPU_MSGTYPE_ERR_IND) { ogs_pfcp_far_t *far = NULL; - far = ogs_pfcp_far_find_by_error_indication(pkbuf); + far = ogs_pfcp_far_find_by_gtpu_error_indication(pkbuf); if (far) { ogs_assert(true == ogs_pfcp_up_handle_error_indication(far, &report)); @@ -177,7 +201,6 @@ ogs_assert(OGS_OK == sgwu_pfcp_send_session_report_request(sess, &report)); } - } else { ogs_error("DROP Cannot find FAR by Error-Indication"); ogs_log_hexdump(OGS_LOG_ERROR, pkbuf->data, pkbuf->len); @@ -193,7 +216,27 @@ pfcp_object = ogs_pfcp_object_find_by_teid(teid); if (!pfcp_object) { - /* TODO : Send Error Indication */ + /* + * Refer to the following 5G standard + * + * TS23.527 Restoration procedures + * 4.3 UPF Restoration Procedures + * 4.3.2 Restoration Procedure for PSA UPF Restart + * + * The UPF shall not send GTP-U Error indication message + * for a configurable period after an UPF restart + * when the UPF receives a G-PDU not matching any PDRs. + */ + if (ogs_time_ntp32_now() > + (ogs_pfcp_self()->local_recovery + + ogs_time_sec( + ogs_app()->time.message.pfcp.association_interval))) { + ogs_error("%s Send Error Indication TEID:0x%x to %s", + OGS_ADDR(&sock->local_addr, buf1), + teid, + OGS_ADDR(&from, buf2)); + ogs_gtp1_send_error_indication(sock, teid, 0, &from); + } goto cleanup; } @@ -203,6 +246,8 @@ ogs_assert(pdr); break; case OGS_PFCP_OBJ_SESS_TYPE: + /* SGWU does not use SESS TYPE */ + ogs_assert_if_reached(); pfcp_sess = (ogs_pfcp_sess_t *)pfcp_object; ogs_assert(pfcp_sess); @@ -266,7 +311,7 @@ config.cluster_2048_pool = ogs_app()->pool.packet; -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 /* allocate a talloc pool for GTP to ensure it doesn't have to go back * to the libc malloc all the time */ packet_pool = talloc_pool(__ogs_talloc_core, 1000*1024);
View file
open5gs_2.6.2.tar.xz/src/sgwu/pfcp-path.c -> open5gs_2.6.3.tar.xz/src/sgwu/pfcp-path.c
Changed
@@ -205,7 +205,6 @@ ogs_pfcp_header_t h; ogs_assert(xact); - ogs_assert(created_pdr); memset(&h, 0, sizeof(ogs_pfcp_header_t)); h.type = OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE;
View file
open5gs_2.6.2.tar.xz/src/sgwu/pfcp-sm.c -> open5gs_2.6.3.tar.xz/src/sgwu/pfcp-sm.c
Changed
@@ -277,12 +277,9 @@ &message->pfcp_association_setup_response); break; case OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE: - if (message->h.seid_presence && message->h.seid == 0) { - ogs_expect(!sess); - sess = sgwu_sess_add_by_message(message); - if (sess) - OGS_SETUP_PFCP_NODE(sess, node); - } + sess = sgwu_sess_add_by_message(message); + if (sess) + OGS_SETUP_PFCP_NODE(sess, node); sgwu_sxa_handle_session_establishment_request( sess, xact, &message->pfcp_session_establishment_request); break;
View file
open5gs_2.6.2.tar.xz/src/sgwu/sxa-handler.c -> open5gs_2.6.3.tar.xz/src/sgwu/sxa-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -33,6 +33,9 @@ uint8_t offending_ie_value = 0; int i; + ogs_pfcp_sereq_flags_t sereq_flags; + bool restoration_indication = false; + ogs_assert(xact); ogs_assert(req); @@ -48,9 +51,16 @@ return; } + /* PFCPSEReq-Flags */ + memset(&sereq_flags, 0, sizeof(sereq_flags)); + if (req->pfcpsereq_flags.presence == 1) { + sereq_flags.value = req->pfcpsereq_flags.u8; + } + for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) { created_pdri = ogs_pfcp_handle_create_pdr(&sess->pfcp, - &req->create_pdri, &cause_value, &offending_ie_value); + &req->create_pdri, &sereq_flags, + &cause_value, &offending_ie_value); if (created_pdri == NULL) break; } @@ -79,6 +89,18 @@ if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) goto cleanup; + /* PFCPSEReq-Flags */ + if (sereq_flags.restoration_indication == 1) { + for (i = 0; i < num_of_created_pdr; i++) { + pdr = created_pdri; + ogs_assert(pdr); + + if (pdr->f_teid_len) + ogs_pfcp_pdr_swap_teid(pdr); + } + restoration_indication = true; + } + /* Setup GTP Node */ ogs_list_for_each(&sess->pfcp.far_list, far) { ogs_assert(OGS_ERROR != ogs_pfcp_setup_far_gtpu_node(far)); @@ -86,70 +108,14 @@ ogs_pfcp_far_f_teid_hash_set(far); } - /* Setup TEID Hash */ for (i = 0; i < num_of_created_pdr; i++) { pdr = created_pdri; ogs_assert(pdr); - if (pdr->f_teid_len) { - ogs_pfcp_object_type_e type = OGS_PFCP_OBJ_PDR_TYPE; - - if (ogs_pfcp_self()->up_function_features.ftup && - pdr->f_teid.ch) { - - ogs_pfcp_pdr_t *choosed_pdr = NULL; - - if (pdr->f_teid.chid) { - type = OGS_PFCP_OBJ_SESS_TYPE; - - choosed_pdr = ogs_pfcp_pdr_find_by_choose_id( - &sess->pfcp, pdr->f_teid.choose_id); - if (!choosed_pdr) { - pdr->chid = true; - pdr->choose_id = pdr->f_teid.choose_id; - } - } - - if (choosed_pdr) { - pdr->f_teid_len = choosed_pdr->f_teid_len; - memcpy(&pdr->f_teid, &choosed_pdr->f_teid, pdr->f_teid_len); - - } else { - ogs_gtpu_resource_t *resource = NULL; - resource = ogs_pfcp_find_gtpu_resource( - &ogs_gtp_self()->gtpu_resource_list, - pdr->apn, OGS_PFCP_INTERFACE_ACCESS); - if (resource) { - ogs_assert( - (resource->info.v4 && pdr->f_teid.ipv4) || - (resource->info.v6 && pdr->f_teid.ipv6)); - ogs_assert(OGS_OK == - ogs_pfcp_user_plane_ip_resource_info_to_f_teid( - &resource->info, &pdr->f_teid, &pdr->f_teid_len)); - if (resource->info.teidri) - pdr->f_teid.teid = OGS_PFCP_GTPU_INDEX_TO_TEID( - pdr->index, resource->info.teidri, - resource->info.teid_range); - else - pdr->f_teid.teid = pdr->index; - } else { - ogs_assert( - (ogs_gtp_self()->gtpu_addr && pdr->f_teid.ipv4) || - (ogs_gtp_self()->gtpu_addr6 && pdr->f_teid.ipv6)); - ogs_assert(OGS_OK == - ogs_pfcp_sockaddr_to_f_teid( - pdr->f_teid.ipv4 ? - ogs_gtp_self()->gtpu_addr : NULL, - pdr->f_teid.ipv6 ? - ogs_gtp_self()->gtpu_addr6 : NULL, - &pdr->f_teid, &pdr->f_teid_len)); - pdr->f_teid.teid = pdr->index; - } - } - } - - ogs_pfcp_object_teid_hash_set(type, pdr); - } + /* Setup TEID Hash */ + if (pdr->f_teid_len) + ogs_pfcp_object_teid_hash_set( + OGS_PFCP_OBJ_PDR_TYPE, pdr, restoration_indication); } /* Send Buffered Packet to gNB */ @@ -159,9 +125,15 @@ } } - ogs_assert(OGS_OK == - sgwu_pfcp_send_session_establishment_response( - xact, sess, created_pdr, num_of_created_pdr)); + if (restoration_indication == true || + ogs_pfcp_self()->up_function_features.ftup == 0) + ogs_assert(OGS_OK == + sgwu_pfcp_send_session_establishment_response( + xact, sess, NULL, 0)); + else + ogs_assert(OGS_OK == + sgwu_pfcp_send_session_establishment_response( + xact, sess, created_pdr, num_of_created_pdr)); return; cleanup: @@ -200,7 +172,7 @@ for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) { created_pdri = ogs_pfcp_handle_create_pdr(&sess->pfcp, - &req->create_pdri, &cause_value, &offending_ie_value); + &req->create_pdri, NULL, &cause_value, &offending_ie_value); if (created_pdri == NULL) break; } @@ -301,70 +273,13 @@ ogs_pfcp_far_f_teid_hash_set(far); } - /* Setup TEID Hash */ for (i = 0; i < num_of_created_pdr; i++) { pdr = created_pdri; ogs_assert(pdr); - if (pdr->f_teid_len) { - ogs_pfcp_object_type_e type = OGS_PFCP_OBJ_PDR_TYPE; - - if (ogs_pfcp_self()->up_function_features.ftup && - pdr->f_teid.ch) { - - ogs_pfcp_pdr_t *choosed_pdr = NULL; - - if (pdr->f_teid.chid) { - type = OGS_PFCP_OBJ_SESS_TYPE; - - choosed_pdr = ogs_pfcp_pdr_find_by_choose_id( - &sess->pfcp, pdr->f_teid.choose_id); - if (!choosed_pdr) { - pdr->chid = true; - pdr->choose_id = pdr->f_teid.choose_id; - } - } - - if (choosed_pdr) { - pdr->f_teid_len = choosed_pdr->f_teid_len; - memcpy(&pdr->f_teid, &choosed_pdr->f_teid, pdr->f_teid_len); - - } else { - ogs_gtpu_resource_t *resource = NULL; - resource = ogs_pfcp_find_gtpu_resource( - &ogs_gtp_self()->gtpu_resource_list, - pdr->apn, OGS_PFCP_INTERFACE_ACCESS); - if (resource) { - ogs_assert( - (resource->info.v4 && pdr->f_teid.ipv4) || - (resource->info.v6 && pdr->f_teid.ipv6)); - ogs_assert(OGS_OK == - ogs_pfcp_user_plane_ip_resource_info_to_f_teid(
View file
open5gs_2.6.2.tar.xz/src/smf/binding.c -> open5gs_2.6.3.tar.xz/src/smf/binding.c
Changed
@@ -197,10 +197,10 @@ &bearer->pgw_s5u_addr, &bearer->pgw_s5u_addr6); if (resource->info.teidri) bearer->pgw_s5u_teid = OGS_PFCP_GTPU_INDEX_TO_TEID( - ul_pdr->index, resource->info.teidri, + ul_pdr->teid, resource->info.teidri, resource->info.teid_range); else - bearer->pgw_s5u_teid = ul_pdr->index; + bearer->pgw_s5u_teid = ul_pdr->teid; } else { if (sess->pfcp_node->addr.ogs_sa_family == AF_INET) ogs_assert(OGS_OK == @@ -214,7 +214,7 @@ else ogs_assert_if_reached(); - bearer->pgw_s5u_teid = ul_pdr->index; + bearer->pgw_s5u_teid = ul_pdr->teid; } ogs_assert(OGS_OK ==
View file
open5gs_2.6.2.tar.xz/src/smf/context.c -> open5gs_2.6.3.tar.xz/src/smf/context.c
Changed
@@ -29,11 +29,12 @@ static OGS_POOL(smf_gtp_node_pool, smf_gtp_node_t); static OGS_POOL(smf_ue_pool, smf_ue_t); -static OGS_POOL(smf_sess_pool, smf_sess_t); static OGS_POOL(smf_bearer_pool, smf_bearer_t); - static OGS_POOL(smf_pf_pool, smf_pf_t); +static OGS_POOL(smf_sess_pool, smf_sess_t); +static OGS_POOL(smf_n4_seid_pool, ogs_pool_id_t); + static int context_initialized = 0; static int num_of_smf_sess = 0; @@ -82,16 +83,20 @@ ogs_pool_init(&smf_gtp_node_pool, ogs_app()->pool.nf); ogs_pool_init(&smf_ue_pool, ogs_app()->max.ue); - ogs_pool_init(&smf_sess_pool, ogs_app()->pool.sess); ogs_pool_init(&smf_bearer_pool, ogs_app()->pool.bearer); - ogs_pool_init(&smf_pf_pool, ogs_app()->pool.bearer * OGS_MAX_NUM_OF_FLOW_IN_BEARER); + ogs_pool_init(&smf_sess_pool, ogs_app()->pool.sess); + ogs_pool_init(&smf_n4_seid_pool, ogs_app()->pool.sess); + ogs_pool_random_id_generate(&smf_n4_seid_pool); + self.supi_hash = ogs_hash_make(); ogs_assert(self.supi_hash); self.imsi_hash = ogs_hash_make(); ogs_assert(self.imsi_hash); + self.smf_n4_seid_hash = ogs_hash_make(); + ogs_assert(self.smf_n4_seid_hash); self.ipv4_hash = ogs_hash_make(); ogs_assert(self.ipv4_hash); self.ipv6_hash = ogs_hash_make(); @@ -99,7 +104,6 @@ self.n1n2message_hash = ogs_hash_make(); ogs_assert(self.n1n2message_hash); - context_initialized = 1; } @@ -114,6 +118,8 @@ ogs_hash_destroy(self.supi_hash); ogs_assert(self.imsi_hash); ogs_hash_destroy(self.imsi_hash); + ogs_assert(self.smf_n4_seid_hash); + ogs_hash_destroy(self.smf_n4_seid_hash); ogs_assert(self.ipv4_hash); ogs_hash_destroy(self.ipv4_hash); ogs_assert(self.ipv6_hash); @@ -123,10 +129,11 @@ ogs_pool_final(&smf_ue_pool); ogs_pool_final(&smf_bearer_pool); - ogs_pool_final(&smf_sess_pool); - ogs_pool_final(&smf_pf_pool); + ogs_pool_final(&smf_sess_pool); + ogs_pool_final(&smf_n4_seid_pool); + ogs_list_for_each_entry_safe(&self.sgw_s5c_list, next_gnode, gnode, node) { smf_gtp_node_t *smf_gnode = gnode->data_ptr; ogs_assert(smf_gnode); @@ -1198,8 +1205,14 @@ ogs_assert(sess->index > 0 && sess->index <= ogs_app()->pool.sess); /* Set TEID & SEID */ - sess->smf_n4_teid = sess->index; - sess->smf_n4_seid = sess->index; + ogs_pool_alloc(&smf_n4_seid_pool, &sess->smf_n4_seid_node); + ogs_assert(sess->smf_n4_seid_node); + + sess->smf_n4_teid = *(sess->smf_n4_seid_node); + sess->smf_n4_seid = *(sess->smf_n4_seid_node); + + ogs_hash_set(self.smf_n4_seid_hash, &sess->smf_n4_seid, + sizeof(sess->smf_n4_seid), sess); /* Set Charging ID */ sess->charging.id = sess->index; @@ -1403,9 +1416,18 @@ sess->index = ogs_pool_index(&smf_sess_pool, sess); ogs_assert(sess->index > 0 && sess->index <= ogs_app()->pool.sess); + /* Set TEID & SEID */ + ogs_pool_alloc(&smf_n4_seid_pool, &sess->smf_n4_seid_node); + ogs_assert(sess->smf_n4_seid_node); + + sess->smf_n4_teid = *(sess->smf_n4_seid_node); + sess->smf_n4_seid = *(sess->smf_n4_seid_node); + + ogs_hash_set(self.smf_n4_seid_hash, &sess->smf_n4_seid, + sizeof(sess->smf_n4_seid), sess); + /* Set SmContextRef in 5GC */ - sess->sm_context_ref = ogs_msprintf("%d", - (int)ogs_pool_index(&smf_sess_pool, sess)); + sess->sm_context_ref = ogs_msprintf("%d", sess->index); ogs_assert(sess->sm_context_ref); /* Create BAR in PFCP Session */ @@ -1420,10 +1442,6 @@ sess->mapped_hplmn.sst = 0; sess->mapped_hplmn.sd.v = OGS_S_NSSAI_NO_SD_VALUE; - /* Set TEID & SEID */ - sess->smf_n4_teid = sess->index; - sess->smf_n4_seid = sess->index; - /* Set Charging Id */ sess->charging.id = sess->index; @@ -1623,68 +1641,6 @@ sess); } -smf_sess_t *smf_sess_find_by_error_indication_report( - smf_ue_t *smf_ue, - ogs_pfcp_tlv_error_indication_report_t *error_indication_report) -{ - smf_sess_t *sess = NULL; - ogs_pfcp_f_teid_t *remote_f_teid = NULL; - - uint32_t teid; - uint16_t len; /* OGS_IPV4_LEN or OGS_IPV6_LEN */ - uint32_t addr4; - - ogs_assert(smf_ue); - ogs_assert(error_indication_report); - - if (error_indication_report->presence == 0) { - ogs_error("No Error Indication Report"); - return NULL; - } - - if (error_indication_report->remote_f_teid.presence == 0) { - ogs_error("No Remote F-TEID"); - return NULL; - } - - remote_f_teid = error_indication_report->remote_f_teid.data; - ogs_assert(remote_f_teid); - - teid = be32toh(remote_f_teid->teid); - if (remote_f_teid->ipv4 && remote_f_teid->ipv6) { - ogs_error("User plane should not set both IPv4 and IPv6"); - return NULL; - } else if (remote_f_teid->ipv4) { - len = OGS_IPV4_LEN; - memcpy(addr, &remote_f_teid->addr, len); - } else if (remote_f_teid->ipv6) { - len = OGS_IPV6_LEN; - memcpy(addr, remote_f_teid->addr6, len); - } else { - ogs_error("No IPv4 and IPv6"); - return NULL; - } - - ogs_list_reverse_for_each(&smf_ue->sess_list, sess) { - if (teid == sess->gnb_n3_teid) { - if (len == OGS_IPV4_LEN && sess->gnb_n3_ip.ipv4 && - memcmp(addr, &sess->gnb_n3_ip.addr, len) == 0) { - return sess; - } else if (len == OGS_IPV6_LEN && sess->gnb_n3_ip.ipv6 && - memcmp(addr, sess->gnb_n3_ip.addr6, len) == 0) { - return sess; - } - } - } - - ogs_error("Cannot find the session context " - "TEID:%d,LEN:%d,ADDR:%08x %08x %08x %08x", - teid, len, be32toh(addr0), be32toh(addr1), - be32toh(addr2), be32toh(addr3)); - - return NULL; -} - void smf_sess_remove(smf_sess_t *sess) { int i; @@ -1711,17 +1667,21 @@ ogs_fsm_fini(&sess->sm, &e); OGS_TLV_CLEAR_DATA(&sess->gtp.ue_pco); + OGS_TLV_CLEAR_DATA(&sess->gtp.ue_epco); OGS_TLV_CLEAR_DATA(&sess->gtp.user_location_information); OGS_TLV_CLEAR_DATA(&sess->gtp.ue_timezone); OGS_TLV_CLEAR_DATA(&sess->gtp.charging_characteristics); OGS_TLV_CLEAR_DATA(&sess->gtp.v1.qos); - OGS_NAS_CLEAR_DATA(&sess->nas.ue_pco); + OGS_NAS_CLEAR_DATA(&sess->nas.ue_epco);
View file
open5gs_2.6.2.tar.xz/src/smf/context.h -> open5gs_2.6.3.tar.xz/src/smf/context.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -88,6 +88,7 @@ ogs_hash_t *imsi_hash; /* hash table (IMSI) */ ogs_hash_t *ipv4_hash; /* hash table (IPv4 Address) */ ogs_hash_t *ipv6_hash; /* hash table (IPv6 Address) */ + ogs_hash_t *smf_n4_seid_hash; /* hash table (SMF-N4-SEID) */ ogs_hash_t *n1n2message_hash; /* hash table (N1N2Message Location) */ uint16_t mtu; /* MTU to advertise in PCO */ @@ -173,8 +174,6 @@ ogs_lnode_t to_modify_node; ogs_lnode_t to_delete_node; - uint32_t index; - ogs_pfcp_pdr_t *dl_pdr; ogs_pfcp_pdr_t *ul_pdr; ogs_pfcp_far_t *dl_far; @@ -215,7 +214,10 @@ #define SMF_SESS(pfcp_sess) ogs_container_of(pfcp_sess, smf_sess_t, pfcp) typedef struct smf_sess_s { ogs_sbi_object_t sbi; - uint32_t index; /**< An index of this node */ + + uint32_t index; /* An index of this node */ + ogs_pool_id_t *smf_n4_seid_node; /* A node of SMF-N4-SEID */ + ogs_fsm_t sm; /* A state machine */ struct { bool gx_ccr_init_in_flight; /* Waiting for Gx CCA */ @@ -236,12 +238,12 @@ uint64_t smpolicycontrol_features; /* SBI features */ - uint32_t smf_n4_teid; /* SMF-N4-TEID is derived from INDEX */ + uint32_t smf_n4_teid; /* SMF-N4-TEID is derived from NODE */ uint32_t sgw_s5c_teid; /* SGW-S5C-TEID is received from SGW */ ogs_ip_t sgw_s5c_ip; /* SGW-S5C IPv4/IPv6 */ - uint64_t smf_n4_seid; /* SMF SEID is dervied from INDEX */ + uint64_t smf_n4_seid; /* SMF SEID is dervied from NODE */ uint64_t upf_n4_seid; /* UPF SEID is received from Peer */ uint32_t upf_n3_teid; /* UPF-N3 TEID */ @@ -323,6 +325,7 @@ struct { uint8_t version; /* GTPC version */ ogs_tlv_octet_t ue_pco; + ogs_tlv_octet_t ue_epco; ogs_tlv_octet_t user_location_information; ogs_tlv_octet_t ue_timezone; ogs_tlv_octet_t charging_characteristics; @@ -352,7 +355,7 @@ } gy; struct { - ogs_nas_extended_protocol_configuration_options_t ue_pco; + ogs_nas_extended_protocol_configuration_options_t ue_epco; } nas; /* Saved from NAS-5GS */ struct { @@ -463,9 +466,6 @@ smf_sess_t *smf_sess_find_by_ipv6(uint32_t *addr6); smf_sess_t *smf_sess_find_by_paging_n1n2message_location( char *n1n2message_location); -smf_sess_t *smf_sess_find_by_error_indication_report( - smf_ue_t *smf_ue, - ogs_pfcp_tlv_error_indication_report_t *error_indication_report); void smf_sess_create_indirect_data_forwarding(smf_sess_t *sess); bool smf_sess_have_indirect_data_forwarding(smf_sess_t *sess);
View file
open5gs_2.6.2.tar.xz/src/smf/fd-path.c -> open5gs_2.6.3.tar.xz/src/smf/fd-path.c
Changed
@@ -62,6 +62,7 @@ } smf_gx_final(); + smf_gy_final(); smf_s6b_final(); ogs_diam_final();
View file
open5gs_2.6.2.tar.xz/src/smf/gsm-build.c -> open5gs_2.6.3.tar.xz/src/smf/gsm-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -48,8 +48,8 @@ ogs_nas_qos_flow_description_t qos_flow_descriptionOGS_NAS_MAX_NUM_OF_QOS_FLOW_DESCRIPTION; - uint8_t pco_bufOGS_MAX_PCO_LEN; - int16_t pco_len; + uint8_t *epco_buf = NULL; + int16_t epco_len; selected_pdu_session_type = &pdu_session_establishment_accept-> selected_pdu_session_type; @@ -134,11 +134,11 @@ rv = ogs_nas_build_qos_rules(authorized_qos_rules, qos_rule, 1); if (rv != OGS_OK) { ogs_error("ogs_nas_build_qos_rules() failed"); - return NULL; + goto cleanup; } if (!authorized_qos_rules->length) { ogs_error("No length"); - return NULL; + goto cleanup; } /* Session-AMBR */ @@ -167,7 +167,7 @@ pdu_address->length = OGS_NAS_PDU_ADDRESS_IPV4V6_LEN; } else { ogs_error("Unexpected PDN Type %u", pdu_address->pdn_type); - return NULL; + goto cleanup; } /* GSM cause */ @@ -211,22 +211,24 @@ authorized_qos_flow_descriptions, qos_flow_description, 1); if (rv != OGS_OK) { ogs_error("ogs_nas_build_qos_flow_descriptions() failed"); - return NULL; + goto cleanup; } if (!authorized_qos_flow_descriptions->length) { ogs_error("No length"); - return NULL; + goto cleanup; } /* Extended protocol configuration options */ - if (sess->nas.ue_pco.buffer && sess->nas.ue_pco.length) { - pco_len = smf_pco_build(pco_buf, - sess->nas.ue_pco.buffer, sess->nas.ue_pco.length); - ogs_assert(pco_len > 0); + if (sess->nas.ue_epco.buffer && sess->nas.ue_epco.length) { + epco_buf = ogs_calloc(OGS_MAX_EPCO_LEN, sizeof(uint8_t)); + ogs_assert(epco_buf); + epco_len = smf_pco_build(epco_buf, + sess->nas.ue_epco.buffer, sess->nas.ue_epco.length); + ogs_assert(epco_len > 0); pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; - extended_protocol_configuration_options->buffer = pco_buf; - extended_protocol_configuration_options->length = pco_len; + extended_protocol_configuration_options->buffer = epco_buf; + extended_protocol_configuration_options->length = epco_len; } /* DNN */ @@ -240,8 +242,14 @@ pkbuf = ogs_nas_5gs_plain_encode(&message); ogs_assert(pkbuf); - ogs_free(authorized_qos_rules->buffer); - ogs_free(authorized_qos_flow_descriptions->buffer); +cleanup: + if (epco_buf) + ogs_free(epco_buf); + + if (authorized_qos_rules->buffer) + ogs_free(authorized_qos_rules->buffer); + if (authorized_qos_flow_descriptions->buffer) + ogs_free(authorized_qos_flow_descriptions->buffer); return pkbuf; }
View file
open5gs_2.6.2.tar.xz/src/smf/gsm-handler.c -> open5gs_2.6.3.tar.xz/src/smf/gsm-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -62,7 +62,7 @@ if (pdu_session_establishment_request->presencemask & OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT) { - OGS_NAS_STORE_DATA(&sess->nas.ue_pco, + OGS_NAS_STORE_DATA(&sess->nas.ue_epco, &pdu_session_establishment_request-> extended_protocol_configuration_options); }
View file
open5gs_2.6.2.tar.xz/src/smf/gsm-sm.c -> open5gs_2.6.3.tar.xz/src/smf/gsm-sm.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -452,7 +452,7 @@ OGS_FSM_TRAN(s, &smf_gsm_state_wait_pfcp_establishment); ogs_assert(OGS_OK == smf_epc_pfcp_send_session_establishment_request( - sess, e->gtp_xact)); + sess, e->gtp_xact, 0)); } else { /* FIXME: tear down Gx/Gy session * if its sm_data.*init_err == ER_DIAMETER_SUCCESS */ @@ -671,21 +671,28 @@ send_gtp_create_err_msg(sess, e->gtp_xact, gtp_cause); return; } - switch (gtp_xact->gtp_version) { - case 1: - rv = smf_gtp1_send_create_pdp_context_response(sess, gtp_xact); - break; - case 2: - rv = smf_gtp2_send_create_session_response(sess, gtp_xact); - break; - default: - rv = OGS_ERROR; - break; - } - /* If no CreatePDPCtxResp can be sent, then tear down the session: */ - if (rv != OGS_OK) { - OGS_FSM_TRAN(s, &smf_gsm_state_wait_pfcp_deletion); - return; + + gtp_xact = pfcp_xact->assoc_xact; + if (gtp_xact) { + switch (gtp_xact->gtp_version) { + case 1: + rv = smf_gtp1_send_create_pdp_context_response( + sess, gtp_xact); + break; + case 2: + rv = smf_gtp2_send_create_session_response( + sess, gtp_xact); + break; + default: + rv = OGS_ERROR; + break; + } + /* If no CreatePDPCtxResp can be sent, + * then tear down the session: */ + if (rv != OGS_OK) { + OGS_FSM_TRAN(s, &smf_gsm_state_wait_pfcp_deletion); + return; + } } if (sess->gtp_rat_type == OGS_GTP2_RAT_TYPE_WLAN) { @@ -739,6 +746,9 @@ smf_sess_t *sess = NULL; ogs_pkbuf_t *pkbuf = NULL; + ogs_pfcp_xact_t *pfcp_xact = NULL; + ogs_pfcp_message_t *pfcp_message = NULL; + ogs_nas_5gs_message_t *nas_message = NULL; ogs_sbi_stream_t *stream = NULL; @@ -815,6 +825,43 @@ } break; + case SMF_EVT_N4_MESSAGE: + pfcp_xact = e->pfcp_xact; + ogs_assert(pfcp_xact); + pfcp_message = e->pfcp_message; + ogs_assert(pfcp_message); + + switch (pfcp_message->h.type) { + case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE: + if ((pfcp_xact->create_flags & + OGS_PFCP_CREATE_RESTORATION_INDICATION)) { + ogs_pfcp_session_establishment_response_t *rsp = NULL; + ogs_pfcp_f_seid_t *up_f_seid = NULL; + + rsp = &pfcp_message->pfcp_session_establishment_response; + if (rsp->up_f_seid.presence == 0) { + ogs_error("No UP F-SEID"); + break; + } + up_f_seid = rsp->up_f_seid.data; + ogs_assert(up_f_seid); + sess->upf_n4_seid = be64toh(up_f_seid->seid); + } else { + ogs_error("cannot handle PFCP Session Establishment Response"); + } + break; + + case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE: + ogs_error("Session Released by Error Indication"); + OGS_FSM_TRAN(s, smf_gsm_state_session_will_release); + break; + + default: + ogs_error("cannot handle PFCP message type%d", + pfcp_message->h.type); + } + break; + case OGS_EVENT_SBI_SERVER: sbi_message = e->h.sbi.message; ogs_assert(sbi_message);
View file
open5gs_2.6.2.tar.xz/src/smf/gx-handler.c -> open5gs_2.6.3.tar.xz/src/smf/gx-handler.c
Changed
@@ -202,10 +202,10 @@ &bearer->pgw_s5u_addr, &bearer->pgw_s5u_addr6); if (resource->info.teidri) bearer->pgw_s5u_teid = OGS_PFCP_GTPU_INDEX_TO_TEID( - ul_pdr->index, resource->info.teidri, + ul_pdr->teid, resource->info.teidri, resource->info.teid_range); else - bearer->pgw_s5u_teid = ul_pdr->index; + bearer->pgw_s5u_teid = ul_pdr->teid; } else { if (sess->pfcp_node->addr.ogs_sa_family == AF_INET) ogs_assert(OGS_OK == @@ -218,7 +218,7 @@ else ogs_assert_if_reached(); - bearer->pgw_s5u_teid = ul_pdr->index; + bearer->pgw_s5u_teid = ul_pdr->teid; } ogs_assert(OGS_OK == @@ -231,7 +231,7 @@ ogs_pfcp_sockaddr_to_f_teid( bearer->pgw_s5u_addr, bearer->pgw_s5u_addr6, &cp2up_pdr->f_teid, &cp2up_pdr->f_teid_len)); - cp2up_pdr->f_teid.teid = cp2up_pdr->index; + cp2up_pdr->f_teid.teid = cp2up_pdr->teid; ogs_assert(OGS_OK == ogs_pfcp_sockaddr_to_f_teid(
View file
open5gs_2.6.2.tar.xz/src/smf/n4-build.c -> open5gs_2.6.3.tar.xz/src/smf/n4-build.c
Changed
@@ -21,7 +21,7 @@ #include "n4-build.h" ogs_pkbuf_t *smf_n4_build_session_establishment_request( - uint8_t type, smf_sess_t *sess) + uint8_t type, smf_sess_t *sess, ogs_pfcp_xact_t *xact) { ogs_pfcp_message_t *pfcp_message = NULL; ogs_pfcp_session_establishment_request_t *req = NULL; @@ -46,6 +46,7 @@ ogs_assert(sess); smf_ue = sess->smf_ue; ogs_assert(smf_ue); + ogs_assert(xact); pfcp_message = ogs_calloc(1, sizeof(*pfcp_message)); if (!pfcp_message) { @@ -159,6 +160,16 @@ req->s_nssai.data = &sess->s_nssai; } + /* Restoration Indication */ + if (xact->create_flags & OGS_PFCP_CREATE_RESTORATION_INDICATION) { + ogs_pfcp_sereq_flags_t sereq_flags; + sereq_flags.value = 0; + + sereq_flags.restoration_indication = 1; + req->pfcpsereq_flags.presence = 1; + req->pfcpsereq_flags.u8 = sereq_flags.value; + } + pfcp_message->h.type = type; pkbuf = ogs_pfcp_build_msg(pfcp_message); ogs_expect(pkbuf);
View file
open5gs_2.6.2.tar.xz/src/smf/n4-build.h -> open5gs_2.6.3.tar.xz/src/smf/n4-build.h
Changed
@@ -27,7 +27,7 @@ #endif ogs_pkbuf_t *smf_n4_build_session_establishment_request( - uint8_t type, smf_sess_t *sess); + uint8_t type, smf_sess_t *sess, ogs_pfcp_xact_t *xact); ogs_pkbuf_t *smf_n4_build_pdr_to_modify_list( uint8_t type, smf_sess_t *sess, ogs_pfcp_xact_t *xact); ogs_pkbuf_t *smf_n4_build_qos_flow_to_modify_list(
View file
open5gs_2.6.2.tar.xz/src/smf/n4-handler.c -> open5gs_2.6.3.tar.xz/src/smf/n4-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -148,8 +148,6 @@ { int i; - ogs_sbi_stream_t *stream = NULL; - uint8_t cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED; uint8_t offending_ie_value = 0; @@ -164,9 +162,6 @@ ogs_debug("Session Establishment Response 5gc"); - stream = xact->assoc_stream; - ogs_assert(stream); - ogs_pfcp_xact_commit(xact); if (rsp->up_f_seid.presence == 0) { @@ -732,7 +727,6 @@ uint8_t cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED; smf_bearer_t *bearer = NULL; - ogs_gtp_xact_t *gtp_xact = NULL; ogs_pfcp_f_seid_t *up_f_seid = NULL; @@ -742,9 +736,6 @@ ogs_debug("Session Establishment Response epc"); - gtp_xact = xact->assoc_xact; - ogs_assert(gtp_xact); - ogs_pfcp_xact_commit(xact); if (rsp->up_f_seid.presence == 0) { @@ -1157,9 +1148,11 @@ smf_sess_t *sess, ogs_pfcp_xact_t *pfcp_xact, ogs_pfcp_session_report_request_t *pfcp_req) { + smf_ue_t *smf_ue = NULL; smf_bearer_t *qos_flow = NULL; smf_bearer_t *bearer = NULL; ogs_pfcp_pdr_t *pdr = NULL; + ogs_pfcp_far_t *far = NULL; ogs_pfcp_report_type_t report_type; uint8_t cause_value = 0; @@ -1193,6 +1186,9 @@ } ogs_assert(sess); + smf_ue = sess->smf_ue; + ogs_assert(smf_ue); + report_type.value = pfcp_req->report_type.u8; if (report_type.downlink_data_report) { @@ -1279,21 +1275,10 @@ } if (report_type.error_indication_report) { - smf_ue_t *smf_ue = sess->smf_ue; - smf_sess_t *error_indication_session = NULL; - ogs_assert(smf_ue); - - error_indication_session = smf_sess_find_by_error_indication_report( - smf_ue, &pfcp_req->error_indication_report); - - if (error_indication_session) { - ogs_assert(OGS_OK == - smf_5gc_pfcp_send_all_pdr_modification_request( - error_indication_session, NULL, - OGS_PFCP_MODIFY_DL_ONLY|OGS_PFCP_MODIFY_DEACTIVATE| - OGS_PFCP_MODIFY_ERROR_INDICATION, - 0)); - } + far = ogs_pfcp_far_find_by_pfcp_session_report( + &sess->pfcp, &pfcp_req->error_indication_report); + if (!far) + ogs_error("Cannot find Session in Error Indication"); } if (report_type.usage_report) { @@ -1350,4 +1335,24 @@ smf_pfcp_send_session_report_response( pfcp_xact, sess, OGS_PFCP_CAUSE_SYSTEM_FAILURE)); } + + /* Error Indication is handled last */ + if (report_type.error_indication_report && far) { + if (sess->epc == true) { + ogs_error("%s:%s Error Indication from SGW-C", + smf_ue->imsi_bcd, sess->session.name); + ogs_assert(OGS_OK == + smf_epc_pfcp_send_session_deletion_request( + sess, NULL)); + } else { + ogs_warn("%s:%s Error Indication from gNB", + smf_ue->supi, sess->session.name); + ogs_assert(OGS_OK == + smf_5gc_pfcp_send_all_pdr_modification_request( + sess, NULL, + OGS_PFCP_MODIFY_DL_ONLY|OGS_PFCP_MODIFY_DEACTIVATE| + OGS_PFCP_MODIFY_ERROR_INDICATION, + 0)); + } + } }
View file
open5gs_2.6.2.tar.xz/src/smf/npcf-handler.c -> open5gs_2.6.3.tar.xz/src/smf/npcf-handler.c
Changed
@@ -585,10 +585,10 @@ &sess->upf_n3_addr, &sess->upf_n3_addr6); if (resource->info.teidri) sess->upf_n3_teid = OGS_PFCP_GTPU_INDEX_TO_TEID( - ul_pdr->index, resource->info.teidri, + ul_pdr->teid, resource->info.teidri, resource->info.teid_range); else - sess->upf_n3_teid = ul_pdr->index; + sess->upf_n3_teid = ul_pdr->teid; } else { if (sess->pfcp_node->addr.ogs_sa_family == AF_INET) ogs_assert(OGS_OK == @@ -601,7 +601,7 @@ else ogs_assert_if_reached(); - sess->upf_n3_teid = ul_pdr->index; + sess->upf_n3_teid = ul_pdr->teid; } ogs_assert(OGS_OK == @@ -614,7 +614,7 @@ ogs_pfcp_sockaddr_to_f_teid( sess->upf_n3_addr, sess->upf_n3_addr6, &cp2up_pdr->f_teid, &cp2up_pdr->f_teid_len)); - cp2up_pdr->f_teid.teid = cp2up_pdr->index; + cp2up_pdr->f_teid.teid = cp2up_pdr->teid; ogs_assert(OGS_OK == ogs_pfcp_sockaddr_to_f_teid( @@ -630,7 +630,7 @@ up2cp_pdr->precedence = OGS_PFCP_UP2CP_PDR_PRECEDENCE; ogs_assert(OGS_OK == - smf_5gc_pfcp_send_session_establishment_request(sess, stream)); + smf_5gc_pfcp_send_session_establishment_request(sess, 0)); return true;
View file
open5gs_2.6.2.tar.xz/src/smf/pfcp-path.c -> open5gs_2.6.3.tar.xz/src/smf/pfcp-path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -362,7 +362,7 @@ } int smf_5gc_pfcp_send_session_establishment_request( - smf_sess_t *sess, ogs_sbi_stream_t *stream) + smf_sess_t *sess, uint64_t flags) { int rv; ogs_pkbuf_t *n4buf = NULL; @@ -370,7 +370,6 @@ ogs_pfcp_xact_t *xact = NULL; ogs_assert(sess); - ogs_assert(stream); xact = ogs_pfcp_xact_local_create(sess->pfcp_node, sess_5gc_timeout, sess); if (!xact) { @@ -378,14 +377,44 @@ return OGS_ERROR; } - xact->assoc_stream = stream; xact->local_seid = sess->smf_n4_seid; + xact->create_flags = flags; memset(&h, 0, sizeof(ogs_pfcp_header_t)); h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE; + +/* + * 7.2.2.4.2 Conditions for Sending SEID=0 in PFCP Header + * + * If a peer's SEID is not available, the SEID field shall still be present + * in the header and its value shall be set to "0" in the following messages: + * + * - PFCP Session Establishment Request message on Sxa/Sxb/Sxc/N4; + * + * - If a node receives a message for which it has no session, i.e. + * if SEID in the PFCP header is not known, it shall respond + * with "Session context not found" cause in the corresponding + * response message to the sender, the SEID used in the PFCP header + * in the response message shall be then set to "0"; + * + * - If a node receives a request message containing protocol error, + * e.g. Mandatory IE missing, which requires the receiver + * to reject the message as specified in clause 7.6, it shall reject + * the request message. For the response message, the node should look up + * the remote peer's SEID and accordingly set SEID in the PFCP header + * and the message cause code. As an implementation option, + * the node may not look up the remote peer's SEID and + * set the PFCP header SEID to "0" in the response message. + * However in this case, the cause value shall not be set + * to "Session not found". + * + * - When the UP function sends PFCP Session Report Request message + * 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 = sess->upf_n4_seid; - n4buf = smf_n4_build_session_establishment_request(h.type, sess); + n4buf = smf_n4_build_session_establishment_request(h.type, sess, xact); if (!n4buf) { ogs_error("smf_n4_build_session_establishment_request() failed"); return OGS_ERROR; @@ -506,7 +535,7 @@ } int smf_epc_pfcp_send_session_establishment_request( - smf_sess_t *sess, void *gtp_xact) + smf_sess_t *sess, void *gtp_xact, uint64_t flags) { int rv; ogs_pkbuf_t *n4buf = NULL; @@ -524,12 +553,43 @@ xact->epc = true; /* EPC PFCP transaction */ xact->assoc_xact = gtp_xact; xact->local_seid = sess->smf_n4_seid; + xact->create_flags = flags; memset(&h, 0, sizeof(ogs_pfcp_header_t)); h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE; + +/* + * 7.2.2.4.2 Conditions for Sending SEID=0 in PFCP Header + * + * If a peer's SEID is not available, the SEID field shall still be present + * in the header and its value shall be set to "0" in the following messages: + * + * - PFCP Session Establishment Request message on Sxa/Sxb/Sxc/N4; + * + * - If a node receives a message for which it has no session, i.e. + * if SEID in the PFCP header is not known, it shall respond + * with "Session context not found" cause in the corresponding + * response message to the sender, the SEID used in the PFCP header + * in the response message shall be then set to "0"; + * + * - If a node receives a request message containing protocol error, + * e.g. Mandatory IE missing, which requires the receiver + * to reject the message as specified in clause 7.6, it shall reject + * the request message. For the response message, the node should look up + * the remote peer's SEID and accordingly set SEID in the PFCP header + * and the message cause code. As an implementation option, + * the node may not look up the remote peer's SEID and + * set the PFCP header SEID to "0" in the response message. + * However in this case, the cause value shall not be set + * to "Session not found". + * + * - When the UP function sends PFCP Session Report Request message + * 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 = sess->upf_n4_seid; - n4buf = smf_n4_build_session_establishment_request(h.type, sess); + n4buf = smf_n4_build_session_establishment_request(h.type, sess, xact); if (!n4buf) { ogs_error("smf_n4_build_session_establishment_request() failed"); return OGS_ERROR;
View file
open5gs_2.6.2.tar.xz/src/smf/pfcp-path.h -> open5gs_2.6.3.tar.xz/src/smf/pfcp-path.h
Changed
@@ -36,7 +36,7 @@ ogs_pfcp_xact_t *xact, ogs_time_t duration); int smf_5gc_pfcp_send_session_establishment_request( - smf_sess_t *sess, ogs_sbi_stream_t *stream); + smf_sess_t *sess, uint64_t flags); int smf_5gc_pfcp_send_all_pdr_modification_request( smf_sess_t *sess, ogs_sbi_stream_t *stream, uint64_t flags, ogs_time_t duration); @@ -47,7 +47,7 @@ smf_sess_t *sess, ogs_sbi_stream_t *stream, int trigger); int smf_epc_pfcp_send_session_establishment_request( - smf_sess_t *sess, void *gtp_xact); + smf_sess_t *sess, void *gtp_xact, uint64_t flags); int smf_epc_pfcp_send_all_pdr_modification_request( smf_sess_t *sess, void *gtp_xact, ogs_pkbuf_t *gtpbuf, uint64_t flags, uint8_t gtp_pti, uint8_t gtp_cause);
View file
open5gs_2.6.2.tar.xz/src/smf/pfcp-sm.c -> open5gs_2.6.3.tar.xz/src/smf/pfcp-sm.c
Changed
@@ -22,6 +22,7 @@ #include "n4-handler.h" +static void pfcp_restoration(ogs_pfcp_node_t *node); static void reselect_upf(ogs_pfcp_node_t *node); static void node_timeout(ogs_pfcp_xact_t *xact, void *data); @@ -191,7 +192,7 @@ ogs_pfcp_send_heartbeat_request(node, node_timeout)); if (node->restoration_required == true) { - /* PFCP Restoration is being performed after PFCP association */ + pfcp_restoration(node); node->restoration_required = false; ogs_error("PFCP restoration"); } @@ -244,6 +245,7 @@ * If the peer PFCP entity is performing the association, * Restoration can be performed immediately. */ + pfcp_restoration(node); node->restoration_required = false; ogs_error("PFCP restoration"); } @@ -270,6 +272,7 @@ * If the peer PFCP entity is performing the association, * Restoration can be performed immediately. */ + pfcp_restoration(node); node->restoration_required = false; ogs_error("PFCP restoration"); } @@ -409,10 +412,52 @@ } } +static void pfcp_restoration(ogs_pfcp_node_t *node) +{ + smf_ue_t *smf_ue = NULL; + + char buf1OGS_ADDRSTRLEN; + char buf2OGS_ADDRSTRLEN; + + ogs_list_for_each(&smf_self()->smf_ue_list, smf_ue) { + smf_sess_t *sess = NULL; + ogs_assert(smf_ue); + + ogs_list_for_each(&smf_ue->sess_list, sess) { + ogs_assert(sess); + + if (node == sess->pfcp_node) { + if (sess->epc) { + ogs_info("UE IMSI%s APN%s IPv4%s IPv6%s", + smf_ue->imsi_bcd, sess->session.name, + sess->ipv4 ? + OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", + sess->ipv6 ? + OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); + ogs_assert(OGS_OK == + smf_epc_pfcp_send_session_establishment_request( + sess, NULL, + OGS_PFCP_CREATE_RESTORATION_INDICATION)); + } else { + ogs_info("UE SUPI%s DNN%s IPv4%s IPv6%s", + smf_ue->supi, sess->session.name, + sess->ipv4 ? + OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "", + sess->ipv6 ? + OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : ""); + ogs_assert(OGS_OK == + smf_5gc_pfcp_send_session_establishment_request( + sess, OGS_PFCP_CREATE_RESTORATION_INDICATION)); + } + } + } + } +} + static void reselect_upf(ogs_pfcp_node_t *node) { int r; - smf_ue_t *smf_ue = NULL, *next_ue = NULL;; + smf_ue_t *smf_ue = NULL; ogs_pfcp_node_t *iter = NULL; ogs_assert(node); @@ -434,19 +479,18 @@ return; } - ogs_list_for_each_safe(&smf_self()->smf_ue_list, next_ue, smf_ue) { - smf_sess_t *sess = NULL, *next_sess = NULL;; + ogs_list_for_each(&smf_self()->smf_ue_list, smf_ue) { + smf_sess_t *sess = NULL; ogs_assert(smf_ue); - ogs_list_for_each_safe(&smf_ue->sess_list, next_sess, sess) { + ogs_list_for_each(&smf_ue->sess_list, sess) { ogs_assert(sess); - if (sess->epc) { - ogs_error("%s:%s EPC restoration is not implemented", - smf_ue->imsi_bcd, sess->session.name); - } else { - ogs_assert(sess->sm_context_ref); - if (node == sess->pfcp_node) { + if (node == sess->pfcp_node) { + if (sess->epc) { + ogs_error("%s:%s EPC restoration is not implemented", + smf_ue->imsi_bcd, sess->session.name); + } else { smf_npcf_smpolicycontrol_param_t param; ogs_info("%s:%d SMF-initiated Deletion", @@ -479,18 +523,6 @@ switch (type) { case OGS_PFCP_HEARTBEAT_REQUEST_TYPE: ogs_assert(data); - - - /* - * The code below is not secure. - * Session does not differentiate between EPC and 5GC. - * And, it does not check whether there are other PFCP Nodes. - * - * So, UPF redundancy will be implemented later. - * - * We plan to do this again after testing with restoration first - * in case peer PFCP restarts. - */ reselect_upf(data); e = smf_event_new(SMF_EVT_N4_NO_HEARTBEAT);
View file
open5gs_2.6.2.tar.xz/src/smf/s5c-build.c -> open5gs_2.6.3.tar.xz/src/smf/s5c-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -28,6 +28,8 @@ int rv; smf_bearer_t *bearer = NULL; + ogs_pkbuf_t *pkbuf = NULL; + ogs_gtp2_message_t gtp_message; ogs_gtp2_create_session_response_t *rsp = NULL; @@ -45,6 +47,8 @@ int len; uint8_t pco_bufOGS_MAX_PCO_LEN; int16_t pco_len; + uint8_t *epco_buf = NULL; + int16_t epco_len; ogs_debug("SMF Create Session Response"); @@ -85,7 +89,7 @@ &smf_s5c_teid, &len); if (rv != OGS_OK) { ogs_error("ogs_gtp2_sockaddr_to_f_teid() failed"); - return NULL; + goto cleanup; } rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface. presence = 1; @@ -141,6 +145,19 @@ rsp->protocol_configuration_options.len = pco_len; } + /* ePCO */ + if (sess->gtp.ue_epco.presence && + sess->gtp.ue_epco.len && sess->gtp.ue_epco.data) { + epco_buf = ogs_calloc(OGS_MAX_EPCO_LEN, sizeof(uint8_t)); + ogs_assert(epco_buf); + epco_len = smf_pco_build( + epco_buf, sess->gtp.ue_epco.data, sess->gtp.ue_epco.len); + ogs_assert(epco_len > 0); + rsp->extended_protocol_configuration_options.presence = 1; + rsp->extended_protocol_configuration_options.data = epco_buf; + rsp->extended_protocol_configuration_options.len = epco_len; + } + i = 0; ogs_list_for_each(&sess->bearer_list, bearer) { ogs_assert(i < OGS_BEARER_PER_UE); @@ -190,7 +207,7 @@ &pgw_s5u_teidi, &pgw_s5u_leni); if (rv != OGS_OK) { ogs_error("ogs_gtp2_sockaddr_to_f_teid() failed"); - return NULL; + goto cleanup; } switch (sess->gtp_rat_type) { @@ -219,18 +236,28 @@ } gtp_message.h.type = type; - return ogs_gtp2_build_msg(>p_message); + pkbuf = ogs_gtp2_build_msg(>p_message); + +cleanup: + if (epco_buf) + ogs_free(epco_buf); + + return pkbuf; } ogs_pkbuf_t *smf_s5c_build_delete_session_response( uint8_t type, smf_sess_t *sess) { + ogs_pkbuf_t *pkbuf = NULL; + ogs_gtp2_message_t gtp_message; ogs_gtp2_delete_session_response_t *rsp = NULL; ogs_gtp2_cause_t cause; uint8_t pco_bufOGS_MAX_PCO_LEN; int16_t pco_len; + uint8_t *epco_buf = NULL; + int16_t epco_len; /* prepare cause */ memset(&cause, 0, sizeof(cause)); @@ -257,11 +284,30 @@ rsp->protocol_configuration_options.len = pco_len; } + /* ePCO */ + if (sess->gtp.ue_epco.presence && + sess->gtp.ue_epco.len && sess->gtp.ue_epco.data) { + epco_buf = ogs_calloc(OGS_MAX_EPCO_LEN, sizeof(uint8_t)); + ogs_assert(epco_buf); + epco_len = smf_pco_build( + epco_buf, sess->gtp.ue_epco.data, sess->gtp.ue_epco.len); + ogs_assert(epco_len > 0); + rsp->extended_protocol_configuration_options.presence = 1; + rsp->extended_protocol_configuration_options.data = epco_buf; + rsp->extended_protocol_configuration_options.len = epco_len; + } + /* Private Extension */ /* build */ gtp_message.h.type = type; - return ogs_gtp2_build_msg(>p_message); + pkbuf = ogs_gtp2_build_msg(>p_message); + +cleanup: + if (epco_buf) + ogs_free(epco_buf); + + return pkbuf; } ogs_pkbuf_t *smf_s5c_build_modify_bearer_response(
View file
open5gs_2.6.2.tar.xz/src/smf/s5c-handler.c -> open5gs_2.6.3.tar.xz/src/smf/s5c-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -347,8 +347,13 @@ sess->session.ambr.uplink = be32toh(ambr->uplink) * 1000; } + /* ePCO */ + if (req->extended_protocol_configuration_options.presence) { + OGS_TLV_STORE_DATA(&sess->gtp.ue_epco, + &req->extended_protocol_configuration_options); + /* PCO */ - if (req->protocol_configuration_options.presence) { + } else if (req->protocol_configuration_options.presence) { OGS_TLV_STORE_DATA(&sess->gtp.ue_pco, &req->protocol_configuration_options); } @@ -420,13 +425,24 @@ OGS_TLV_STORE_DATA(&sess->gtp.ue_pco, &req->protocol_configuration_options); } else { - /* + /* * Clear contents to reflect whether PCO IE was included or not as part * of session deletion procedure */ OGS_TLV_CLEAR_DATA(&sess->gtp.ue_pco); } + if (req->extended_protocol_configuration_options.presence) { + OGS_TLV_STORE_DATA(&sess->gtp.ue_epco, + &req->extended_protocol_configuration_options); + } else { + /* + * Clear contents to reflect whether PCO IE was included or not as part + * of session deletion procedure + */ + OGS_TLV_CLEAR_DATA(&sess->gtp.ue_epco); + } + ogs_debug(" SGW_S5C_TEID0x%x SMF_N4_TEID0x%x", sess->sgw_s5c_teid, sess->smf_n4_teid);
View file
open5gs_2.6.2.tar.xz/src/smf/smf-sm.c -> open5gs_2.6.3.tar.xz/src/smf/smf-sm.c
Changed
@@ -928,7 +928,12 @@ } ogs_assert(sess); - ogs_assert(OGS_FSM_STATE(&sess->sm)); + sess = smf_sess_cycle(sess); + if (!sess) { + ogs_error("Session has already been removed"); + ogs_pkbuf_free(pkbuf); + break; + } e->nas.message = &nas_message; ogs_fsm_dispatch(&sess->sm, e); @@ -946,7 +951,12 @@ ogs_assert(e->ngap.type); ogs_assert(sess); - ogs_assert(OGS_FSM_STATE(&sess->sm)); + sess = smf_sess_cycle(sess); + if (!sess) { + ogs_error("Session has already been removed"); + ogs_pkbuf_free(pkbuf); + break; + } ogs_fsm_dispatch(&sess->sm, e);
View file
open5gs_2.6.2.tar.xz/src/upf/context.c -> open5gs_2.6.3.tar.xz/src/upf/context.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -25,6 +25,7 @@ int __upf_log_domain; static OGS_POOL(upf_sess_pool, upf_sess_t); +static OGS_POOL(upf_n4_seid_pool, ogs_pool_id_t); static int context_initialized = 0; @@ -49,11 +50,15 @@ ogs_list_init(&self.sess_list); ogs_pool_init(&upf_sess_pool, ogs_app()->pool.sess); + ogs_pool_init(&upf_n4_seid_pool, ogs_app()->pool.sess); + ogs_pool_random_id_generate(&upf_n4_seid_pool); - self.seid_hash = ogs_hash_make(); - ogs_assert(self.seid_hash); - self.f_seid_hash = ogs_hash_make(); - ogs_assert(self.f_seid_hash); + self.upf_n4_seid_hash = ogs_hash_make(); + ogs_assert(self.upf_n4_seid_hash); + self.smf_n4_seid_hash = ogs_hash_make(); + ogs_assert(self.smf_n4_seid_hash); + self.smf_n4_f_seid_hash = ogs_hash_make(); + ogs_assert(self.smf_n4_f_seid_hash); self.ipv4_hash = ogs_hash_make(); ogs_assert(self.ipv4_hash); self.ipv6_hash = ogs_hash_make(); @@ -77,10 +82,12 @@ upf_sess_remove_all(); - ogs_assert(self.seid_hash); - ogs_hash_destroy(self.seid_hash); - ogs_assert(self.f_seid_hash); - ogs_hash_destroy(self.f_seid_hash); + ogs_assert(self.upf_n4_seid_hash); + ogs_hash_destroy(self.upf_n4_seid_hash); + ogs_assert(self.smf_n4_seid_hash); + ogs_hash_destroy(self.smf_n4_seid_hash); + ogs_assert(self.smf_n4_f_seid_hash); + ogs_hash_destroy(self.smf_n4_f_seid_hash); ogs_assert(self.ipv4_hash); ogs_hash_destroy(self.ipv4_hash); ogs_assert(self.ipv6_hash); @@ -90,6 +97,7 @@ free_upf_route_trie_node(self.ipv6_framed_routes); ogs_pool_final(&upf_sess_pool); + ogs_pool_final(&upf_n4_seid_pool); context_initialized = 0; } @@ -171,10 +179,14 @@ ogs_pfcp_pool_init(&sess->pfcp); - sess->index = ogs_pool_index(&upf_sess_pool, sess); - ogs_assert(sess->index > 0 && sess->index <= ogs_app()->pool.sess); + /* Set UPF-N4-SEID */ + ogs_pool_alloc(&upf_n4_seid_pool, &sess->upf_n4_seid_node); + ogs_assert(sess->upf_n4_seid_node); - sess->upf_n4_seid = sess->index; + sess->upf_n4_seid = *(sess->upf_n4_seid_node); + + ogs_hash_set(self.upf_n4_seid_hash, &sess->upf_n4_seid, + sizeof(sess->upf_n4_seid), sess); /* Since F-SEID is composed of ogs_ip_t and uint64-seid, * all these values must be put into the structure-smf_n4_f_seid @@ -183,9 +195,9 @@ ogs_assert(OGS_OK == ogs_pfcp_f_seid_to_ip(cp_f_seid, &sess->smf_n4_f_seid.ip)); - ogs_hash_set(self.f_seid_hash, &sess->smf_n4_f_seid, + ogs_hash_set(self.smf_n4_f_seid_hash, &sess->smf_n4_f_seid, sizeof(sess->smf_n4_f_seid), sess); - ogs_hash_set(self.seid_hash, &sess->smf_n4_f_seid.seid, + ogs_hash_set(self.smf_n4_seid_hash, &sess->smf_n4_f_seid.seid, sizeof(sess->smf_n4_f_seid.seid), sess); ogs_list_add(&self.sess_list, sess); @@ -206,9 +218,12 @@ ogs_list_remove(&self.sess_list, sess); ogs_pfcp_sess_clear(&sess->pfcp); - ogs_hash_set(self.seid_hash, &sess->smf_n4_f_seid.seid, + ogs_hash_set(self.upf_n4_seid_hash, &sess->upf_n4_seid, + sizeof(sess->upf_n4_seid), NULL); + + ogs_hash_set(self.smf_n4_seid_hash, &sess->smf_n4_f_seid.seid, sizeof(sess->smf_n4_f_seid.seid), NULL); - ogs_hash_set(self.f_seid_hash, &sess->smf_n4_f_seid, + ogs_hash_set(self.smf_n4_f_seid_hash, &sess->smf_n4_f_seid, sizeof(sess->smf_n4_f_seid), NULL); if (sess->ipv4) { @@ -226,7 +241,10 @@ ogs_pfcp_pool_final(&sess->pfcp); + ogs_pool_free(&upf_n4_seid_pool, sess->upf_n4_seid_node); ogs_pool_free(&upf_sess_pool, sess); + if (sess->apn_dnn) + ogs_free(sess->apn_dnn); upf_metrics_inst_global_dec(UPF_METR_GLOB_GAUGE_UPF_SESSIONNBR); ogs_info("Removed Number of UPF-sessions is now %d", @@ -244,14 +262,9 @@ } } -upf_sess_t *upf_sess_find(uint32_t index) -{ - return ogs_pool_find(&upf_sess_pool, index); -} - upf_sess_t *upf_sess_find_by_smf_n4_seid(uint64_t seid) { - return (upf_sess_t *)ogs_hash_get(self.seid_hash, &seid, sizeof(seid)); + return ogs_hash_get(self.smf_n4_seid_hash, &seid, sizeof(seid)); } upf_sess_t *upf_sess_find_by_smf_n4_f_seid(ogs_pfcp_f_seid_t *f_seid) @@ -265,12 +278,12 @@ ogs_assert(OGS_OK == ogs_pfcp_f_seid_to_ip(f_seid, &key.ip)); key.seid = f_seid->seid; - return (upf_sess_t *)ogs_hash_get(self.f_seid_hash, &key, sizeof(key)); + return ogs_hash_get(self.smf_n4_f_seid_hash, &key, sizeof(key)); } upf_sess_t *upf_sess_find_by_upf_n4_seid(uint64_t seid) { - return upf_sess_find(seid); + return ogs_hash_get(self.upf_n4_seid_hash, &seid, sizeof(seid)); } upf_sess_t *upf_sess_find_by_ipv4(uint32_t addr) @@ -355,7 +368,10 @@ sess = upf_sess_find_by_smf_n4_f_seid(f_seid); if (!sess) { sess = upf_sess_add(f_seid); - if (!sess) return NULL; + if (!sess) { + ogs_error("No Session Context"); + return NULL; + } } ogs_assert(sess);
View file
open5gs_2.6.2.tar.xz/src/upf/context.h -> open5gs_2.6.3.tar.xz/src/upf/context.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -48,14 +48,18 @@ struct upf_route_trie_node; typedef struct upf_context_s { - ogs_hash_t *seid_hash; /* hash table (SEID) */ - ogs_hash_t *f_seid_hash; /* hash table (F-SEID) */ - ogs_hash_t *ipv4_hash; /* hash table (IPv4 Address) */ - ogs_hash_t *ipv6_hash; /* hash table (IPv6 Address) */ - struct upf_route_trie_node *ipv4_framed_routes; /* IPv4 framed routes trie */ - struct upf_route_trie_node *ipv6_framed_routes; /* IPv6 framed routes trie */ + ogs_hash_t *upf_n4_seid_hash; /* hash table (UPF-N4-SEID) */ + ogs_hash_t *smf_n4_seid_hash; /* hash table (SMF-N4-SEID) */ + ogs_hash_t *smf_n4_f_seid_hash; /* hash table (SMF-N4-F-SEID) */ + ogs_hash_t *ipv4_hash; /* hash table (IPv4 Address) */ + ogs_hash_t *ipv6_hash; /* hash table (IPv6 Address) */ + + /* IPv4 framed routes trie */ + struct upf_route_trie_node *ipv4_framed_routes; + /* IPv6 framed routes trie */ + struct upf_route_trie_node *ipv6_framed_routes; - ogs_list_t sess_list; + ogs_list_t sess_list; } upf_context_t; /* trie mapping from IP framed routes to session. */ @@ -96,11 +100,11 @@ #define UPF_SESS(pfcp_sess) ogs_container_of(pfcp_sess, upf_sess_t, pfcp) typedef struct upf_sess_s { ogs_lnode_t lnode; - uint32_t index; /**< An index of this node */ + ogs_pool_id_t *upf_n4_seid_node; /* A node of UPF-N4-SEID */ ogs_pfcp_sess_t pfcp; - uint64_t upf_n4_seid; /* UPF SEID is dervied from INDEX */ + uint64_t upf_n4_seid; /* UPF SEID is dervied from NODE */ struct { uint64_t seid; ogs_ip_t ip; @@ -118,6 +122,7 @@ /* Accounting: */ upf_sess_urr_acc_t urr_accOGS_MAX_NUM_OF_URR; /* FIXME: This probably needs to be mved to a hashtable or alike */ + char *apn_dnn; /* APN/DNN Item */ } upf_sess_t; void upf_context_init(void); @@ -131,7 +136,6 @@ upf_sess_t *upf_sess_add(ogs_pfcp_f_seid_t *f_seid); int upf_sess_remove(upf_sess_t *sess); void upf_sess_remove_all(void); -upf_sess_t *upf_sess_find(uint32_t index); upf_sess_t *upf_sess_find_by_smf_n4_seid(uint64_t seid); upf_sess_t *upf_sess_find_by_smf_n4_f_seid(ogs_pfcp_f_seid_t *f_seid); upf_sess_t *upf_sess_find_by_upf_n4_seid(uint64_t seid);
View file
open5gs_2.6.2.tar.xz/src/upf/gtp-path.c -> open5gs_2.6.3.tar.xz/src/upf/gtp-path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -258,11 +258,13 @@ { int len; ssize_t size; - char bufOGS_ADDRSTRLEN; + char buf1OGS_ADDRSTRLEN; + char buf2OGS_ADDRSTRLEN; upf_sess_t *sess = NULL; ogs_pkbuf_t *pkbuf = NULL; + ogs_sock_t *sock = NULL; ogs_sockaddr_t from; ogs_gtp2_header_t *gtp_h = NULL; @@ -272,6 +274,8 @@ uint8_t qfi; ogs_assert(fd != INVALID_SOCKET); + sock = data; + ogs_assert(sock); pkbuf = ogs_pkbuf_alloc(packet_pool, OGS_MAX_PKT_LEN); ogs_assert(pkbuf); @@ -300,14 +304,14 @@ if (gtp_h->type == OGS_GTPU_MSGTYPE_ECHO_REQ) { ogs_pkbuf_t *echo_rsp; - ogs_debug("RECV Echo Request from %s", OGS_ADDR(&from, buf)); + ogs_debug("RECV Echo Request from %s", OGS_ADDR(&from, buf1)); echo_rsp = ogs_gtp2_handle_echo_req(pkbuf); ogs_expect(echo_rsp); if (echo_rsp) { ssize_t sent; /* Echo reply */ - ogs_debug("SEND Echo Response to %s", OGS_ADDR(&from, buf)); + ogs_debug("SEND Echo Response to %s", OGS_ADDR(&from, buf1)); sent = ogs_sendto(fd, echo_rsp->data, echo_rsp->len, 0, &from); if (sent < 0 || sent != echo_rsp->len) { @@ -322,7 +326,7 @@ teid = be32toh(gtp_h->teid); ogs_trace("RECV GPU-U Type %d from %s : TEID0x%x", - gtp_h->type, OGS_ADDR(&from, buf), teid); + gtp_h->type, OGS_ADDR(&from, buf1), teid); qfi = 0; if (gtp_h->flags & OGS_GTPU_FLAGS_E) { @@ -369,7 +373,7 @@ } else if (gtp_h->type == OGS_GTPU_MSGTYPE_ERR_IND) { ogs_pfcp_far_t *far = NULL; - far = ogs_pfcp_far_find_by_error_indication(pkbuf); + far = ogs_pfcp_far_find_by_gtpu_error_indication(pkbuf); if (far) { ogs_assert(true == ogs_pfcp_up_handle_error_indication(far, &report)); @@ -419,12 +423,32 @@ pfcp_object = ogs_pfcp_object_find_by_teid(teid); if (!pfcp_object) { - /* TODO : Send Error Indication */ + /* + * TS23.527 Restoration procedures + * 4.3 UPF Restoration Procedures + * 4.3.2 Restoration Procedure for PSA UPF Restart + * + * The UPF shall not send GTP-U Error indication message + * for a configurable period after an UPF restart + * when the UPF receives a G-PDU not matching any PDRs. + */ + if (ogs_time_ntp32_now() > + (ogs_pfcp_self()->local_recovery + + ogs_time_sec( + ogs_app()->time.message.pfcp.association_interval))) { + ogs_error("%s Send Error Indication TEID:0x%x to %s", + OGS_ADDR(&sock->local_addr, buf1), + teid, + OGS_ADDR(&from, buf2)); + ogs_gtp1_send_error_indication(sock, teid, qfi, &from); + } goto cleanup; } switch(pfcp_object->type) { case OGS_PFCP_OBJ_PDR_TYPE: + /* UPF does not use PDR TYPE */ + ogs_assert_if_reached(); pdr = (ogs_pfcp_pdr_t *)pfcp_object; ogs_assert(pdr); break; @@ -456,7 +480,26 @@ } if (!pdr) { - /* TODO : Send Error Indication */ + /* + * TS23.527 Restoration procedures + * 4.3 UPF Restoration Procedures + * 4.3.2 Restoration Procedure for PSA UPF Restart + * + * The UPF shall not send GTP-U Error indication message + * for a configurable period after an UPF restart + * when the UPF receives a G-PDU not matching any PDRs. + */ + if (ogs_time_ntp32_now() > + (ogs_pfcp_self()->local_recovery + + ogs_time_sec( + ogs_app()->time.message.pfcp.association_interval))) { + ogs_error( + "%s Send Error Indication TEID:0x%x to %s", + OGS_ADDR(&sock->local_addr, buf1), + teid, + OGS_ADDR(&from, buf2)); + ogs_gtp1_send_error_indication(sock, teid, qfi, &from); + } goto cleanup; } @@ -684,7 +727,7 @@ config.cluster_2048_pool = ogs_app()->pool.packet; -#if OGS_USE_TALLOC +#if OGS_USE_TALLOC == 1 /* allocate a talloc pool for GTP to ensure it doesn't have to go back * to the libc malloc all the time */ packet_pool = talloc_pool(__ogs_talloc_core, 1000*1024);
View file
open5gs_2.6.2.tar.xz/src/upf/metrics.c -> open5gs_2.6.3.tar.xz/src/upf/metrics.c
Changed
@@ -286,7 +286,7 @@ ogs_assert(dnn_key); if (dnn) { - strcpy(dnn_key->dnn, dnn); + ogs_cpystrn(dnn_key->dnn, dnn, ogs_min(strlen(dnn), OGS_MAX_DNN_LEN)+1); } else { dnn_key->dnn0 = '\0'; }
View file
open5gs_2.6.2.tar.xz/src/upf/n4-handler.c -> open5gs_2.6.3.tar.xz/src/upf/n4-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -55,6 +55,9 @@ uint8_t offending_ie_value = 0; int i; + ogs_pfcp_sereq_flags_t sereq_flags; + bool restoration_indication = false; + upf_metrics_inst_global_inc(UPF_METR_GLOB_CTR_SM_N4SESSIONESTABREQ); ogs_assert(xact); @@ -74,9 +77,14 @@ return; } + memset(&sereq_flags, 0, sizeof(sereq_flags)); + if (req->pfcpsereq_flags.presence == 1) + sereq_flags.value = req->pfcpsereq_flags.u8; + for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) { created_pdri = ogs_pfcp_handle_create_pdr(&sess->pfcp, - &req->create_pdri, &cause_value, &offending_ie_value); + &req->create_pdri, &sereq_flags, + &cause_value, &offending_ie_value); if (created_pdri == NULL) break; } @@ -96,17 +104,24 @@ if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) goto cleanup; + if (req->apn_dnn.presence) { + char apn_dnnOGS_MAX_DNN_LEN+1; + + ogs_assert(0 < ogs_fqdn_parse(apn_dnn, req->apn_dnn.data, + ogs_min(req->apn_dnn.len, OGS_MAX_DNN_LEN))); + + if (sess->apn_dnn) + ogs_free(sess->apn_dnn); + sess->apn_dnn = ogs_strdup(apn_dnn); + ogs_assert(sess->apn_dnn); + } + for (i = 0; i < OGS_MAX_NUM_OF_QER; i++) { if (ogs_pfcp_handle_create_qer(&sess->pfcp, &req->create_qeri, &cause_value, &offending_ie_value) == NULL) break; - if (req->apn_dnn.presence == 1) { - upf_metrics_inst_by_dnn_add(req->apn_dnn.data, - UPF_METR_GAUGE_UPF_QOSFLOWS, 1); - } else { - upf_metrics_inst_by_dnn_add(NULL, - UPF_METR_GAUGE_UPF_QOSFLOWS, 1); - } + upf_metrics_inst_by_dnn_add(sess->apn_dnn, + UPF_METR_GAUGE_UPF_QOSFLOWS, 1); } if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) goto cleanup; @@ -116,6 +131,18 @@ if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) goto cleanup; + /* PFCPSEReq-Flags */ + if (sereq_flags.restoration_indication == 1) { + for (i = 0; i < num_of_created_pdr; i++) { + pdr = created_pdri; + ogs_assert(pdr); + + if (pdr->f_teid_len) + ogs_pfcp_pdr_swap_teid(pdr); + } + restoration_indication = true; + } + /* Setup GTP Node */ ogs_list_for_each(&sess->pfcp.far_list, far) { ogs_assert(OGS_ERROR != ogs_pfcp_setup_far_gtpu_node(far)); @@ -155,65 +182,9 @@ } /* Setup UPF-N3-TEID & QFI Hash */ - if (pdr->f_teid_len) { - ogs_pfcp_object_type_e type = OGS_PFCP_OBJ_SESS_TYPE; - - if (ogs_pfcp_self()->up_function_features.ftup && - pdr->f_teid.ch) { - - ogs_pfcp_pdr_t *choosed_pdr = NULL; - - if (pdr->f_teid.chid) { - choosed_pdr = ogs_pfcp_pdr_find_by_choose_id( - &sess->pfcp, pdr->f_teid.choose_id); - if (!choosed_pdr) { - pdr->chid = true; - pdr->choose_id = pdr->f_teid.choose_id; - } - } else { - type = OGS_PFCP_OBJ_PDR_TYPE; - } - - if (choosed_pdr) { - pdr->f_teid_len = choosed_pdr->f_teid_len; - memcpy(&pdr->f_teid, &choosed_pdr->f_teid, pdr->f_teid_len); - - } else { - ogs_gtpu_resource_t *resource = NULL; - resource = ogs_pfcp_find_gtpu_resource( - &ogs_gtp_self()->gtpu_resource_list, - pdr->dnn, OGS_PFCP_INTERFACE_ACCESS); - if (resource) { - ogs_assert( - (resource->info.v4 && pdr->f_teid.ipv4) || - (resource->info.v6 && pdr->f_teid.ipv6)); - ogs_assert(OGS_OK == - ogs_pfcp_user_plane_ip_resource_info_to_f_teid( - &resource->info, &pdr->f_teid, &pdr->f_teid_len)); - if (resource->info.teidri) - pdr->f_teid.teid = OGS_PFCP_GTPU_INDEX_TO_TEID( - pdr->index, resource->info.teidri, - resource->info.teid_range); - else - pdr->f_teid.teid = pdr->index; - } else { - ogs_assert( - (ogs_gtp_self()->gtpu_addr && pdr->f_teid.ipv4) || - (ogs_gtp_self()->gtpu_addr6 && pdr->f_teid.ipv6)); - ogs_assert(OGS_OK == - ogs_pfcp_sockaddr_to_f_teid( - pdr->f_teid.ipv4 ? - ogs_gtp_self()->gtpu_addr : NULL, - pdr->f_teid.ipv6 ? - ogs_gtp_self()->gtpu_addr6 : NULL, - &pdr->f_teid, &pdr->f_teid_len)); - pdr->f_teid.teid = pdr->index; - } - } - } - - ogs_pfcp_object_teid_hash_set(type, pdr); - } + if (pdr->f_teid_len) + ogs_pfcp_object_teid_hash_set( + OGS_PFCP_OBJ_SESS_TYPE, pdr, restoration_indication); } /* Send Buffered Packet to gNB/SGW */ @@ -223,9 +194,16 @@ } } - ogs_assert(OGS_OK == - upf_pfcp_send_session_establishment_response( - xact, sess, created_pdr, num_of_created_pdr)); + if (restoration_indication == true || + ogs_pfcp_self()->up_function_features.ftup == 0) + ogs_assert(OGS_OK == + upf_pfcp_send_session_establishment_response( + xact, sess, NULL, 0)); + else + ogs_assert(OGS_OK == + upf_pfcp_send_session_establishment_response( + xact, sess, created_pdr, num_of_created_pdr)); + return; cleanup: @@ -266,7 +244,7 @@ for (i = 0; i < OGS_MAX_NUM_OF_PDR; i++) { created_pdri = ogs_pfcp_handle_create_pdr(&sess->pfcp, - &req->create_pdri, &cause_value, &offending_ie_value); + &req->create_pdri, NULL, &cause_value, &offending_ie_value); if (created_pdri == NULL) break; } @@ -358,7 +336,7 @@ if (ogs_pfcp_handle_create_qer(&sess->pfcp, &req->create_qeri, &cause_value, &offending_ie_value) == NULL) break; - upf_metrics_inst_by_dnn_add(NULL, + upf_metrics_inst_by_dnn_add(sess->apn_dnn, UPF_METR_GAUGE_UPF_QOSFLOWS, 1); } if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) @@ -376,7 +354,7 @@ if (ogs_pfcp_handle_remove_qer(&sess->pfcp, &req->remove_qeri, &cause_value, &offending_ie_value) == false) break; - upf_metrics_inst_by_dnn_add(NULL, + upf_metrics_inst_by_dnn_add(sess->apn_dnn, UPF_METR_GAUGE_UPF_QOSFLOWS, -1); } if (cause_value != OGS_PFCP_CAUSE_REQUEST_ACCEPTED)
View file
open5gs_2.6.2.tar.xz/src/upf/pfcp-path.c -> open5gs_2.6.3.tar.xz/src/upf/pfcp-path.c
Changed
@@ -208,7 +208,6 @@ ogs_pfcp_header_t h; ogs_assert(xact); - ogs_assert(created_pdr); memset(&h, 0, sizeof(ogs_pfcp_header_t)); h.type = OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE;
View file
open5gs_2.6.2.tar.xz/src/upf/pfcp-sm.c -> open5gs_2.6.3.tar.xz/src/upf/pfcp-sm.c
Changed
@@ -281,12 +281,9 @@ &message->pfcp_association_setup_response); break; case OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE: - if (message->h.seid_presence && message->h.seid == 0) { - ogs_expect(!sess); - sess = upf_sess_add_by_message(message); - if (sess) - OGS_SETUP_PFCP_NODE(sess, node); - } + sess = upf_sess_add_by_message(message); + if (sess) + OGS_SETUP_PFCP_NODE(sess, node); upf_n4_handle_session_establishment_request( sess, xact, &message->pfcp_session_establishment_request); break;
View file
open5gs_2.6.2.tar.xz/tests/af/context.c -> open5gs_2.6.3.tar.xz/tests/af/context.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -267,17 +267,21 @@ } static ogs_sbi_client_t *find_client_by_fqdn( - OpenAPI_uri_scheme_e scheme, char *fqdn, int port) + OpenAPI_uri_scheme_e scheme, char *fqdn) { int rv; ogs_sockaddr_t *addr = NULL; ogs_sbi_client_t *client = NULL; - ogs_assert(scheme); + ogs_assert(scheme == OpenAPI_uri_scheme_https || + scheme == OpenAPI_uri_scheme_http); ogs_assert(fqdn); - rv = ogs_getaddrinfo(&addr, AF_UNSPEC, fqdn, - port ? port : ogs_sbi_self()->sbi_port, 0); + rv = ogs_getaddrinfo( + &addr, AF_UNSPEC, fqdn, + scheme == OpenAPI_uri_scheme_https ? + OGS_SBI_HTTPS_PORT : OGS_SBI_HTTP_PORT, + 0); if (rv != OGS_OK) { ogs_error("Invalid NFProfile.fqdn"); return NULL; @@ -306,7 +310,7 @@ OpenAPI_uri_scheme_https : OpenAPI_uri_scheme_http; if (sess->pcf.fqdn && strlen(sess->pcf.fqdn)) - client = find_client_by_fqdn(scheme, sess->pcf.fqdn, 0); + client = find_client_by_fqdn(scheme, sess->pcf.fqdn); if (!client) { /* At this point, CLIENT selection method is very simple. */
View file
open5gs_2.6.2.tar.xz/tests/af/context.h -> open5gs_2.6.3.tar.xz/tests/af/context.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -72,6 +72,7 @@ struct { ogs_sockaddr_t *addr; ogs_sockaddr_t *addr6; + bool is_port; int port; } ipOGS_SBI_MAX_NUM_OF_IP_ADDRESS;
View file
open5gs_2.6.2.tar.xz/tests/af/nbsf-handler.c -> open5gs_2.6.3.tar.xz/tests/af/nbsf-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -67,21 +67,10 @@ if (!IpEndPoint) continue; if (sess->pcf.num_of_ip < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) { - if (!IpEndPoint->is_port) { - if (ogs_sbi_default_uri_scheme() == - OpenAPI_uri_scheme_http) - port = OGS_SBI_HTTP_PORT; - else if (ogs_sbi_default_uri_scheme() == - OpenAPI_uri_scheme_https) - port = OGS_SBI_HTTPS_PORT; - else { - ogs_fatal("Invalid scheme %d", - ogs_sbi_default_uri_scheme()); - ogs_assert_if_reached(); - } - } else { + if (!IpEndPoint->is_port) + port = ogs_sbi_client_default_port(); + else port = IpEndPoint->port; - } if (IpEndPoint->ipv4_address) { rv = ogs_getaddrinfo(&addr, AF_UNSPEC, @@ -95,6 +84,7 @@ } if (addr || addr6) { + sess->pcf.ipsess->pcf.num_of_ip.is_port = IpEndPoint->is_port; sess->pcf.ipsess->pcf.num_of_ip.port = port; sess->pcf.ipsess->pcf.num_of_ip.addr = addr; sess->pcf.ipsess->pcf.num_of_ip.addr6 = addr6;
View file
open5gs_2.6.2.tar.xz/tests/attach/guti-test.c -> open5gs_2.6.3.tar.xz/tests/attach/guti-test.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -228,7 +228,7 @@ 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.epco = 1; sess->pdn_connectivity_param.request_type = OGS_NAS_EPS_REQUEST_TYPE_INITIAL; esmbuf = testesm_build_pdn_connectivity_request(sess, false);
View file
open5gs_2.6.2.tar.xz/tests/attach/simple-test.c -> open5gs_2.6.3.tar.xz/tests/attach/simple-test.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -149,7 +149,7 @@ tests1ap_recv(test_ue, recvbuf); /* Send ESM Information Response */ - sess->esm_information_param.pco = 1; + sess->esm_information_param.epco = 1; esmbuf = testesm_build_esm_information_response(sess); ABTS_PTR_NOTNULL(tc, esmbuf); sendbuf = test_s1ap_build_uplink_nas_transport(test_ue, esmbuf);
View file
open5gs_2.6.2.tar.xz/tests/common/context.h -> open5gs_2.6.3.tar.xz/tests/common/context.h
Changed
@@ -257,10 +257,11 @@ typedef struct test_pdn_connectivity_param_s { union { struct { - ED6(uint8_t eit:1;, + ED7(uint8_t eit:1;, uint8_t eit_no_required:1;, uint8_t apn:1;, uint8_t pco:1;, + uint8_t epco:1;, uint8_t spare:1;, uint8_t request_type:3;) }; @@ -272,7 +273,7 @@ union { struct { ED8(uint8_t pco:1;, - uint8_t spare1:1;, + uint8_t epco:1;, uint8_t spare2:1;, uint8_t spare3:1;, uint8_t spare4:1;,
View file
open5gs_2.6.2.tar.xz/tests/common/esm-build.c -> open5gs_2.6.3.tar.xz/tests/common/esm-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -34,6 +34,8 @@ &pdn_connectivity_request->esm_information_transfer_flag; ogs_nas_protocol_configuration_options_t *protocol_configuration_options = &pdn_connectivity_request->protocol_configuration_options; + ogs_nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options = + &pdn_connectivity_request->extended_protocol_configuration_options; #if 0 uint8_t ue_pco29 = "\x80\x80\x21\x10\x01\x01\x00\x10\x81\x06\x00\x00\x00\x00" @@ -87,12 +89,25 @@ pdn_connectivity_request->presencemask |= OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; protocol_configuration_options->length = sizeof(ue_pco); memcpy(protocol_configuration_options->buffer, ue_pco, sizeof(ue_pco)); + } else if (sess->pdn_connectivity_param.epco) { + pdn_connectivity_request->presencemask |= OGS_NAS_EPS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + extended_protocol_configuration_options->length = sizeof(ue_pco); + extended_protocol_configuration_options->buffer = + ogs_calloc(sizeof(uint8_t), extended_protocol_configuration_options->length); + ogs_assert(extended_protocol_configuration_options->buffer); + memcpy(extended_protocol_configuration_options->buffer, ue_pco, sizeof(ue_pco)); } if (integrity_protected) - return test_nas_eps_security_encode(test_ue, &message); + pkbuf = test_nas_eps_security_encode(test_ue, &message); else - return ogs_nas_eps_plain_encode(&message); + pkbuf = ogs_nas_eps_plain_encode(&message); + ogs_assert(pkbuf); + + if (extended_protocol_configuration_options->buffer) + ogs_free(extended_protocol_configuration_options->buffer); + + return pkbuf; } ogs_pkbuf_t *testesm_build_pdn_disconnect_request(test_sess_t *sess) @@ -139,6 +154,8 @@ &esm_information_response->access_point_name; ogs_nas_protocol_configuration_options_t *protocol_configuration_options = &esm_information_response->protocol_configuration_options; + ogs_nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options = + &esm_information_response->extended_protocol_configuration_options; #if 0 uint8_t ue_pco29 = @@ -191,9 +208,22 @@ esm_information_response->presencemask |= OGS_NAS_EPS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; protocol_configuration_options->length = sizeof(ue_pco); memcpy(protocol_configuration_options->buffer, ue_pco, sizeof(ue_pco)); + } else if (sess->esm_information_param.epco) { + esm_information_response->presencemask |= OGS_NAS_EPS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; + extended_protocol_configuration_options->length = sizeof(ue_pco); + extended_protocol_configuration_options->buffer = + ogs_calloc(sizeof(uint8_t), extended_protocol_configuration_options->length); + ogs_assert(extended_protocol_configuration_options->buffer); + memcpy(extended_protocol_configuration_options->buffer, ue_pco, sizeof(ue_pco)); } - return test_nas_eps_security_encode(test_ue, &message); + pkbuf = test_nas_eps_security_encode(test_ue, &message); + ogs_assert(pkbuf); + + if (extended_protocol_configuration_options->buffer) + ogs_free(extended_protocol_configuration_options->buffer); + + return pkbuf; } ogs_pkbuf_t *testesm_build_activate_default_eps_bearer_context_accept(
View file
open5gs_2.6.2.tar.xz/tests/common/gtpu.c -> open5gs_2.6.3.tar.xz/tests/common/gtpu.c
Changed
@@ -499,7 +499,7 @@ ogs_assert_if_reached(); } - pkbuf = ogs_gtp2_build_error_indication(teid, node->addr); + pkbuf = ogs_gtp1_build_error_indication(teid, node->addr); ogs_assert(pkbuf); memset(>p_hdesc, 0, sizeof(gtp_hdesc));
View file
open5gs_2.6.2.tar.xz/tests/core/memory-test.c -> open5gs_2.6.3.tar.xz/tests/core/memory-test.c
Changed
@@ -41,7 +41,7 @@ static void test3_func(abts_case *tc, void *data) { -#if OGS_USE_TALLOC != 1 +#if OGS_USE_TALLOC == 0 char *ptr = ogs_realloc(0, 10); ABTS_PTR_NOTNULL(tc, ptr); ogs_free(ptr); @@ -54,7 +54,7 @@ static void test4_func(abts_case *tc, void *data) { -#if OGS_USE_TALLOC != 1 +#if OGS_USE_TALLOC == 0 char *p, *q; p = ogs_malloc(10);
View file
open5gs_2.6.2.tar.xz/tests/handover/5gc-n2-test.c -> open5gs_2.6.3.tar.xz/tests/handover/5gc-n2-test.c
Changed
@@ -806,9 +806,6 @@ rv = testgnb_ngap_send(ngap2, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); - /* Waiting for N4 */ - ogs_msleep(100); - /* Receive End Mark */ recvbuf = test_gtpu_read(gtpu1); ABTS_PTR_NOTNULL(tc, recvbuf); @@ -926,9 +923,6 @@ rv = testgnb_ngap_send(ngap1, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); - /* Waiting for N4 */ - ogs_msleep(100); - /* Receive End Mark */ recvbuf = test_gtpu_read(gtpu2); ABTS_PTR_NOTNULL(tc, recvbuf); @@ -1844,9 +1838,6 @@ rv = testgnb_ngap_send(ngap2, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); - /* Waiting for N4 */ - ogs_msleep(100); - /* Receive End Mark */ recvbuf = test_gtpu_read(gtpu1); ABTS_PTR_NOTNULL(tc, recvbuf); @@ -1916,6 +1907,9 @@ ABTS_PTR_NOTNULL(tc, recvbuf); ogs_pkbuf_free(recvbuf); + /* Waiting for removing Indirect Data Forwarding */ + ogs_msleep(100); + /* Send HandoverRequired */ sendbuf = testngap_build_handover_required( test_ue, NGAP_HandoverType_intra5gs, @@ -1992,9 +1986,6 @@ rv = testgnb_ngap_send(ngap1, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); - /* Waiting for N4 */ - ogs_msleep(100); - /* Receive End Mark */ recvbuf = test_gtpu_read(gtpu2); ABTS_PTR_NOTNULL(tc, recvbuf); @@ -2500,9 +2491,6 @@ rv = testgnb_ngap_send(ngap2, sendbuf); ABTS_INT_EQUAL(tc, OGS_OK, rv); - /* Waiting for N4 */ - ogs_msleep(100); - /* Receive End Mark */ recvbuf = test_gtpu_read(gtpu1); ABTS_PTR_NOTNULL(tc, recvbuf);
View file
open5gs_2.6.2.tar.xz/webui/package-lock.json -> open5gs_2.6.3.tar.xz/webui/package-lock.json
Changed
@@ -1,6 +1,6 @@ { "name": "open5gs", - "version": "2.6.1", + "version": "2.6.3", "lockfileVersion": 2, "requires": true, "packages": {
View file
open5gs_2.6.2.tar.xz/webui/package.json -> open5gs_2.6.3.tar.xz/webui/package.json
Changed
@@ -1,6 +1,6 @@ { "name": "open5gs", - "version": "2.6.1", + "version": "2.6.3", "description": "Open5gs", "main": "index.js", "repository": "https://github.com/open5gs/open5gs/webui",
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.