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 26
View file
open5gs_2.7.5.dsc -> open5gs_2.7.6.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-sepp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg Architecture: any -Version: 2.7.5 +Version: 2.7.6 Maintainer: Harald Welte <laforge@gnumonks.org> Uploaders: Sukchan Lee <acetcom@gmail.com> Homepage: https://open5gs.org @@ -32,8 +32,8 @@ open5gs-udr deb net optional arch=any open5gs-upf deb net optional arch=any Checksums-Sha1: - 303a73808ade945b1fe26fb6f6edd6f44abd9e90 14530664 open5gs_2.7.5.tar.xz + 49912f74beb3e8889e2cf7c526503a1d31948a41 14540076 open5gs_2.7.6.tar.xz Checksums-Sha256: - 2d4a89279f942f2eef0774f0ca239f3d7a4ce967eb5336ad6d319c415ae2ee5c 14530664 open5gs_2.7.5.tar.xz + 5334ed63073cced86ecd63ddc015df48706cbe1d808e2a6e0893d578fcdf6d49 14540076 open5gs_2.7.6.tar.xz Files: - e0bd301b5594bf766244a046864efbea 14530664 open5gs_2.7.5.tar.xz + 4c16b1e03d884aa35e7499c4d2f19f71 14540076 open5gs_2.7.6.tar.xz
View file
open5gs_2.7.5.tar.xz/.tarball-version -> open5gs_2.7.6.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -2.7.5 +2.7.6
View file
open5gs_2.7.5.tar.xz/configs/meson.build -> open5gs_2.7.6.tar.xz/configs/meson.build
Changed
@@ -41,6 +41,7 @@ srsenb.yaml non3gpp.yaml transfer.yaml + transfer-error-case.yaml '''.split() foreach file : example_conf
View file
open5gs_2.7.6.tar.xz/configs/transfer-error-case.yaml.in
Added
@@ -0,0 +1,266 @@ +db_uri: mongodb://localhost/open5gs + +logger: + +test: + serving: + - plmn_id: + mcc: 999 + mnc: 70 + +global: + parameter: +# no_nrf: true + no_scp: true + no_sepp: true +# no_amf: true +# no_smf: true +# no_upf: true +# no_ausf: true +# no_udm: true +# no_pcf: true +# no_nssf: true +# no_bsf: true +# no_udr: true + no_mme: true + no_sgwc: true + no_sgwu: true + no_pcrf: true + no_hss: true + +smf: + sbi: + server: + - address: 127.0.0.4 + port: 7777 + client: + nrf: + - uri: http://127.0.0.10:7777 + pfcp: + server: + - address: 127.0.0.4 + client: + upf: + - address: 127.0.0.7 + gtpc: + server: + - address: 127.0.0.4 + gtpu: + server: + - address: 127.0.0.4 + metrics: + server: + - address: 127.0.0.4 + port: 9090 + session: + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 + gateway: 2001:db8:cafe::1 + dns: + - 8.8.8.8 + - 8.8.4.4 + - 2001:4860:4860::8888 + - 2001:4860:4860::8844 + mtu: 1400 + freeDiameter: + identity: smf.localdomain + realm: localdomain + listen_on: 127.0.0.4 + no_fwd: true + load_extension: + - module: @build_subprojects_freeDiameter_extensions_dir@/dbg_msg_dumps.fdx + conf: 0x8888 + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_rfc5777.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_mip6i.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_nasreq.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_nas_mipv6.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_dcca.fdx + - module: @build_subprojects_freeDiameter_extensions_dir@/dict_dcca_3gpp/dict_dcca_3gpp.fdx + connect: + - identity: pcrf.localdomain + address: 127.0.0.9 + +amf: + sbi: + server: + - address: 127.0.0.5 + port: 7777 + client: + nrf: + - uri: http://127.0.0.10:7777 + ngap: + server: + - address: 127.0.0.5 + metrics: + server: + - address: 127.0.0.5 + port: 9090 + guami: + - plmn_id: + mcc: 999 + mnc: 70 + amf_id: + region: 2 + set: 1 + pointer: 31 + tai: + - plmn_id: + mcc: 999 + mnc: 70 + tac: 1 + plmn_support: + - plmn_id: + mcc: 999 + mnc: 70 + s_nssai: + - sst: 1 + security: + integrity_order : NIA2, NIA1, NIA0 + ciphering_order : NEA0, NEA1, NEA2 + network_name: + full: Open5GS + amf_name: open5gs-amf0 + time: + t3512: + value: 540 # 9 mintues * 60 = 540 seconds + +# amf #2 +amf: + sbi: + server: + - address: 127.0.0.50 + port: 7777 + client: + nrf: + - uri: http://127.0.0.10:7777 + ngap: + server: + - address: 127.0.0.50 + metrics: + server: + - address: 127.0.0.50 + port: 9090 + guami: + - plmn_id: + mcc: 999 + mnc: 70 + amf_id: + region: 2 + set: 1 + pointer: 30 + tai: + - plmn_id: + mcc: 999 + mnc: 70 + tac: 1 + plmn_support: + - plmn_id: + mcc: 999 + mnc: 70 + s_nssai: + - sst: 1 + security: + integrity_order : NIA2, NIA1, NIA0 + ciphering_order : NEA0, NEA1, NEA2 + network_name: + full: Open5GS + amf_name: open5gs-amf1 + time: + t3512: + value: 540 # 9 mintues * 60 = 540 seconds + +upf: + pfcp: + server: + - address: 127.0.0.7 + gtpu: + server: + - address: 127.0.0.7 + session: + - subnet: 10.45.0.0/16 + gateway: 10.45.0.1 + - subnet: 2001:db8:cafe::/48 + gateway: 2001:db8:cafe::1 + metrics: + server: + - address: 127.0.0.7 + port: 9090 + +nrf: + sbi: + server: + - address: 127.0.0.10 + port: 7777 + serving: + - plmn_id: + mcc: 999 + mnc: 70 +
View file
open5gs_2.7.5.tar.xz/debian/changelog -> open5gs_2.7.6.tar.xz/debian/changelog
Changed
@@ -1,3 +1,45 @@ +open5gs (2.7.6) unstable; urgency=medium + + * Bug Fixed + + -- Sukchan Lee <acetcom@gmail.com> Sat, 19 Jul 2025 10:02:38 +0900 + +open5gs (2.7.6~plucky) plucky; urgency=medium + + * Bug Fixed + + -- Sukchan Lee <acetcom@gmail.com> Sat, 19 Jul 2025 09:59:50 +0900 + +open5gs (2.7.6~oracular) oracular; urgency=medium + + * Bug Fixed + + -- Sukchan Lee <acetcom@gmail.com> Sat, 19 Jul 2025 09:57:14 +0900 + +open5gs (2.7.6~noble) noble; urgency=medium + + * Bug Fixed + + -- Sukchan Lee <acetcom@gmail.com> Sat, 19 Jul 2025 09:55:32 +0900 + +open5gs (2.7.6~jammy) jammy; urgency=medium + + * Bug Fixed + + -- Sukchan Lee <acetcom@gmail.com> Sat, 19 Jul 2025 09:53:39 +0900 + +open5gs (2.7.6~focal) focal; urgency=medium + + * Bug Fixed + + -- Sukchan Lee <acetcom@gmail.com> Sat, 19 Jul 2025 09:51:57 +0900 + +open5gs (2.7.6~bionic) bionic; urgency=medium + + * Bug Fixed + + -- Sukchan Lee <acetcom@gmail.com> Sat, 19 Jul 2025 09:49:35 +0900 + open5gs (2.7.5) unstable; urgency=medium * Bug Fixed
View file
open5gs_2.7.5.tar.xz/docs/_config.yml -> open5gs_2.7.6.tar.xz/docs/_config.yml
Changed
@@ -26,6 +26,9 @@ # Build settings markdown: kramdown +kramdown: + parse_block_html: true + plugins: - jekyll-feed - jekyll-seo-tag
View file
open5gs_2.7.5.tar.xz/docs/_docs/tutorial/05-roaming.md -> open5gs_2.7.6.tar.xz/docs/_docs/tutorial/05-roaming.md
Changed
@@ -354,7 +354,7 @@ $ ./install/bin/open5gs-seppd -c ./install/etc/open5gs/sepp1.yaml ``` -#### Visted Network +#### Visited Network ``` $ ./install/bin/open5gs-nrfd $ ./install/bin/open5gs-scpd
View file
open5gs_2.7.6.tar.xz/docs/_docs/tutorial/06-Open5GS-with-5G-Sharp-Orchestrator.md
Added
@@ -0,0 +1,478 @@ +--- +title: Open5GS with 5G Sharp Orchestrator +--- + +This tutorial is a guide to configure the tool 5G Sharp Orchestrator with Open5GS. + +5G Sharp Orchestrator is a tool that serves as a comprehensive wrapper for configuring, deploying and monitoring 5G open-source network components, simplifying the orchestration process. + +For more information on 5G Sharp Orchestrator please visit: https://github.com/Ethon-Shield/5g-sharp-orchestrator + +!Basic Execution Example(https://raw.githubusercontent.com/Ethon-Shield/5g-sharp-orchestrator/9eddaf0c19d8333708271f1e3d6348735e32ae90/images/basic_execution_example.png) + + +# Usage + +To correctly execute the 5G Sharp Orchestrator with Open5GS you will need to: + +**0. Install prerequisites** +**1. Configure the project** +**2. Check the configuration is valid** +**3. Execute the tool** + +This tutorial has been described with the following setup: +- Physical machine: + - i7 processor + - Ubuntu 22.04 LTS + - User "test" + - Connectivity - Offline + - Open5GS cloned and compiled in /home/test/open5gs + - srsRAN cloned and compiled in /home/test/srsRAN_Project +- Network parameters: + - MCC: 001 + - MNC: 01 + - TAC: 1 +- SDR device: + - Ettus B200 mini + +## 0. Install prerequisites + +To be able to use the 5G Sharp Orchestrator tool, you will need to meet the following prerequisites. + +<details> +<summary><strong>Software prerequisites</strong></summary> + +This project needs certain binaries to be installed. + +- The project has been successfully tested with **Ubuntu 22.04** +- UHD built from source (https://files.ettus.com/manual/page_build_guide.html) +- docker **version 19.03.0 or higher** (https://docs.docker.com/engine/install/ubuntu/) +``` +# User going to be used should be in the docker group +sudo usermod -aG docker <user> +newgrp docker +``` +- docker-compose **version 1.29.2 or higher** (https://docs.docker.com/compose/install/linux/) +- tmux **version 3.5a** (https://github.com/tmux/tmux/releases) + +```bash +wget https://github.com/tmux/tmux/releases/download/3.5a/tmux-3.5a.tar.gz +tar -zxf tmux-3.5a.tar.gz +cd tmux-3.5a +./configure +make +sudo make install +``` + +- wireshark, tshark, expect + +```bash +sudo add-apt-repository ppa:wireshark-dev/stable +sudo apt update +sudo apt install wireshark tshark expect +``` + +</details> +<details> +<summary><strong>Install Open5GS Core</strong></summary> + +Official documentation: https://open5gs.org/open5gs/docs/guide/02-building-open5gs-from-sources/ + +To work with Open5GS core, it is recommended to build the project from source. + +**1. Getting MongoDB** + +- Install GNU Privacy Guard tool: + +``` +sudo apt update +sudo apt install gnupg +``` + +- Import the public key used by the package management system: + +``` +curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor + +echo "deb arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list +``` + +- Install the MongoDB packages: +``` +sudo apt update +sudo apt install -y mongodb-org +``` + +**NOTE**: MongoDB service needs to be running in order to execute the project. This can be done using the command ``sudo systemctl start mongod `` + +**2. Building Open5GS** + +Install the required dependencies: + +``` +sudo apt install python3-pip python3-setuptools python3-wheel ninja-build build-essential flex bison git cmake libsctp-dev libgnutls28-dev libgcrypt-dev libssl-dev libidn11-dev libmongoc-dev libbson-dev libyaml-dev libnghttp2-dev libmicrohttpd-dev libcurl4-gnutls-dev libnghttp2-dev libtins-dev libtalloc-dev meson +``` +Clone the official project repository: +``` +git clone https://github.com/open5gs/open5gs +``` +Compile with <i>meson</i> and build with <i>ninja</i>: +``` +cd open5gs/ meson build --prefix=`pwd`/install +ninja -C build +``` +Check wether the compilation is correct: +``` + ./build/tests/registration/registration +``` +Run all test programs: +``` +cd build +sudo meson test -v +``` +Perform the installation process: +``` +cd build +ninja install +cd ../ +``` +</details> + +<details> +<summary><strong>Install srsRAN gNB</strong></summary> + +Official documentation: https://docs.srsran.com/projects/project/en/latest/user_manuals/source/installation.html + +**1. Installing build tools and dependencies** + +The required build tools and dependencies for the project can be installed in Ubuntu using the following command: +``` +sudo apt-get install cmake make gcc g++ pkg-config libfftw3-dev libmbedtls-dev libsctp-dev libyaml-cpp-dev libgtest-devg +``` + +**2. Clone and build** + +Clone the project repository: +``` +git clone https://github.com/srsRAN/srsRAN_Project.git +``` + +Build the code-base: +``` +cd srsRAN_Project +mkdir build +cd build +cmake ../ +make -j $(nproc) +make test -j $(nproc) +sudo make install +``` +</details> + +<details> +<summary><strong>Hardware prerequisites</strong></summary> + + +- USRP devices. +- USB 3.0 port to connect the SDR. +- It is recommended to at least have an i7 processor. + +</details> + + +## 1. Configuring the project + +Once the prerequisites have been fullfilled, the next step is to setup the 5G Sharp Orchestrator. First of all, clone the repository: + +``` +cd ~/ +git clone https://github.com/Ethon-Shield/5g-sharp-orchestrator.git +``` + +To configure the 5G Sharp Orchestrator with Open5GS you will need to modify the corresponding parameters in the file `./conf/sharp-orchestrator.src` . In this file you will be able to set different network parameters such as the MCC, MNC or TAC, encryption and integrity alogrithms, as well as defining the file paths of the corresponding binaries. + +The following variables are set based on the example setup described at the start of the tutorial. + +**SHARP ORCHESTRATOR**: +- **SHARP_ORCHESTRATOR_IP_ADDRESS**=127.0.0.1 +- **SHARP_ORCHESTRATOR_USERNAME**="test" +- **SHARP_ORCHESTRATOR_WORKING_DIR**="/home/test/5g-sharp-orhcestrator/"
View file
open5gs_2.7.6.tar.xz/docs/_posts/2025-07-19-release-v2.7.6.md
Added
@@ -0,0 +1,15 @@ +--- +title: "v2.7.6 - Bug fixed" +date: 2025-03-30 22:05: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.7.6) + +Download -- v2.7.6.tar.gz(https://github.com/open5gs/open5gs/archive/v2.7.6.tar.gz) +{: .notice--info}
View file
open5gs_2.7.5.tar.xz/lib/core/ogs-process.c -> open5gs_2.7.6.tar.xz/lib/core/ogs-process.c
Changed
@@ -370,9 +370,17 @@ } if (process->child != waitpid(process->child, &status, 0)) { + process->child = 0; + ogs_error("waitpid failed: %d", status); return OGS_ERROR; } + process->child = 0; + if (process->nf_name) { + ogs_free(process->nf_name); + process->nf_name = NULL; + } + if (out_return_code) { if (WIFEXITED(status)) { *out_return_code = WEXITSTATUS(status); @@ -416,9 +424,17 @@ return OGS_ERROR; } #else - if (kill(process->child, SIGTERM) == -1) { - return OGS_ERROR; + + if (process->child) { + if (kill(process->child, SIGTERM) == -1) { + if (errno == ESRCH) { + /* No such process */ + return OGS_OK; + } + return OGS_ERROR; + } } + #endif return OGS_OK; @@ -434,8 +450,14 @@ return OGS_ERROR; } #else - if (kill(process->child, SIGKILL) == -1) { - return OGS_ERROR; + if (process->child) { + if (kill(process->child, SIGKILL) == -1) { + if (errno == ESRCH) { + /* No such process */ + return OGS_OK; + } + return OGS_ERROR; + } } #endif
View file
open5gs_2.7.5.tar.xz/lib/core/ogs-process.h -> open5gs_2.7.6.tar.xz/lib/core/ogs-process.h
Changed
@@ -73,6 +73,10 @@ unsigned long dwProcessId; #else pid_t child; + + // to force kill the right NF in tests if needed. + char *nf_name; + int index; #endif } ogs_proc_t;
View file
open5gs_2.7.5.tar.xz/lib/dbi/ims.c -> open5gs_2.7.6.tar.xz/lib/dbi/ims.c
Changed
@@ -120,7 +120,8 @@ bson_error_t error; const bson_t *document; bson_iter_t iter; - bson_iter_t child1_iter; + bson_iter_t child1_iter, child2_iter, child3_iter, child4_iter, child5_iter; + bson_iter_t child6_iter, child7_iter, child8_iter, child9_iter; const char *utf8 = NULL; uint32_t length = 0; @@ -190,6 +191,222 @@ } } ims_data->num_of_msisdn = msisdn_index; + } else if (!strcmp(key, "ifc") && + BSON_ITER_HOLDS_ARRAY(&iter)) { + int ifc_index = 0; + bson_iter_recurse(&iter, &child2_iter); + while (bson_iter_next(&child2_iter)) { + ogs_assert(ifc_index < OGS_MAX_NUM_OF_IFC); + bson_iter_recurse(&child2_iter, &child3_iter); + while (bson_iter_next(&child3_iter)) { + const char *child3_key = bson_iter_key(&child3_iter); + if (!strcmp(child3_key, "priority") && + BSON_ITER_HOLDS_INT32(&child3_iter)) { + ims_data->ifcifc_index.priority = + bson_iter_int32(&child3_iter); + } else if (!strcmp(child3_key, "application_server") && + BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) { + bson_iter_recurse(&child3_iter, &child4_iter); + while (bson_iter_next(&child4_iter)) { + const char *child4_key = + bson_iter_key(&child4_iter); + if (!strcmp(child4_key, "server_name") && + BSON_ITER_HOLDS_UTF8(&child4_iter)) { + utf8 = bson_iter_utf8(&child4_iter, &length); + ims_data->ifcifc_index + .application_server.server_name = + ogs_strndup(utf8, length); + } else if (!strcmp(child4_key, "default_handling") + && BSON_ITER_HOLDS_INT32(&child4_iter)) { + ims_data->ifcifc_index + .application_server.default_handling = + bson_iter_int32(&child4_iter); + } + } + } else if (!strcmp(child3_key, "trigger_point") && + BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) { + bson_iter_recurse(&child3_iter, &child5_iter); + while (bson_iter_next(&child5_iter)) { + const char *child5_key = + bson_iter_key(&child5_iter); + if (!strcmp(child5_key, "condition_type_cnf") && + BSON_ITER_HOLDS_INT32(&child5_iter)) { + ims_data->ifcifc_index + .trigger_point.condition_type_cnf = + bson_iter_int32(&child5_iter); + } else if (!strcmp(child5_key, "spt") && + BSON_ITER_HOLDS_ARRAY(&child5_iter)) { + int spt_index = 0; + bson_iter_recurse(&child5_iter, &child6_iter); + while (bson_iter_next(&child6_iter)) { + ogs_assert(spt_index < OGS_MAX_NUM_OF_SPT); + bson_iter_recurse(&child6_iter, + &child7_iter); + while (bson_iter_next(&child7_iter)) { + const char *child7_key = + bson_iter_key(&child7_iter); + if (!strcmp(child7_key, + "condition_negated") && + BSON_ITER_HOLDS_INT32( + &child7_iter)) { + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .condition_negated = + bson_iter_int32( + &child7_iter); + } else if (!strcmp(child7_key, "group") + && BSON_ITER_HOLDS_INT32( + &child7_iter)) { + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .group = bson_iter_int32( + &child7_iter); + } else if (!strcmp(child7_key, + "method") && + BSON_ITER_HOLDS_UTF8( + &child7_iter)) { + utf8 = bson_iter_utf8(&child7_iter, + &length); + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .method = + ogs_strndup(utf8, length); + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .type = OGS_SPT_HAS_METHOD; + } else if (!strcmp(child7_key, + "session_case") && + BSON_ITER_HOLDS_INT32( + &child7_iter)) { + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .session_case = + bson_iter_int32( + &child7_iter); + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .type = + OGS_SPT_HAS_SESSION_CASE; + } else if (!strcmp(child7_key, + "sip_header") && + BSON_ITER_HOLDS_DOCUMENT( + &child7_iter)) { + bson_iter_recurse(&child7_iter, + &child8_iter); + while (bson_iter_next( + &child8_iter)) { + const char *child8_key = + bson_iter_key( + &child8_iter); + if (!strcmp(child8_key, + "header") && + BSON_ITER_HOLDS_UTF8( + &child8_iter)) { + utf8 = bson_iter_utf8( + &child8_iter, + &length); + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .header = + ogs_strndup(utf8, + length); + } else if (!strcmp(child8_key, + "content") && + BSON_ITER_HOLDS_UTF8( + &child8_iter)) { + utf8 = bson_iter_utf8( + &child8_iter, + &length); + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .header_content = + ogs_strndup(utf8, + length); + } + } + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .type = OGS_SPT_HAS_SIP_HEADER; + } else if (!strcmp(child7_key, + "sdp_line") && + BSON_ITER_HOLDS_DOCUMENT( + &child7_iter)) { + bson_iter_recurse(&child7_iter, + &child9_iter); + while (bson_iter_next( + &child9_iter)) { + const char *child9_key = + bson_iter_key( + &child9_iter); + if (!strcmp(child9_key, + "line") && + BSON_ITER_HOLDS_UTF8( + &child9_iter)) { + utf8 = bson_iter_utf8( + &child9_iter, + &length); + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .sdp_line = + ogs_strndup(utf8, + length); + } else if (!strcmp(child9_key, + "content") && + BSON_ITER_HOLDS_UTF8( + &child9_iter)) { + utf8 = bson_iter_utf8( + &child9_iter, + &length); + ims_data->ifcifc_index + .trigger_point + .sptspt_index + .sdp_line_content = + ogs_strndup(utf8, + length); + } + } + ims_data->ifcifc_index + .trigger_point
View file
open5gs_2.7.5.tar.xz/lib/diameter/s6a/message.c -> open5gs_2.7.6.tar.xz/lib/diameter/s6a/message.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -92,6 +92,10 @@ struct dict_object *ogs_diam_s6a_msisdn = NULL; struct dict_object *ogs_diam_s6a_a_msisdn = NULL; +struct dict_object *ogs_diam_s6a_supported_features = NULL; +struct dict_object *ogs_diam_s6a_feature_list_id = NULL; +struct dict_object *ogs_diam_s6a_feature_list = NULL; + extern int ogs_dict_s6a_entry(char *conffile); int ogs_diam_s6a_init(void) @@ -176,5 +180,9 @@ CHECK_dict_search(DICT_AVP, AVP_BY_NAME_ALL_VENDORS, "MSISDN", &ogs_diam_s6a_msisdn); CHECK_dict_search(DICT_AVP, AVP_BY_NAME_ALL_VENDORS, "A-MSISDN", &ogs_diam_s6a_a_msisdn); + CHECK_dict_search(DICT_AVP, AVP_BY_NAME_ALL_VENDORS, "Supported-Features", &ogs_diam_s6a_supported_features); + CHECK_dict_search(DICT_AVP, AVP_BY_NAME_ALL_VENDORS, "Feature-List-ID", &ogs_diam_s6a_feature_list_id); + CHECK_dict_search(DICT_AVP, AVP_BY_NAME_ALL_VENDORS, "Feature-List", &ogs_diam_s6a_feature_list); + return 0; }
View file
open5gs_2.7.5.tar.xz/lib/diameter/s6a/message.h -> open5gs_2.7.6.tar.xz/lib/diameter/s6a/message.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -71,7 +71,7 @@ #define OGS_DIAM_S6A_CT_MME_UPDATE_PROCEDURE (0) #define OGS_DIAM_S6A_CT_SGSN_UPDATE_PROCEDURE (1) -#define OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWL (2) +#define OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWAL (2) #define OGS_DIAM_S6A_CT_UPDATE_PROCEDURE_IWF (3) #define OGS_DIAM_S6A_CT_INITIAL_ATTACH_PROCEDURE (4) @@ -159,6 +159,10 @@ extern struct dict_object *ogs_diam_s6a_msisdn; extern struct dict_object *ogs_diam_s6a_a_msisdn; +extern struct dict_object *ogs_diam_s6a_supported_features; +extern struct dict_object *ogs_diam_s6a_feature_list_id; +extern struct dict_object *ogs_diam_s6a_feature_list; + typedef struct ogs_diam_e_utran_vector_s { uint8_t xresOGS_MAX_RES_LEN; uint8_t xres_len;
View file
open5gs_2.7.5.tar.xz/lib/gtp/context.c -> open5gs_2.7.6.tar.xz/lib/gtp/context.c
Changed
@@ -481,11 +481,18 @@ rv = ogs_filteraddrinfo(&adv_addr6, AF_INET6); ogs_assert(rv == OGS_OK); + if (adv_addr || adv_addr6) { + rv = ogs_sockaddr_to_ip( + adv_addr, adv_addr6, + &self.gtpu_ip); + ogs_assert(rv == OGS_OK); + } + /* Find first IPv4/IPv6 address in the list. * * In the following configuration, * 127.0.0.4, 127.0.0.5 and 2001:db8:cafe::1 are ignored - * on PFCP Assocation Response message's + * on PFCP Association Response message's * user plane IP resource information. * * gtpu:
View file
open5gs_2.7.5.tar.xz/lib/gtp/path.h -> open5gs_2.7.6.tar.xz/lib/gtp/path.h
Changed
@@ -57,9 +57,10 @@ \ ogs_assert(ogs_gtp_self()->gtpu_addr || ogs_gtp_self()->gtpu_addr6); \ \ - ogs_sockaddr_to_ip( \ - ogs_gtp_self()->gtpu_addr, ogs_gtp_self()->gtpu_addr6, \ - &ogs_gtp_self()->gtpu_ip); \ + if (!ogs_gtp_self()->gtpu_ip.ipv4 && !ogs_gtp_self()->gtpu_ip.ipv6) \ + ogs_sockaddr_to_ip( \ + ogs_gtp_self()->gtpu_addr, ogs_gtp_self()->gtpu_addr6, \ + &ogs_gtp_self()->gtpu_ip); \ } while(0) ogs_sock_t *ogs_gtp_server(ogs_socknode_t *node);
View file
open5gs_2.7.5.tar.xz/lib/ipfw/ipfw2.c -> open5gs_2.7.6.tar.xz/lib/ipfw/ipfw2.c
Changed
@@ -73,6 +73,10 @@ int ipfw_socket = -1; +#if 1 /* modifed by acetcom */ +#define errx(eval, ...) ogs_log_message(OGS_LOG_ERROR, 0, __VA_ARGS__) +#endif + #define CHECK_LENGTH(v, len) do { \ if ((v) < (len)) \ errx(EX_DATAERR, "Rule too long"); \
View file
open5gs_2.7.5.tar.xz/lib/ipfw/ogs-ipfw.c -> open5gs_2.7.6.tar.xz/lib/ipfw/ogs-ipfw.c
Changed
@@ -79,7 +79,7 @@ /* ADDR */ i = 2; token = ogs_strtok_r(NULL, " ", &saveptr); - while (token != NULL) { + while ((token != NULL) && (i < (MAX_NUM_OF_TOKEN-2))) { avi++ = token; token = ogs_strtok_r(NULL, " ", &saveptr); }
View file
open5gs_2.7.5.tar.xz/lib/pfcp/types.c -> open5gs_2.7.6.tar.xz/lib/pfcp/types.c
Changed
@@ -304,7 +304,7 @@ int16_t ogs_pfcp_parse_sdf_filter( ogs_pfcp_sdf_filter_t *filter, ogs_tlv_octet_t *octet) { - int16_t size = 0; + uint32_t size = 0; ogs_assert(filter); ogs_assert(octet);
View file
open5gs_2.7.5.tar.xz/lib/pfcp/util.c -> open5gs_2.7.6.tar.xz/lib/pfcp/util.c
Changed
@@ -194,7 +194,8 @@ goto done; } - memcpy(node_id, tlv_node_id->data, tlv_node_id->len); + memcpy(node_id, tlv_node_id->data, ogs_min(tlv_node_id->len, sizeof(ogs_pfcp_node_id_t))); + node_id->fqdnOGS_MAX_FQDN_LEN - 1 = '\0'; if (node_id->type != OGS_PFCP_NODE_ID_IPV4 && node_id->type != OGS_PFCP_NODE_ID_IPV6 &&
View file
open5gs_2.7.5.tar.xz/lib/proto/types.c -> open5gs_2.7.6.tar.xz/lib/proto/types.c
Changed
@@ -480,7 +480,7 @@ i++; } pco->num_of_id = i; - ogs_assert(size == data_len); + ogs_expect(size == data_len); return size; }
View file
open5gs_2.7.5.tar.xz/lib/proto/types.h -> open5gs_2.7.6.tar.xz/lib/proto/types.h
Changed
@@ -955,6 +955,97 @@ int num_of_sub; } ogs_media_component_t; +#define OGS_MAX_NUM_OF_SPT 20 +#define OGS_MAX_NUM_OF_IFC 20 + +/* + * Defines matching mechanism type of SPT + */ +typedef enum { + OGS_SPT_INVALID_TYPE, + OGS_SPT_HAS_METHOD, + OGS_SPT_HAS_SESSION_CASE, + OGS_SPT_HAS_SIP_HEADER, + OGS_SPT_HAS_SDP_LINE, + OGS_SPT_HAS_REQUEST_URI, +} ogs_spt_type_e; + +/************************************************** + * Service Point Trigger Structure (SPT) */ +typedef struct ogs_spt_s { + /* Matching mechanism type of SPT */ + ogs_spt_type_e type; + /* Indicates if the Service Point Trigger instance is negated */ + int condition_negated; + /* The SPT group or list of SPT groups assigned to the SPT */ + int group; + /* The method of the SIP request */ + const char *method; + /* The direction of the SIP request as evaluated by the S-CSCF */ + int session_case; + /* A header in the SIP request*/ + const char *header; + /* Optionally the value of the header in the SIP request */ + const char *header_content; + /* A SDP line within the body (if any) of a SIP request */ + const char *sdp_line; + /* Optionally the value in the SDP line of a SIP request */ + const char *sdp_line_content; + /* The request-URI of the SIP request */ + const char *request_uri; +} ogs_spt_t; + +/* + * Defines what logical operators should be used between SPTs belonging to + * different groups + */ +typedef enum { + OGS_DISJUNCTIVE_NORMAL_FORMAT, /* an ORed set of ANDed subsets */ + OGS_CONJUNCTIVE_NORMAL_FORMAT /* an ANDed set of ORed subsets */ +} ogs_condition_type_cnf_e; + +/************************************************** + * Trigger Point Structure + * Each TriggerPoint is made up of Service Point Trigger (SPTs) which are + * individual rules that are matched or not matched, that are either combined + * as logical AND or logical OR statements when evaluated. + */ +typedef struct ogs_trigger_point_s { + int num_of_spt; + ogs_condition_type_cnf_e condition_type_cnf; + ogs_spt_t sptOGS_MAX_NUM_OF_SPT; +} ogs_trigger_point_t; + +/************************************************** + * Application Server Structure */ +typedef struct ogs_application_server_s { + const char *server_name; + int default_handling; +} ogs_application_server_t; + +/************************************************** + * IFC Structure + * 3GPP TS 29.562 + */ +typedef struct ogs_ifc_s { + /* + * The priority of the IFC. + * The higher the Priority Number the lower the priority of the Filter + * Criteria is + */ + int priority; + /* + * The conditions that should be checked to find out + * if the indicated Application Server should be contacted or not + */ + ogs_trigger_point_t trigger_point; + /* + * the Application Server which shall be triggered + * if the conditions are met + */ + ogs_application_server_t application_server; +} ogs_ifc_t; + typedef struct ogs_ims_data_s { int num_of_msisdn; struct { @@ -966,6 +1057,9 @@ #define OGS_MAX_NUM_OF_MEDIA_COMPONENT 16 ogs_media_component_t media_componentOGS_MAX_NUM_OF_MEDIA_COMPONENT; int num_of_media_component; + + int num_of_ifc; + ogs_ifc_t ifcOGS_MAX_NUM_OF_IFC; } ogs_ims_data_t; void ogs_ims_data_free(ogs_ims_data_t *ims_data);
View file
open5gs_2.7.5.tar.xz/lib/sbi/client.c -> open5gs_2.7.6.tar.xz/lib/sbi/client.c
Changed
@@ -161,7 +161,7 @@ curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, client); curl_multi_setopt(multi, CURLMOPT_TIMERFUNCTION, multi_timer_cb); curl_multi_setopt(multi, CURLMOPT_TIMERDATA, client); -#ifdef CURLMOPT_MAX_CONCURRENT_STREAMS +#if CURL_AT_LEAST_VERSION(7,67,0) curl_multi_setopt(multi, CURLMOPT_MAX_CONCURRENT_STREAMS, ogs_app()->pool.stream); #endif @@ -754,7 +754,7 @@ } } else - ogs_warn("%d %s", res, conn->error); + ogs_warn("%s (%d): %s", curl_easy_strerror(res), res, conn->error); ogs_assert(conn->client_cb); if (res == CURLE_OK)
View file
open5gs_2.7.5.tar.xz/lib/sbi/context.c -> open5gs_2.7.6.tar.xz/lib/sbi/context.c
Changed
@@ -2433,8 +2433,12 @@ ogs_assert(sbi_object); - if (ogs_list_count(&sbi_object->xact_list)) + if (ogs_list_count(&sbi_object->xact_list)) { + ogs_sbi_xact_t *xact = NULL; \ ogs_error("SBI running %d", ogs_list_count(&sbi_object->xact_list)); + ogs_list_for_each(&sbi_object->xact_list, xact) + OGS_SBI_XACT_LOG(xact); + } for (i = 0; i < OGS_SBI_MAX_NUM_OF_SERVICE_TYPE; i++) { if (sbi_object->service_type_arrayi.nf_instance_id)
View file
open5gs_2.7.5.tar.xz/lib/sbi/context.h -> open5gs_2.7.6.tar.xz/lib/sbi/context.h
Changed
@@ -225,6 +225,35 @@ typedef ogs_sbi_request_t *(*ogs_sbi_build_f)( void *context, void *data); +#define OGS_SBI_XACT_LOG(xact) \ + do { \ + ogs_error(" requester-nf-type%s:%d", \ + OpenAPI_nf_type_ToString((xact)->requester_nf_type), \ + (xact)->requester_nf_type); \ + ogs_error(" service-name%s:%d", \ + ogs_sbi_service_type_to_name((xact)->service_type), \ + (xact)->service_type); \ + if ((xact)->request) { \ + int i; \ + ogs_sbi_request_t *request = (xact)->request; \ + if (request->h.method) \ + ogs_error(" h.method%s", request->h.method); \ + if (request->h.uri) \ + ogs_error(" h.uri%s", request->h.uri); \ + if (request->h.service.name) \ + ogs_error(" h.service.name%s", request->h.service.name); \ + if (request->h.api.version) \ + ogs_error(" h.api.version%s", request->h.api.version); \ + for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT && \ + request->h.resource.componenti; i++) \ + ogs_error(" h.resource.component%s:%d", \ + request->h.resource.componenti, i); \ + ogs_error(" http.content_length%d", \ + (int)request->http.content_length); \ + if (request->http.content) \ + ogs_error(" http.content%s", request->http.content); \ + } \ + } while(0) typedef struct ogs_sbi_xact_s { ogs_lnode_t lnode;
View file
open5gs_2.7.5.tar.xz/lib/sbi/custom/links.c -> open5gs_2.7.6.tar.xz/lib/sbi/custom/links.c
Changed
@@ -45,7 +45,7 @@ linksJSON = cJSON_CreateObject(); ogs_assert(linksJSON); - cJSON_AddItemToObject(linksJSON, "items", itemsJSON); + cJSON_AddItemToObject(linksJSON, "item", itemsJSON); cJSON_AddItemToObject(linksJSON, "self", selfJSON); cJSON_AddNumberToObject(linksJSON, "totalItemCount", cJSON_GetArraySize(itemsJSON)); @@ -73,9 +73,9 @@ return NULL; } - _items = cJSON_GetObjectItemCaseSensitive(_links, "items"); + _items = cJSON_GetObjectItemCaseSensitive(_links, "item"); if (!_items) { - ogs_error("No items"); + ogs_error("No item"); return NULL; }
View file
open5gs_2.7.5.tar.xz/lib/sbi/message.c -> open5gs_2.7.6.tar.xz/lib/sbi/message.c
Changed
@@ -2815,6 +2815,11 @@ ogs_assert(message); ogs_assert(http); + if (!http->content) { + ogs_error("HTTP content NULL %d", (int)http->content_length); + return OGS_ERROR; + } + memset(&settings, 0, sizeof(settings)); settings.on_header_field = &on_header_field; settings.on_header_value = &on_header_value;
View file
open5gs_2.7.5.tar.xz/lib/sbi/nghttp2-server.c -> open5gs_2.7.6.tar.xz/lib/sbi/nghttp2-server.c
Changed
@@ -1762,9 +1762,12 @@ ogs_assert(sbi_sess); if (ogs_list_empty(&sbi_sess->write_queue) == true) { - ogs_assert(sbi_sess->poll.write); - ogs_pollset_remove(sbi_sess->poll.write); - sbi_sess->poll.write = NULL; + if (sbi_sess->poll.write) { + ogs_pollset_remove(sbi_sess->poll.write); + sbi_sess->poll.write = NULL; + } else + ogs_warn("poll.write has already been removed"); + return; }
View file
open5gs_2.7.5.tar.xz/lib/tun/mac-setup.c -> open5gs_2.7.6.tar.xz/lib/tun/mac-setup.c
Changed
@@ -250,6 +250,8 @@ commandLine4 = "up"; commandLine5 = NULL; + memset(&process, 0, sizeof(process)); + ret = ogs_proc_create(commandLine, 0, &process); ogs_assert(ret == 0);
View file
open5gs_2.7.5.tar.xz/meson.build -> open5gs_2.7.6.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.7.5', + version : '2.7.6', license : 'AGPL-3.0-or-later', meson_version : '>= 0.43.0', default_options : @@ -25,7 +25,7 @@ , ) -libogslib_version = '2.7.5' +libogslib_version = '2.7.6' prefix = get_option('prefix') bindir = join_paths(prefix, get_option('bindir'))
View file
open5gs_2.7.5.tar.xz/src/amf/amf-sm.c -> open5gs_2.7.6.tar.xz/src/amf/amf-sm.c
Changed
@@ -78,6 +78,9 @@ ogs_sbi_response_t *sbi_response = NULL; ogs_sbi_message_t sbi_message; + OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL; + ogs_sbi_discovery_option_t *discovery_option = NULL; + amf_sm_debug(e); ogs_assert(s); @@ -329,10 +332,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &sbi_message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &sbi_message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) @@ -410,9 +436,11 @@ CASE(OGS_SBI_HTTP_METHOD_GET) if (sbi_message.res_status == OGS_SBI_HTTP_STATUS_OK) amf_nnrf_handle_nf_discover(sbi_xact, &sbi_message); - else + else { ogs_error("HTTP response error %d", sbi_message.res_status); + amf_nnrf_handle_failed_amf_discovery(sbi_xact); + } break; DEFAULT @@ -737,6 +765,8 @@ sbi_object_id <= OGS_MAX_POOL_ID); service_type = sbi_xact->service_type; + requester_nf_type = sbi_xact->requester_nf_type; + discovery_option = sbi_xact->discovery_option; ogs_sbi_xact_remove(sbi_xact); @@ -751,7 +781,35 @@ break; } - ogs_error("%s Cannot receive SBI message", amf_ue->suci); + ogs_error("%s:%s Cannot receive SBI message", + amf_ue->supi, amf_ue->suci); + + /* + * TS 23.502 + * 4.2.2.2.2 General Registration + * If the SUCI is not provided by the UE nor retrieved from the old AMF the Identity Request + * procedure is initiated by AMF sending an Identity Request message to the UE requesting the SUCI. + */ + + if (amf_ue->nas.message_type == OGS_NAS_5GS_REGISTRATION_REQUEST && + amf_ue->nas.registration.value == OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL && + requester_nf_type == OpenAPI_nf_type_AMF && + discovery_option->guami_presence) { + + amf_ue->amf_ue_context_transfer_state = + UE_CONTEXT_INITIAL_STATE; + + if (!(AMF_UE_HAVE_SUCI(amf_ue) || + AMF_UE_HAVE_SUPI(amf_ue))) { + CLEAR_AMF_UE_TIMER(amf_ue->t3570); + rv = nas_5gs_send_identity_request(amf_ue); + ogs_expect(rv == OGS_OK); + ogs_assert(rv != OGS_ERROR); + + break; + } + } + r = nas_5gs_send_gmm_reject_from_sbi(amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); ogs_expect(r == OGS_OK); @@ -771,8 +829,31 @@ break; } - ogs_error("%d:%d Cannot receive SBI message", - sess->psi, sess->pti); + ogs_error("%s:%s:%d:%d Cannot receive SBI message", + amf_ue->supi, amf_ue->suci, sess->psi, sess->pti); + + ran_ue = ran_ue_find_by_id(sess->ran_ue_id); + if (!ran_ue) { + ogs_error("%s:%s:%d:%d " + "NG Context has already been removed", + amf_ue->supi, amf_ue->suci, sess->psi, sess->pti); + break; + } + + if (ran_ue->amf_ue_id == OGS_INVALID_POOL_ID) { + ogs_error("%s:%s:%d:%d " + "RAN-UE has already been deassociated", + amf_ue->supi, amf_ue->suci, sess->psi, sess->pti); + break; + } + + if (amf_ue->id != ran_ue->amf_ue_id) { + ogs_error("%s:%s:%d:%d AMF-UE mismatched %d!=%d", + amf_ue->supi, amf_ue->suci, sess->psi, sess->pti, + amf_ue->id, ran_ue->amf_ue_id); + break; + } + if (sess->payload_container_type) { r = nas_5gs_send_back_gsm_message( ran_ue_find_by_id(sess->ran_ue_id), sess,
View file
open5gs_2.7.5.tar.xz/src/amf/context.c -> open5gs_2.7.6.tar.xz/src/amf/context.c
Changed
@@ -977,12 +977,14 @@ ogs_yaml_iter_value(&network_name_iter); uint8_t size = strlen(c_network_name); uint8_t i; - for (i = 0;i<size;i++) { + for (i = 0; i < size && + (((i * 2) + 1) < + (OGS_NAS_MAX_NETWORK_NAME_LEN - 1)); + i++) { /* Workaround to convert the ASCII to USC-2 */ - network_full_name->namei*2 = 0; - network_full_name->name(i*2)+1 = + network_full_name->namei * 2 = 0; + network_full_name->namei * 2 + 1 = c_network_namei; - } network_full_name->length = size*2+1; network_full_name->coding_scheme = 1; @@ -994,12 +996,14 @@ ogs_yaml_iter_value(&network_name_iter); uint8_t size = strlen(c_network_name); uint8_t i; - for (i = 0;i<size;i++) { + for (i = 0; i < size && + (((i * 2) + 1) < + (OGS_NAS_MAX_NETWORK_NAME_LEN - 1)); + i++) { /* Workaround to convert the ASCII to USC-2 */ - network_short_name->namei*2 = 0; - network_short_name->name(i*2)+1 = + network_short_name->namei * 2 = 0; + network_short_name->namei * 2 + 1 = c_network_namei; - } network_short_name->length = size*2+1; network_short_name->coding_scheme = 1; @@ -1769,7 +1773,7 @@ ogs_list_count(&amf_ue->sbi.xact_list)); ogs_sbi_object_free(&amf_ue->sbi); - amf_ue_deassociate(amf_ue); + amf_ue->ran_ue_id = OGS_INVALID_POOL_ID; ogs_pool_id_free(&amf_ue_pool, amf_ue); @@ -2227,16 +2231,16 @@ ran_ue->amf_ue_id = amf_ue->id; } -void ran_ue_deassociate(ran_ue_t *ran_ue) +void amf_ue_deassociate_ran_ue(amf_ue_t *amf_ue, ran_ue_t *ran_ue) { + ogs_assert(amf_ue); ogs_assert(ran_ue); - ran_ue->amf_ue_id = OGS_INVALID_POOL_ID; -} -void amf_ue_deassociate(amf_ue_t *amf_ue) -{ - ogs_assert(amf_ue); - amf_ue->ran_ue_id = OGS_INVALID_POOL_ID; + if (amf_ue->ran_ue_id == ran_ue->id) + amf_ue->ran_ue_id = OGS_INVALID_POOL_ID; + else + ogs_error("Cannot deassociate amf_ue->ran_ue_id%d != ran_ue->id%d", + amf_ue->ran_ue_id, ran_ue->id); } void source_ue_associate_target_ue( @@ -2970,6 +2974,12 @@ amf_ue->rejected_nssai.num_of_s_nssai = 0; if (amf_ue->requested_nssai.num_of_s_nssai) { + + if (amf_ue->num_of_slice == 0) { + ogs_error("%s No Slice in Subscription DB", amf_ue->supi); + return false; + } + for (i = 0; i < amf_ue->requested_nssai.num_of_s_nssai; i++) { ogs_slice_data_t *slice = NULL; ogs_nas_s_nssai_ie_t *requested = @@ -2982,7 +2992,6 @@ s_nssaiamf_ue->rejected_nssai.num_of_s_nssai; bool ta_supported = false; - ogs_assert(amf_ue->num_of_slice); slice = ogs_slice_find_by_s_nssai( amf_ue->slice, amf_ue->num_of_slice, (ogs_s_nssai_t *)requested);
View file
open5gs_2.7.5.tar.xz/src/amf/context.h -> open5gs_2.7.6.tar.xz/src/amf/context.h
Changed
@@ -542,7 +542,7 @@ \ ran_ue_holding = ran_ue_find_by_id((__aMF)->ran_ue_id); \ if (ran_ue_holding) { \ - ran_ue_deassociate(ran_ue_holding); \ + ran_ue_holding->amf_ue_id = OGS_INVALID_POOL_ID; \ \ ogs_warn("%s Holding NG Context", (__aMF)->suci); \ ogs_warn("%s RAN_UE_NGAP_ID%lld AMF_UE_NGAP_ID%lld", \ @@ -1014,8 +1014,7 @@ * - Delete Indirect Data Forwarding Tunnel Request/Response */ void amf_ue_associate_ran_ue(amf_ue_t *amf_ue, ran_ue_t *ran_ue); -void ran_ue_deassociate(ran_ue_t *ran_ue); -void amf_ue_deassociate(amf_ue_t *amf_ue); +void amf_ue_deassociate_ran_ue(amf_ue_t *amf_ue, ran_ue_t *ran_ue); void source_ue_associate_target_ue(ran_ue_t *source_ue, ran_ue_t *target_ue); void source_ue_deassociate_target_ue(ran_ue_t *ran_ue); @@ -1033,8 +1032,11 @@ ogs_assert(sbi_object); \ \ if (ogs_list_count(&sbi_object->xact_list)) { \ + ogs_sbi_xact_t *xact = NULL; \ ogs_error("SBI running %d", \ ogs_list_count(&sbi_object->xact_list)); \ + ogs_list_for_each(&sbi_object->xact_list, xact) \ + OGS_SBI_XACT_LOG(xact); \ } else { \ amf_sess_remove(__sESS); \ } \
View file
open5gs_2.7.5.tar.xz/src/amf/gmm-handler.c -> open5gs_2.7.6.tar.xz/src/amf/gmm-handler.c
Changed
@@ -39,6 +39,7 @@ ogs_nas_5gs_registration_request_t *registration_request) { int served_tai_index = 0; + int i; uint8_t gmm_cause; ran_ue_t *ran_ue = NULL; @@ -164,6 +165,14 @@ ogs_nas_to_plmn_id(&amf_ue->home_plmn_id, &mobile_identity_suci->nas_plmn_id); + for (i = 0; i < amf_self()->num_of_served_guami; i++) { + if (!memcmp(&amf_ue->home_plmn_id, + &amf_self()->served_guamii.plmn_id, + sizeof(amf_ue->home_plmn_id))) { + amf_ue->guami = &amf_self()->served_guamii; + } + } + gmm_cause = gmm_cause_from_access_control(&amf_ue->home_plmn_id); if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) { ogs_error("Rejected by PLMN-ID access control"); @@ -1358,8 +1367,8 @@ } if (!selected_slice || !sess->dnn) { - ogs_warn("%s DNN Not Supported OR " - "Not Subscribed in the Slice", amf_ue->supi); + ogs_warn("%s Ue requested DNN \"%s\" Not Supported OR " + "Not Subscribed in the Slice", amf_ue->supi, dnn->value); r = nas_5gs_send_gmm_status(amf_ue, OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE); ogs_expect(r == OGS_OK);
View file
open5gs_2.7.5.tar.xz/src/amf/gmm-sm.c -> open5gs_2.7.6.tar.xz/src/amf/gmm-sm.c
Changed
@@ -285,10 +285,10 @@ SWITCH(sbi_message->h.method) CASE(OGS_SBI_HTTP_METHOD_POST) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_PUT) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_DELETE) CLEAR_5G_AKA_CONFIRMATION(amf_ue); @@ -343,7 +343,7 @@ CASE(OGS_SBI_RESOURCE_NAME_5G_AKA) CASE(OGS_SBI_RESOURCE_NAME_5G_AKA_CONFIRMATION) CASE(OGS_SBI_RESOURCE_NAME_EAP_SESSION) - ogs_warn("%s Ignore SBI message", amf_ue->supi); + ogs_error("%s Ignore SBI message", amf_ue->supi); break; DEFAULT @@ -365,7 +365,7 @@ CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) - ogs_warn("%s Ignore SBI message", amf_ue->supi); + ogs_error("%s Ignore SBI message", amf_ue->supi); break; CASE(OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS) @@ -407,7 +407,7 @@ } break; DEFAULT - ogs_warn("%s Ignore invalid HTTP method %s", + ogs_error("%s Ignore invalid HTTP method %s", amf_ue->suci, sbi_message->h.method); END break; @@ -431,7 +431,7 @@ CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS) SWITCH(sbi_message->h.method) CASE(OGS_SBI_HTTP_METHOD_PUT) - ogs_warn("%s Ignore SBI message", amf_ue->supi); + ogs_error("%s Ignore SBI message", amf_ue->supi); break; CASE(OGS_SBI_HTTP_METHOD_PATCH) SWITCH(sbi_message->h.resource.component2) @@ -486,7 +486,7 @@ } break; DEFAULT - ogs_warn("Ignoring invalid resource name %s", + ogs_error("Ignoring invalid resource name %s", sbi_message->h.resource.component2); END break; @@ -510,7 +510,11 @@ CASE(OGS_SBI_RESOURCE_NAME_POLICIES) SWITCH(sbi_message->h.method) CASE(OGS_SBI_HTTP_METHOD_POST) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED) { + ogs_error("%s HTTP response error %d", + amf_ue->supi, sbi_message->res_status); + } + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_DELETE) @@ -879,10 +883,10 @@ SWITCH(sbi_message->h.method) CASE(OGS_SBI_HTTP_METHOD_POST) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_PUT) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_DELETE) CLEAR_5G_AKA_CONFIRMATION(amf_ue); @@ -937,7 +941,7 @@ CASE(OGS_SBI_RESOURCE_NAME_5G_AKA) CASE(OGS_SBI_RESOURCE_NAME_5G_AKA_CONFIRMATION) CASE(OGS_SBI_RESOURCE_NAME_EAP_SESSION) - ogs_warn("%s Ignore SBI message", amf_ue->supi); + ogs_error("%s Ignore SBI message", amf_ue->supi); break; DEFAULT @@ -959,7 +963,7 @@ CASE(OGS_SBI_RESOURCE_NAME_AM_DATA) CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) - ogs_warn("%s Ignore SBI message", amf_ue->supi); + ogs_error("%s Ignore SBI message", amf_ue->supi); break; CASE(OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS) @@ -1031,7 +1035,7 @@ CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS) SWITCH(sbi_message->h.method) CASE(OGS_SBI_HTTP_METHOD_PUT) - ogs_warn("%s Ignore SBI message", amf_ue->supi); + ogs_error("%s Ignore SBI message", amf_ue->supi); break; CASE(OGS_SBI_HTTP_METHOD_PATCH) SWITCH(sbi_message->h.resource.component2) @@ -1125,7 +1129,11 @@ CASE(OGS_SBI_RESOURCE_NAME_POLICIES) SWITCH(sbi_message->h.method) CASE(OGS_SBI_HTTP_METHOD_POST) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED) { + ogs_error("%s HTTP response error %d", + amf_ue->supi, sbi_message->res_status); + } + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_DELETE) @@ -1312,7 +1320,15 @@ ogs_assert(nas_message); ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id); - ogs_assert(ran_ue); + if (!ran_ue) { + ogs_error("No NG Context SUPI%s NAS-Type%d " + "RAN-UE-ID%d:%p", + amf_ue->supi, nas_message->gmm.h.message_type, + amf_ue->ran_ue_id, ran_ue_find_by_id(amf_ue->ran_ue_id)); + ogs_assert(e->pkbuf); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; + } h.type = e->nas.type; @@ -1743,7 +1759,15 @@ ogs_assert(nas_message); ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id); - ogs_assert(ran_ue); + if (!ran_ue) { + ogs_error("No NG Context SUPI%s NAS-Type%d " + "RAN-UE-ID%d:%p", + amf_ue->supi, nas_message->gmm.h.message_type, + amf_ue->ran_ue_id, ran_ue_find_by_id(amf_ue->ran_ue_id)); + ogs_assert(e->pkbuf); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; + } h.type = e->nas.type; @@ -2023,7 +2047,7 @@ CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA) CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA) CASE(OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS) - ogs_warn("%s Ignore SBI message", amf_ue->supi); + ogs_error("%s Ignore SBI message", amf_ue->supi); break; DEFAULT @@ -2102,7 +2126,15 @@ ogs_assert(nas_message); ran_ue = ran_ue_find_by_id(amf_ue->ran_ue_id); - ogs_assert(ran_ue); + if (!ran_ue) { + ogs_error("No NG Context SUPI%s NAS-Type%d " + "RAN-UE-ID%d:%p", + amf_ue->supi, nas_message->gmm.h.message_type, + amf_ue->ran_ue_id, ran_ue_find_by_id(amf_ue->ran_ue_id)); + ogs_assert(e->pkbuf); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; + } h.type = e->nas.type; @@ -2295,13 +2327,13 @@ SWITCH(sbi_message->h.method) CASE(OGS_SBI_HTTP_METHOD_POST) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_PUT) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + ogs_error("%s Ignore SBI message", amf_ue->suci); break; CASE(OGS_SBI_HTTP_METHOD_DELETE) - ogs_warn("%s Ignore SBI message", amf_ue->suci); + ogs_error("%s Ignore SBI message", amf_ue->suci); break; DEFAULT
View file
open5gs_2.7.5.tar.xz/src/amf/init.c -> open5gs_2.7.6.tar.xz/src/amf/init.c
Changed
@@ -76,7 +76,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -128,7 +128,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/amf/namf-handler.c -> open5gs_2.7.6.tar.xz/src/amf/namf-handler.c
Changed
@@ -782,8 +782,6 @@ static int update_rat_res(OpenAPI_change_item_t *item_change, OpenAPI_list_t *restrictions) { - cJSON* json = item_change->new_value->json; - cJSON* json_restrictions; if (!item_change->path) { return OGS_ERROR; @@ -792,7 +790,18 @@ switch (item_change->op) { case OpenAPI_change_type_REPLACE: case OpenAPI_change_type_ADD: + { + cJSON *json; + + if ((!item_change->new_value) || (!item_change->new_value->json)) { + ogs_error("No 'new_value' field present"); + return OGS_ERROR; + } + json = item_change->new_value->json; + if (!strcmp(item_change->path, "")) { + cJSON *json_restrictions; + if (!cJSON_IsObject(json)) { ogs_error("Invalid type of am-data"); } @@ -813,6 +822,7 @@ return update_rat_res_add_one(json, restrictions, i); } return OGS_OK; + } case OpenAPI_change_type__REMOVE: if (!strcmp(item_change->path, "")) {
View file
open5gs_2.7.5.tar.xz/src/amf/nas-path.c -> open5gs_2.7.6.tar.xz/src/amf/nas-path.c
Changed
@@ -47,15 +47,17 @@ } int nas_5gs_send_to_downlink_nas_transport( - ran_ue_t *ran_ue, ogs_pkbuf_t *pkbuf) + ran_ue_t *ran_ue, amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf) { int rv; ogs_pkbuf_t *ngapbuf = NULL; ogs_assert(ran_ue); + ogs_assert(amf_ue); ogs_assert(pkbuf); - ngapbuf = ngap_build_downlink_nas_transport(ran_ue, pkbuf, false, false); + ngapbuf = ngap_build_downlink_nas_transport( + ran_ue, amf_ue, pkbuf, false, false); if (!ngapbuf) { ogs_error("ngap_build_downlink_nas_transport() failed"); return OGS_ERROR; @@ -163,7 +165,7 @@ ogs_expect(rv == OGS_OK); } else { ngapbuf = ngap_build_downlink_nas_transport( - ran_ue, gmmbuf, true, true); + ran_ue, amf_ue, gmmbuf, true, true); if (!ngapbuf) { ogs_error("ngap_build_downlink_nas_transport() failed"); return OGS_ERROR; @@ -216,7 +218,7 @@ return OGS_ERROR; } - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -295,7 +297,7 @@ rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf); ogs_expect(rv == OGS_OK); } else { - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); } } @@ -320,7 +322,7 @@ return OGS_ERROR; } - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -355,7 +357,7 @@ return OGS_ERROR; } - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); if (rv != OGS_OK) { ogs_error("nas_5gs_send_to_downlink_nas_transport() failed"); return rv; @@ -413,7 +415,7 @@ ogs_timer_start(amf_ue->t3522.timer, amf_timer_cfg(AMF_TIMER_T3522)->duration); - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -457,7 +459,7 @@ ogs_timer_start(amf_ue->t3570.timer, amf_timer_cfg(AMF_TIMER_T3570)->duration); - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -503,7 +505,7 @@ amf_metrics_inst_global_inc(AMF_METR_GLOB_CTR_AMF_AUTH_REQ); - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -536,7 +538,7 @@ amf_metrics_inst_global_inc(AMF_METR_GLOB_CTR_AMF_AUTH_REJECT); - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -580,7 +582,7 @@ ogs_timer_start(amf_ue->t3560.timer, amf_timer_cfg(AMF_TIMER_T3560)->duration); - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -643,7 +645,7 @@ amf_metrics_inst_global_inc(AMF_METR_GLOB_CTR_MM_CONF_UPDATE); - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -842,7 +844,7 @@ } else if (gmmbuf) { ogs_pkbuf_free(n2smbuf); ngapbuf = ngap_build_downlink_nas_transport( - ran_ue, gmmbuf, false, false); + ran_ue, amf_ue, gmmbuf, false, false); if (!ngapbuf) { ogs_error("ngap_build_downlink_nas_transport() failed"); return OGS_ERROR; @@ -900,7 +902,7 @@ return OGS_ERROR; } - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv; @@ -944,7 +946,7 @@ switch(status) { case OGS_SBI_HTTP_STATUS_NOT_FOUND: - gmm_cause = OGS_5GMM_CAUSE_PLMN_NOT_ALLOWED; + gmm_cause = OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED; break; case OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT: gmm_cause = OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED; @@ -1018,7 +1020,7 @@ ogs_error("gmm_build_dl_nas_transport() failed"); return OGS_ERROR; } - rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, gmmbuf); + rv = nas_5gs_send_to_downlink_nas_transport(ran_ue, amf_ue, gmmbuf); ogs_expect(rv == OGS_OK); return rv;
View file
open5gs_2.7.5.tar.xz/src/amf/nas-path.h -> open5gs_2.7.6.tar.xz/src/amf/nas-path.h
Changed
@@ -30,7 +30,7 @@ int nas_5gs_send_to_gnb(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf); int nas_5gs_send_to_downlink_nas_transport( - ran_ue_t *ran_ue, ogs_pkbuf_t *pkbuf); + ran_ue_t *ran_ue, amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf); int nas_5gs_send_registration_accept(amf_ue_t *amf_ue); int nas_5gs_send_registration_reject(
View file
open5gs_2.7.5.tar.xz/src/amf/ngap-build.c -> open5gs_2.7.6.tar.xz/src/amf/ngap-build.c
Changed
@@ -171,7 +171,6 @@ NGAP_NGSetupFailureIEs_t *ie = NULL; NGAP_Cause_t *Cause = NULL; - NGAP_TimeToWait_t *TimeToWait = NULL; ogs_debug(" Group%d Cause%d TimeToWait%ld", group, (int)cause, time_to_wait); @@ -189,17 +188,6 @@ NGSetupFailure = &unsuccessfulOutcome->value.choice.NGSetupFailure; - if (time_to_wait > -1) { - ie = CALLOC(1, sizeof(NGAP_NGSetupFailureIEs_t)); - ASN_SEQUENCE_ADD(&NGSetupFailure->protocolIEs, ie); - - ie->id = NGAP_ProtocolIE_ID_id_TimeToWait; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_NGSetupFailureIEs__value_PR_TimeToWait; - - TimeToWait = &ie->value.choice.TimeToWait; - } - ie = CALLOC(1, sizeof(NGAP_NGSetupFailureIEs_t)); ASN_SEQUENCE_ADD(&NGSetupFailure->protocolIEs, ie); @@ -211,8 +199,16 @@ Cause->present = group; Cause->choice.radioNetwork = cause; - if (TimeToWait) - *TimeToWait = time_to_wait; + if (time_to_wait > -1) { + ie = CALLOC(1, sizeof(NGAP_NGSetupFailureIEs_t)); + ASN_SEQUENCE_ADD(&NGSetupFailure->protocolIEs, ie); + + ie->id = NGAP_ProtocolIE_ID_id_TimeToWait; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_NGSetupFailureIEs__value_PR_TimeToWait; + + ie->value.choice.TimeToWait = time_to_wait; + } return ogs_ngap_encode(&pdu); } @@ -297,10 +293,9 @@ } ogs_pkbuf_t *ngap_build_downlink_nas_transport( - ran_ue_t *ran_ue, ogs_pkbuf_t *gmmbuf, bool ue_ambr, bool allowed_nssai) + ran_ue_t *ran_ue, amf_ue_t *amf_ue, + ogs_pkbuf_t *gmmbuf, bool ue_ambr, bool allowed_nssai) { - amf_ue_t *amf_ue = NULL; - NGAP_NGAP_PDU_t pdu; NGAP_InitiatingMessage_t *initiatingMessage = NULL; NGAP_DownlinkNASTransport_t *DownlinkNASTransport = NULL; @@ -314,7 +309,6 @@ ogs_assert(gmmbuf); ogs_assert(ran_ue); - amf_ue = amf_ue_find_by_id(ran_ue->amf_ue_id); ogs_assert(amf_ue); ogs_debug("DownlinkNASTransport"); @@ -1259,7 +1253,7 @@ &UE_NGAP_IDs->choice.aMF_UE_NGAP_ID, ran_ue->amf_ue_ngap_id); } else { UE_NGAP_IDs->present = NGAP_UE_NGAP_IDs_PR_uE_NGAP_ID_pair; - UE_NGAP_IDs->choice.uE_NGAP_ID_pair = + UE_NGAP_IDs->choice.uE_NGAP_ID_pair = CALLOC(1, sizeof(NGAP_UE_NGAP_ID_pair_t)); asn_uint642INTEGER( &UE_NGAP_IDs->choice.uE_NGAP_ID_pair->aMF_UE_NGAP_ID,
View file
open5gs_2.7.5.tar.xz/src/amf/ngap-build.h -> open5gs_2.7.6.tar.xz/src/amf/ngap-build.h
Changed
@@ -35,7 +35,8 @@ NGAP_Cause_PR group, long cause, long time_to_wait); ogs_pkbuf_t *ngap_build_downlink_nas_transport( - ran_ue_t *ran_ue, ogs_pkbuf_t *gmmbuf, bool ue_ambr, bool allowed_nssai); + ran_ue_t *ran_ue, amf_ue_t *amf_ue, + ogs_pkbuf_t *gmmbuf, bool ue_ambr, bool allowed_nssai); ogs_pkbuf_t *ngap_ue_build_initial_context_setup_request( amf_ue_t *amf_ue, ogs_pkbuf_t *gmmbuf);
View file
open5gs_2.7.5.tar.xz/src/amf/ngap-handler.c -> open5gs_2.7.6.tar.xz/src/amf/ngap-handler.c
Changed
@@ -1755,12 +1755,6 @@ break; case NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK: ogs_debug(" Action: NG normal release"); - ran_ue_remove(ran_ue); - if (!amf_ue) { - ogs_error("No UE(amf-ue) Context"); - return; - } - amf_ue_deassociate(amf_ue); /* * When AMF release the NAS signalling connection, @@ -1789,9 +1783,14 @@ * TODO: If the UE is registered for emergency services, the AMF shall * set the mobile reachable timer with a value equal to timer T3512. */ - ogs_timer_start(amf_ue->mobile_reachable.timer, - ogs_time_from_sec(amf_self()->time.t3512.value + 240)); + if (amf_ue) { + amf_ue_deassociate_ran_ue(amf_ue, ran_ue); + ogs_timer_start(amf_ue->mobile_reachable.timer, + ogs_time_from_sec(amf_self()->time.t3512.value + 240)); + } else + ogs_error("No UE(amf-ue) Context"); + ran_ue_remove(ran_ue); break; case NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE: @@ -4054,6 +4053,7 @@ { char bufOGS_ADDRSTRLEN; int i, r; + int xact_count; amf_ue_t *amf_ue = NULL; amf_sess_t *sess = NULL; @@ -4213,15 +4213,14 @@ ogs_expect(r == OGS_OK); ogs_assert(r != OGS_ERROR); + /* Save the number of ongoing SMF transactions before processing sessions */ + xact_count = amf_sess_xact_count(amf_ue); + ogs_list_for_each(&amf_ue->sess_list, sess) { if (!SESSION_CONTEXT_IN_SMF(sess)) { - ogs_error("Session Context is not in SMF %d", sess->psi); - r = ngap_send_error_indication2(source_ue, - NGAP_Cause_PR_radioNetwork, - NGAP_CauseRadioNetwork_partial_handover); - ogs_expect(r == OGS_OK); - ogs_assert(r != OGS_ERROR); - return; + /* Warn if this UE session is not handled by SMF and skip it */ + ogs_warn("Session Context is not in SMF %d", sess->psi); + continue; } memset(¶m, 0, sizeof(param)); @@ -4234,6 +4233,19 @@ ogs_expect(r == OGS_OK); ogs_assert(r != OGS_ERROR); } + + /* + * If no SMF sessions were processed (transaction count unchanged), + * send partial-handover error + */ + if (xact_count == amf_sess_xact_count(amf_ue)) { + ogs_error("No SMF session were processed %d", sess->psi); + r = ngap_send_error_indication2(source_ue, + NGAP_Cause_PR_radioNetwork, + NGAP_CauseRadioNetwork_partial_handover); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + } } void ngap_handle_ran_configuration_update(
View file
open5gs_2.7.5.tar.xz/src/amf/ngap-sctp.c -> open5gs_2.7.6.tar.xz/src/amf/ngap-sctp.c
Changed
@@ -243,14 +243,8 @@ ngap_event_push(AMF_EVENT_NGAP_MESSAGE, sock, addr, pkbuf, 0, 0); return; } else { - if (ogs_socket_errno != OGS_EAGAIN) { - ogs_fatal("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", - size, errno, strerror(errno), flags); - ogs_assert_if_reached(); - } else { - ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", - size, errno, strerror(errno), flags); - } + ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", + size, errno, strerror(errno), flags); } ogs_pkbuf_free(pkbuf);
View file
open5gs_2.7.5.tar.xz/src/amf/nnrf-handler.c -> open5gs_2.7.6.tar.xz/src/amf/nnrf-handler.c
Changed
@@ -49,6 +49,7 @@ SearchResult = recvmsg->SearchResult; if (!SearchResult) { ogs_error("No SearchResult"); + amf_nnrf_handle_failed_amf_discovery(xact); return; } @@ -70,8 +71,36 @@ case OGS_SBI_OBJ_UE_TYPE: amf_ue = (amf_ue_t *)sbi_object; ogs_assert(amf_ue); - ogs_error("%s (NF discover) No %s", amf_ue->suci, + ogs_warn("%s (NF discover) No %s", amf_ue->suci, ogs_sbi_service_type_to_name(service_type)); + + /* + * TS 23.502 + * 4.2.2.2.2 General Registration + * If the SUCI is not provided by the UE nor retrieved from the old AMF the Identity Request + * procedure is initiated by AMF sending an Identity Request message to the UE requesting the SUCI. + */ + + if (amf_ue->nas.message_type == OGS_NAS_5GS_REGISTRATION_REQUEST && + amf_ue->nas.registration.value == OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL && + requester_nf_type == OpenAPI_nf_type_AMF && + discovery_option->guami_presence) { + + amf_ue->amf_ue_context_transfer_state = + UE_CONTEXT_INITIAL_STATE; + + ogs_sbi_xact_remove(xact); + + if (!(AMF_UE_HAVE_SUCI(amf_ue) || + AMF_UE_HAVE_SUPI(amf_ue))) { + CLEAR_AMF_UE_TIMER(amf_ue->t3570); + r = nas_5gs_send_identity_request(amf_ue); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + break; + } + } + r = nas_5gs_send_gmm_reject_from_sbi(amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT); ogs_expect(r == OGS_OK); @@ -110,3 +139,62 @@ ogs_expect(true == amf_sbi_send_request(nf_instance, xact)); } + +void amf_nnrf_handle_failed_amf_discovery( + ogs_sbi_xact_t *sbi_xact) +{ + int r; + + OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL; + ogs_sbi_discovery_option_t *discovery_option = NULL; + ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL; + ogs_sbi_object_t *sbi_object = NULL; + amf_ue_t *amf_ue = NULL; + + ogs_assert(sbi_xact); + sbi_object = sbi_xact->sbi_object; + ogs_assert(sbi_object); + service_type = sbi_xact->service_type; + ogs_assert(service_type); + requester_nf_type = sbi_xact->requester_nf_type; + ogs_assert(requester_nf_type); + + discovery_option = sbi_xact->discovery_option; + + ogs_assert(sbi_object->type > OGS_SBI_OBJ_BASE && + sbi_object->type < OGS_SBI_OBJ_TOP); + + if (sbi_object->type == OGS_SBI_OBJ_UE_TYPE) { + + amf_ue = (amf_ue_t *)sbi_object; + ogs_assert(amf_ue); + + /* + * TS 23.502 + * 4.2.2.2.2 General Registration + * If the SUCI is not provided by the UE nor retrieved from the old AMF the Identity Request + * procedure is initiated by AMF sending an Identity Request message to the UE requesting the SUCI. + */ + + if (amf_ue->nas.message_type == OGS_NAS_5GS_REGISTRATION_REQUEST && + amf_ue->nas.registration.value == OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL && + requester_nf_type == OpenAPI_nf_type_AMF && + discovery_option->guami_presence) { + + amf_ue->amf_ue_context_transfer_state = + UE_CONTEXT_INITIAL_STATE; + + ogs_sbi_xact_remove(sbi_xact); + + if (!(AMF_UE_HAVE_SUCI(amf_ue) || + AMF_UE_HAVE_SUPI(amf_ue))) { + CLEAR_AMF_UE_TIMER(amf_ue->t3570); + r = nas_5gs_send_identity_request(amf_ue); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + } + } + } + + return; +}
View file
open5gs_2.7.5.tar.xz/src/amf/nnrf-handler.h -> open5gs_2.7.6.tar.xz/src/amf/nnrf-handler.h
Changed
@@ -28,6 +28,8 @@ void amf_nnrf_handle_nf_discover( ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg); +void amf_nnrf_handle_failed_amf_discovery( + ogs_sbi_xact_t *sbi_xact); #ifdef __cplusplus }
View file
open5gs_2.7.5.tar.xz/src/amf/npcf-build.c -> open5gs_2.7.6.tar.xz/src/amf/npcf-build.c
Changed
@@ -38,7 +38,6 @@ ogs_assert(amf_ue); ogs_assert(amf_ue->supi); - ogs_assert(ran_ue_find_by_id(amf_ue->ran_ue_id)); memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
View file
open5gs_2.7.5.tar.xz/src/amf/npcf-handler.c -> open5gs_2.7.6.tar.xz/src/amf/npcf-handler.c
Changed
@@ -94,7 +94,7 @@ } if (!message.h.resource.component1) { - ogs_error("%s No Assocation ID %s", + ogs_error("%s No Association ID %s", amf_ue->supi, recvmsg->http.location); ogs_sbi_header_free(&header);
View file
open5gs_2.7.5.tar.xz/src/amf/nsmf-build.c -> open5gs_2.7.6.tar.xz/src/amf/nsmf-build.c
Changed
@@ -42,7 +42,6 @@ amf_ue = amf_ue_find_by_id(sess->amf_ue_id); ogs_assert(amf_ue); ogs_assert(amf_ue->nas.access_type); - ogs_assert(ran_ue_find_by_id(amf_ue->ran_ue_id)); memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
View file
open5gs_2.7.5.tar.xz/src/amf/nsmf-handler.c -> open5gs_2.7.6.tar.xz/src/amf/nsmf-handler.c
Changed
@@ -586,15 +586,19 @@ * 6. UEContextReleaseComplete */ ogs_warn("PDUSessionResourceSetupResponse(Unsuccessful)"); - ogs_assert(ran_ue); - ogs_assert(ran_ue->deactivation.group); + if (ran_ue) { + ogs_assert(ran_ue->deactivation.group); - r = ngap_send_ran_ue_context_release_command(ran_ue, - ran_ue->deactivation.group, - ran_ue->deactivation.cause, - NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0); - ogs_expect(r == OGS_OK); - ogs_assert(r != OGS_ERROR); + r = ngap_send_ran_ue_context_release_command(ran_ue, + ran_ue->deactivation.group, + ran_ue->deactivation.cause, + NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + } else { + ogs_warn("%s RAN-NG Context has already been removed", + amf_ue->supi); + } } else if (state == AMF_UPDATE_SM_CONTEXT_MODIFIED) { /* @@ -625,15 +629,19 @@ */ if (AMF_SESSION_SYNC_DONE(amf_ue, state)) { - ogs_assert(ran_ue); - ogs_assert(ran_ue->deactivation.group); + if (ran_ue) { + ogs_assert(ran_ue->deactivation.group); - r = ngap_send_ran_ue_context_release_command(ran_ue, - ran_ue->deactivation.group, - ran_ue->deactivation.cause, - NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0); - ogs_expect(r == OGS_OK); - ogs_assert(r != OGS_ERROR); + r = ngap_send_ran_ue_context_release_command(ran_ue, + ran_ue->deactivation.group, + ran_ue->deactivation.cause, + NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + } else { + ogs_warn("%s RAN-NG Context has already been removed", + amf_ue->supi); + } } } else if (state == AMF_UPDATE_SM_CONTEXT_REGISTRATION_REQUEST) { @@ -759,10 +767,9 @@ } else if (state == AMF_REMOVE_S1_CONTEXT_BY_LO_CONNREFUSED) { if (AMF_SESSION_SYNC_DONE(amf_ue, state)) { - amf_ue_deassociate(amf_ue); - if (ran_ue) { ogs_debug(" SUPI%s", amf_ue->supi); + amf_ue_deassociate_ran_ue(amf_ue, ran_ue); ran_ue_remove(ran_ue); } else { ogs_warn("%s RAN-NG Context has already been removed", @@ -804,14 +811,13 @@ } else if (state == AMF_REMOVE_S1_CONTEXT_BY_RESET_ALL) { if (AMF_SESSION_SYNC_DONE(amf_ue, state)) { - amf_ue_deassociate(amf_ue); - if (ran_ue) { amf_gnb_t *gnb = NULL; gnb = amf_gnb_find_by_id(ran_ue->gnb_id); ogs_debug(" SUPI%s", amf_ue->supi); + amf_ue_deassociate_ran_ue(amf_ue, ran_ue); ran_ue_remove(ran_ue); if (gnb && ogs_list_count(&gnb->ran_ue_list) == 0) { @@ -861,14 +867,13 @@ if (AMF_SESSION_SYNC_DONE(amf_ue, state)) { ran_ue_t *iter = NULL; - amf_ue_deassociate(amf_ue); - if (ran_ue) { amf_gnb_t *gnb = NULL; gnb = amf_gnb_find_by_id(ran_ue->gnb_id); ogs_debug(" SUPI%s", amf_ue->supi); + amf_ue_deassociate_ran_ue(amf_ue, ran_ue); ran_ue_remove(ran_ue); if (gnb) { @@ -1380,8 +1385,15 @@ ogs_assert_if_reached(); } else if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_initial_context_setup)) { - ogs_fatal("Release SM Context in initial-context-setup"); - ogs_assert_if_reached(); + /* + * Issue #3946 + * avoid abort on SM context release in initial-setup state. + * + * Replace ogs_assert_if_reached() with ogs_error to log the invalid state + * and keep AMF running; logs error for debugging and improves availability. + */ + ogs_error("Invalid state transition: cannot release " + "SM Context during initial-context-setup"); } else if (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_registered)) { /* * 1. PDU session release request
View file
open5gs_2.7.5.tar.xz/src/amf/sbi-path.c -> open5gs_2.7.6.tar.xz/src/amf/sbi-path.c
Changed
@@ -463,8 +463,8 @@ new_xact_count = amf_sess_xact_count(amf_ue); if (old_xact_count == new_xact_count) { + amf_ue_deassociate_ran_ue(amf_ue, ran_ue); ran_ue_remove(ran_ue); - amf_ue_deassociate(amf_ue); } } else { ogs_warn("amf_sbi_send_deactivate_all_ue_in_gnb()");
View file
open5gs_2.7.5.tar.xz/src/ausf/ausf-sm.c -> open5gs_2.7.6.tar.xz/src/ausf/ausf-sm.c
Changed
@@ -215,10 +215,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) @@ -462,7 +485,7 @@ ogs_error("Cannot receive SBI message"); if (!stream) { - ogs_error("STREAM has alreadt been removed %d", + ogs_error("STREAM has already been removed %d", sbi_xact->assoc_stream_id); break; }
View file
open5gs_2.7.5.tar.xz/src/ausf/init.c -> open5gs_2.7.6.tar.xz/src/ausf/init.c
Changed
@@ -61,7 +61,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -108,7 +108,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/bsf/bsf-sm.c -> open5gs_2.7.6.tar.xz/src/bsf/bsf-sm.c
Changed
@@ -172,7 +172,8 @@ } if (!sess) { - ogs_error("Not found %s", message.h.uri); + ogs_error("Not found %s:%s", + message.h.method, message.h.uri); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_NOT_FOUND, @@ -233,10 +234,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
View file
open5gs_2.7.5.tar.xz/src/bsf/init.c -> open5gs_2.7.6.tar.xz/src/bsf/init.c
Changed
@@ -63,7 +63,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -111,7 +111,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/hss/hss-context.c -> open5gs_2.7.6.tar.xz/src/hss/hss-context.c
Changed
@@ -923,7 +923,7 @@ hss_impu_t *impu = NULL; bool barring_indication_presence = true; - int i; + int i, n, m; ogs_assert(user_name); ogs_assert(visited_network_identifier); @@ -1011,7 +1011,160 @@ ogs_assert(user_data); } - if(self.sms_over_ims) { + /* IFC data */ + for (n = 0; n < ims_data->num_of_ifc; n++) { + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_ifc_s); + ogs_assert(user_data); + + /* priority */ + user_data = ogs_mstrcatf(user_data, "%s%d%s", + ogs_diam_cx_xml_priority_s, + ims_data->ifcn.priority, + ogs_diam_cx_xml_priority_e); + ogs_assert(user_data); + + /* trigger point */ + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_tp_s); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s%d%s", + ogs_diam_cx_xml_cnf_s, + ims_data->ifcn.trigger_point.condition_type_cnf, + ogs_diam_cx_xml_cnf_e); + ogs_assert(user_data); + + /* SPTs */ + for (m = 0; m < ims_data->ifcn.trigger_point.num_of_spt; + m++) { + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_spt_s); + ogs_assert(user_data); + + /* condition negated */ + user_data = ogs_mstrcatf(user_data, "%s%d%s", + ogs_diam_cx_xml_condition_negated_s, + ims_data->ifcn.trigger_point.sptm. + condition_negated, + ogs_diam_cx_xml_condition_negated_e); + ogs_assert(user_data); + + /* group */ + user_data = ogs_mstrcatf(user_data, "%s%d%s", + ogs_diam_cx_xml_group_s, + ims_data->ifcn.trigger_point.sptm.group, + ogs_diam_cx_xml_group_e); + ogs_assert(user_data); + + /* method */ + if (ims_data->ifcn.trigger_point.sptm.type == + OGS_SPT_HAS_METHOD) { + user_data = ogs_mstrcatf(user_data, "%s%s%s", + ogs_diam_cx_xml_method_s, + ims_data->ifcn.trigger_point.sptm. + method, + ogs_diam_cx_xml_method_e); + ogs_assert(user_data); + } + + /* session case */ + if (ims_data->ifcn.trigger_point.sptm.type == + OGS_SPT_HAS_SESSION_CASE) { + user_data = ogs_mstrcatf(user_data, "%s%d%s", + ogs_diam_cx_xml_session_case_s, + ims_data->ifcn.trigger_point.sptm. + session_case, + ogs_diam_cx_xml_session_case_e); + ogs_assert(user_data); + } + + /* sip header */ + if (ims_data->ifcn.trigger_point.sptm.type == + OGS_SPT_HAS_SIP_HEADER) { + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_sip_hdr_s); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s%s%s", + ogs_diam_cx_xml_header_s, + ims_data->ifcn.trigger_point.sptm. + header, + ogs_diam_cx_xml_header_e); + ogs_assert(user_data); + + if (ims_data->ifcn.trigger_point.sptm. + header_content) { + user_data = ogs_mstrcatf(user_data, "%s%s%s", + ogs_diam_cx_xml_content_s, + ims_data->ifcn.trigger_point. + sptm.header_content, + ogs_diam_cx_xml_content_e); + ogs_assert(user_data); + } + + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_sip_hdr_e); + ogs_assert(user_data); + } + + /* request uri */ + if (ims_data->ifcn.trigger_point.sptm.type == + OGS_SPT_HAS_REQUEST_URI) { + user_data = ogs_mstrcatf(user_data, "%s%s%s", + ogs_diam_cx_xml_req_uri_s, + ims_data->ifcn.trigger_point.sptm. + request_uri, + ogs_diam_cx_xml_req_uri_e); + ogs_assert(user_data); + } + + /* extension */ + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_extension_s); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_extension_e); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_spt_e); + ogs_assert(user_data); + } + + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_tp_e); + ogs_assert(user_data); + + /* application server */ + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_app_server_s); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s%s%s", + ogs_diam_cx_xml_server_name_s, + ims_data->ifcn.application_server.server_name, + ogs_diam_cx_xml_server_name_e); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s%d%s", + ogs_diam_cx_xml_default_handling_s, + ims_data->ifcn.application_server. + default_handling, + ogs_diam_cx_xml_default_handling_e); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_app_server_e); + ogs_assert(user_data); + + user_data = ogs_mstrcatf(user_data, "%s", + ogs_diam_cx_xml_ifc_e); + ogs_assert(user_data); + } + + if (self.sms_over_ims) { user_data = ogs_mstrcatf(user_data, "%s", ogs_diam_cx_xml_ifc_s); ogs_assert(user_data); @@ -1378,7 +1531,7 @@ if (send_clr_flag) { ogs_info("%s Cancel Location Requested", imsi_bcd); hss_s6a_send_clr(imsi_bcd, NULL, NULL, - OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWL); + OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWAL); } else if (send_idr_flag) { ogs_info("%s Subscription-Data Changed", imsi_bcd); hss_s6a_send_idr(imsi_bcd, 0, subdatamask);
View file
open5gs_2.7.5.tar.xz/src/hss/hss-cx-path.c -> open5gs_2.7.6.tar.xz/src/hss/hss-cx-path.c
Changed
@@ -301,7 +301,7 @@ /* Check if IMPI(User-Name) + IMPU(Public-Identity) is associated */ matched = hss_cx_identity_is_associated(user_name, public_identity); if (!matched) { - ogs_error("User-Name%s Public-Identity%s is not assocated", + ogs_error("User-Name%s Public-Identity%s is not associated", user_name, public_identity); result_code = OGS_DIAM_CX_ERROR_IDENTITIES_DONT_MATCH; goto out; @@ -545,7 +545,7 @@ ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch); ogs_assert(ret == 0); - /* Set the Integirty-Key AVP */ + /* Set the Integrity-Key AVP */ ret = fd_msg_avp_new(ogs_diam_cx_integrity_key, 0, &avpch); ogs_assert(ret == 0); val.os.data = ik; @@ -686,7 +686,7 @@ /* Check if IMPI(User-Name) + IMPU(Public-Identity) is associated */ matched = hss_cx_identity_is_associated(user_name, public_identity); if (!matched) { - ogs_error("User-Name%s Public-Identity%s is not assocated", + ogs_error("User-Name%s Public-Identity%s is not associated", user_name, public_identity); result_code = OGS_DIAM_CX_ERROR_IDENTITIES_DONT_MATCH; goto out; @@ -717,7 +717,7 @@ visited_network_identifier = hss_cx_get_visited_network_identifier(public_identity); if (!visited_network_identifier) { - ogs_error("Cannot find Visted-Network-Identifier " + ogs_error("Cannot find Visited-Network-Identifier " "for User-Name%s Public-Identity%s", user_name, public_identity); result_code = OGS_DIAM_CX_ERROR_IDENTITY_NOT_REGISTERED;
View file
open5gs_2.7.5.tar.xz/src/hss/hss-init.c -> open5gs_2.7.6.tar.xz/src/hss/hss-init.c
Changed
@@ -99,7 +99,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/hss/hss-s6a-path.c -> open5gs_2.7.6.tar.xz/src/hss/hss-s6a-path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -974,6 +974,76 @@ ans, OGS_DIAM_S6A_APPLICATION_ID); ogs_assert(ret == 0); + /* + * AVP 628 Supported-Features + * AVP 629 Feature-List-ID: 1 + * AVP 630 Feature-List: (misc subscriber restrictions) + */ + ret = fd_msg_avp_new(ogs_diam_s6a_supported_features, 0, &avp); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_vendor_id, 0, &avpch1); + ogs_assert(ret == 0); + val.i32 = OGS_3GPP_VENDOR_ID; + ret = fd_msg_avp_setvalue (avpch1, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_feature_list_id, 0, &avpch1); + ogs_assert(ret == 0); + val.i32 = 1; + ret = fd_msg_avp_setvalue (avpch1, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_feature_list, 0, &avpch1); + ogs_assert(ret == 0); + val.u32 = 0x0000000b; + ret = fd_msg_avp_setvalue (avpch1, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); + ogs_assert(ret == 0); + + ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); + ogs_assert(ret == 0); + + /* + * AVP 628 Supported-Features + * AVP 629 Feature-List-ID: 2 + * AVP 630 Feature-List: (“NR as Secondary RAT: Supported”) + */ + ret = fd_msg_avp_new(ogs_diam_s6a_supported_features, 0, &avp); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_vendor_id, 0, &avpch1); + ogs_assert(ret == 0); + val.i32 = OGS_3GPP_VENDOR_ID; + ret = fd_msg_avp_setvalue (avpch1, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_feature_list_id, 0, &avpch1); + ogs_assert(ret == 0); + val.i32 = 2; + ret = fd_msg_avp_setvalue (avpch1, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); + ogs_assert(ret == 0); + + ret = fd_msg_avp_new(ogs_diam_s6a_feature_list, 0, &avpch1); + ogs_assert(ret == 0); + val.u32 = 0x08000001; + ret = fd_msg_avp_setvalue (avpch1, &val); + ogs_assert(ret == 0); + ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1); + ogs_assert(ret == 0); + + ret = fd_msg_avp_add(ans, MSG_BRW_LAST_CHILD, avp); + ogs_assert(ret == 0); + /* Send the answer */ ret = fd_msg_send(msg, NULL, NULL); ogs_assert(ret == 0); @@ -1270,7 +1340,7 @@ /* Set the CLR-Flags */ ret = fd_msg_avp_new(ogs_diam_s6a_clr_flags, 0, &avp); ogs_assert(ret == 0); - if (cancellation_type == OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWL) { + if (cancellation_type == OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWAL) { val.u32 = (OGS_DIAM_S6A_CLR_FLAGS_REATTACH_REQUIRED | OGS_DIAM_S6A_CLR_FLAGS_S6A_S6D_INDICATOR); } else {
View file
open5gs_2.7.5.tar.xz/src/hss/hss-swx-path.c -> open5gs_2.7.6.tar.xz/src/hss/hss-swx-path.c
Changed
@@ -317,7 +317,7 @@ ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avpch); ogs_assert(ret == 0); - /* Set the Integirty-Key AVP */ + /* Set the Integrity-Key AVP */ ret = fd_msg_avp_new(ogs_diam_cx_integrity_key, 0, &avpch); ogs_assert(ret == 0); val.os.data = ik;
View file
open5gs_2.7.5.tar.xz/src/mme/emm-sm.c -> open5gs_2.7.6.tar.xz/src/mme/emm-sm.c
Changed
@@ -337,15 +337,15 @@ enb_ue = enb_ue_find_by_id(mme_ue->enb_ue_id); if (!enb_ue) { - ogs_fatal("No S1 Context IMSI%s NAS-Type%d " + ogs_error("No S1 Context IMSI%s NAS-Type%d " "ENB-UE-ID%d:%d%p:%p", mme_ue->imsi_bcd, message->emm.h.message_type, e->enb_ue_id, mme_ue->enb_ue_id, enb_ue_find_by_id(e->enb_ue_id), enb_ue_find_by_id(mme_ue->enb_ue_id)); ogs_assert(e->pkbuf); - ogs_log_hexdump(OGS_LOG_FATAL, e->pkbuf->data, e->pkbuf->len); - ogs_assert_if_reached(); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; } h.type = e->nas_type; @@ -1106,7 +1106,17 @@ ogs_assert(message); enb_ue = enb_ue_find_by_id(mme_ue->enb_ue_id); - ogs_assert(enb_ue); + if (!enb_ue) { + ogs_error("No S1 Context IMSI%s NAS-Type%d " + "ENB-UE-ID%d:%d%p:%p", + mme_ue->imsi_bcd, message->emm.h.message_type, + e->enb_ue_id, mme_ue->enb_ue_id, + enb_ue_find_by_id(e->enb_ue_id), + enb_ue_find_by_id(mme_ue->enb_ue_id)); + ogs_assert(e->pkbuf); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; + } switch (message->emm.h.message_type) { case OGS_NAS_EPS_AUTHENTICATION_RESPONSE: @@ -1288,7 +1298,17 @@ ogs_assert(message); enb_ue = enb_ue_find_by_id(mme_ue->enb_ue_id); - ogs_assert(enb_ue); + if (!enb_ue) { + ogs_error("No S1 Context IMSI%s NAS-Type%d " + "ENB-UE-ID%d:%d%p:%p", + mme_ue->imsi_bcd, message->emm.h.message_type, + e->enb_ue_id, mme_ue->enb_ue_id, + enb_ue_find_by_id(e->enb_ue_id), + enb_ue_find_by_id(mme_ue->enb_ue_id)); + ogs_assert(e->pkbuf); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; + } if (message->emm.h.security_header_type == OGS_NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) { @@ -1528,7 +1548,17 @@ ogs_assert(message); enb_ue = enb_ue_find_by_id(mme_ue->enb_ue_id); - ogs_assert(enb_ue); + if (!enb_ue) { + ogs_error("No S1 Context IMSI%s NAS-Type%d " + "ENB-UE-ID%d:%d%p:%p", + mme_ue->imsi_bcd, message->emm.h.message_type, + e->enb_ue_id, mme_ue->enb_ue_id, + enb_ue_find_by_id(e->enb_ue_id), + enb_ue_find_by_id(mme_ue->enb_ue_id)); + ogs_assert(e->pkbuf); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; + } xact_count = mme_ue_xact_count(mme_ue, OGS_GTP_LOCAL_ORIGINATOR); @@ -1820,7 +1850,17 @@ ogs_assert(message); enb_ue = enb_ue_find_by_id(mme_ue->enb_ue_id); - ogs_assert(enb_ue); + if (!enb_ue) { + ogs_error("No S1 Context IMSI%s NAS-Type%d " + "ENB-UE-ID%d:%d%p:%p", + mme_ue->imsi_bcd, message->emm.h.message_type, + e->enb_ue_id, mme_ue->enb_ue_id, + enb_ue_find_by_id(e->enb_ue_id), + enb_ue_find_by_id(mme_ue->enb_ue_id)); + ogs_assert(e->pkbuf); + ogs_log_hexdump(OGS_LOG_ERROR, e->pkbuf->data, e->pkbuf->len); + break; + } h.type = e->nas_type;
View file
open5gs_2.7.5.tar.xz/src/mme/esm-handler.c -> open5gs_2.7.6.tar.xz/src/mme/esm-handler.c
Changed
@@ -59,6 +59,20 @@ return OGS_ERROR; } + if (req->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV4 || + req->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV6 || + req->request_type.type == OGS_NAS_EPS_PDN_TYPE_IPV4V6) { + /* OK */ + } else { + /* NOT-allowed PDN Type */ + r = nas_eps_send_pdn_connectivity_reject( + sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE, + create_action); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + return OGS_ERROR; + } + memcpy(&sess->ue_request_type, &req->request_type, sizeof(sess->ue_request_type));
View file
open5gs_2.7.5.tar.xz/src/mme/mme-context.c -> open5gs_2.7.6.tar.xz/src/mme/mme-context.c
Changed
@@ -2014,12 +2014,14 @@ ogs_yaml_iter_value(&network_name_iter); uint8_t size = strlen(c_network_name); uint8_t i; - for (i = 0;i<size;i++) { + for (i = 0; i < size && + (((i * 2) + 1) < + (OGS_NAS_MAX_NETWORK_NAME_LEN - 1)); + i++) { /* Workaround to convert the ASCII to USC-2 */ - network_full_name->namei*2 = 0; - network_full_name->name(i*2)+1 = + network_full_name->namei * 2 = 0; + network_full_name->namei * 2 + 1 = c_network_namei; - } network_full_name->length = size*2+1; network_full_name->coding_scheme = 1; @@ -2031,12 +2033,14 @@ ogs_yaml_iter_value(&network_name_iter); uint8_t size = strlen(c_network_name); uint8_t i; - for (i = 0;i<size;i++) { + for (i = 0; i < size && + (((i * 2) + 1) < + (OGS_NAS_MAX_NETWORK_NAME_LEN - 1)); + i++) { /* Workaround to convert the ASCII to USC-2 */ - network_short_name->namei*2 = 0; - network_short_name->name(i*2)+1 = + network_short_name->namei * 2 = 0; + network_short_name->namei * 2 + 1 = c_network_namei; - } network_short_name->length = size*2+1; network_short_name->coding_scheme = 1; @@ -2834,10 +2838,14 @@ { ogs_assert(vlr); - if (vlr->poll) + if (vlr->poll) { ogs_pollset_remove(vlr->poll); - if (vlr->sock) + vlr->poll = NULL; + } + if (vlr->sock) { ogs_sctp_destroy(vlr->sock); + vlr->sock = NULL; + } } mme_vlr_t *mme_vlr_find_by_sock(const ogs_sock_t *sock) @@ -3684,7 +3692,7 @@ ogs_timer_delete(mme_ue->t_implicit_detach.timer); ogs_timer_delete(mme_ue->gn.t_gn_holding); - enb_ue_unlink(mme_ue); + mme_ue->enb_ue_id = OGS_INVALID_POOL_ID; mme_sess_remove_all(mme_ue); mme_session_remove_all(mme_ue); @@ -4165,16 +4173,16 @@ enb_ue->mme_ue_id = mme_ue->id; } -void enb_ue_deassociate(enb_ue_t *enb_ue) +void enb_ue_deassociate_mme_ue(enb_ue_t *enb_ue, mme_ue_t *mme_ue) { + ogs_assert(mme_ue); ogs_assert(enb_ue); - enb_ue->mme_ue_id = OGS_INVALID_POOL_ID; -} -void enb_ue_unlink(mme_ue_t *mme_ue) -{ - ogs_assert(mme_ue); - mme_ue->enb_ue_id = OGS_INVALID_POOL_ID; + if (mme_ue->enb_ue_id == enb_ue->id) + mme_ue->enb_ue_id = OGS_INVALID_POOL_ID; + else + ogs_error("Cannot deassociate mme_ue->enb_ue_id%d != enb_ue->id%d", + mme_ue->enb_ue_id, enb_ue->id); } void enb_ue_source_associate_target(enb_ue_t *source_ue, enb_ue_t *target_ue) @@ -4243,16 +4251,16 @@ sgw_ue->mme_ue_id = mme_ue->id; } -void sgw_ue_deassociate(sgw_ue_t *sgw_ue) +void sgw_ue_deassociate_mme_ue(sgw_ue_t *sgw_ue, mme_ue_t *mme_ue) { + ogs_assert(mme_ue); ogs_assert(sgw_ue); - sgw_ue->mme_ue_id = OGS_INVALID_POOL_ID; -} -void sgw_ue_unlink(mme_ue_t *mme_ue) -{ - ogs_assert(mme_ue); - mme_ue->sgw_ue_id = OGS_INVALID_POOL_ID; + if (mme_ue->sgw_ue_id == sgw_ue->id) + mme_ue->sgw_ue_id = OGS_INVALID_POOL_ID; + else + ogs_error("Cannot deassociate mme_ue->sgw_ue_id%d != sgw_ue->id%d", + mme_ue->sgw_ue_id, sgw_ue->id); } void sgw_ue_source_associate_target(sgw_ue_t *source_ue, sgw_ue_t *target_ue)
View file
open5gs_2.7.5.tar.xz/src/mme/mme-context.h -> open5gs_2.7.6.tar.xz/src/mme/mme-context.h
Changed
@@ -634,7 +634,7 @@ \ enb_ue_holding = enb_ue_find_by_id((__mME)->enb_ue_id); \ if (enb_ue_holding) { \ - enb_ue_deassociate(enb_ue_holding); \ + enb_ue_holding->mme_ue_id = OGS_INVALID_POOL_ID; \ \ ogs_warn("%s Holding S1 Context", (__mME)->imsi_bcd); \ ogs_warn("%s ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d", \ @@ -1163,14 +1163,12 @@ * - Delete Indirect Data Forwarding Tunnel Request/Response */ void enb_ue_associate_mme_ue(enb_ue_t *enb_ue, mme_ue_t *mme_ue); -void enb_ue_deassociate(enb_ue_t *enb_ue); -void enb_ue_unlink(mme_ue_t *mme_ue); +void enb_ue_deassociate_mme_ue(enb_ue_t *enb_ue, mme_ue_t *mme_ue); void enb_ue_source_associate_target(enb_ue_t *source_ue, enb_ue_t *target_ue); void enb_ue_source_deassociate_target(enb_ue_t *enb_ue); void sgw_ue_associate_mme_ue(sgw_ue_t *sgw_ue, mme_ue_t *mme_ue); -void sgw_ue_deassociate(sgw_ue_t *sgw_ue); -void sgw_ue_unlink(mme_ue_t *mme_ue); +void sgw_ue_deassociate_mme_ue(sgw_ue_t *sgw_ue, mme_ue_t *mme_ue); void sgw_ue_source_associate_target(sgw_ue_t *source_ue, sgw_ue_t *target_ue); void sgw_ue_source_deassociate_target(sgw_ue_t *sgw_ue);
View file
open5gs_2.7.5.tar.xz/src/mme/mme-gtp-path.c -> open5gs_2.7.6.tar.xz/src/mme/mme-gtp-path.c
Changed
@@ -656,7 +656,7 @@ * Execute enb_ue_unlink(mme_ue) and enb_ue_remove(enb_ue) * before mme_gtp_send_release_access_bearers_request() */ - enb_ue_unlink(mme_ue); + enb_ue_deassociate_mme_ue(enb_ue, mme_ue); enb_ue_remove(enb_ue); }
View file
open5gs_2.7.5.tar.xz/src/mme/mme-init.c -> open5gs_2.7.6.tar.xz/src/mme/mme-init.c
Changed
@@ -126,7 +126,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/mme/mme-s11-handler.c -> open5gs_2.7.6.tar.xz/src/mme/mme-s11-handler.c
Changed
@@ -1492,13 +1492,12 @@ * for new UE-associated logical S1-connections over the S1 interface, * the MME shall respond with the RESET ACKNOWLEDGE message. */ - enb_ue_unlink(mme_ue); - if (enb_ue) { mme_enb_t *enb = NULL; enb = mme_enb_find_by_id(enb_ue->enb_id); + enb_ue_deassociate_mme_ue(enb_ue, mme_ue); enb_ue_remove(enb_ue); if (enb && ogs_list_count(&enb->enb_ue_list) == 0) { @@ -1513,13 +1512,12 @@ } else if (action == OGS_GTP_RELEASE_S1_CONTEXT_REMOVE_BY_RESET_PARTIAL) { enb_ue_t *iter = NULL; - enb_ue_unlink(mme_ue); - if (enb_ue) { mme_enb_t *enb = NULL; enb = mme_enb_find_by_id(enb_ue->enb_id); + enb_ue_deassociate_mme_ue(enb_ue, mme_ue); enb_ue_remove(enb_ue); if (enb) {
View file
open5gs_2.7.5.tar.xz/src/mme/mme-s6a-handler.c -> open5gs_2.7.6.tar.xz/src/mme/mme-s6a-handler.c
Changed
@@ -277,7 +277,7 @@ ogs_debug(" OGS_NAS_EPS TYPE%d", mme_ue->nas_eps.type); switch (clr_message->cancellation_type) { - case OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWL: + case OGS_DIAM_S6A_CT_SUBSCRIPTION_WITHDRAWAL: mme_ue->detach_type = MME_DETACH_TYPE_HSS_EXPLICIT; /* @@ -403,7 +403,7 @@ if (dia_exp_err) { switch (*dia_exp_err) { case OGS_DIAM_S6A_ERROR_USER_UNKNOWN: /* 5001 */ - return OGS_NAS_EMM_CAUSE_PLMN_NOT_ALLOWED; + return OGS_NAS_EMM_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED; case OGS_DIAM_S6A_ERROR_UNKNOWN_EPS_SUBSCRIPTION: /* 5420 */ /* FIXME: Error diagnostic? */ return OGS_NAS_EMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA;
View file
open5gs_2.7.5.tar.xz/src/mme/s1ap-build.c -> open5gs_2.7.6.tar.xz/src/mme/s1ap-build.c
Changed
@@ -372,30 +372,39 @@ if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink || bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) { - ogs_assert(bearer->qos.mbr.downlink); - ogs_assert(bearer->qos.mbr.uplink); - ogs_assert(bearer->qos.gbr.downlink); - ogs_assert(bearer->qos.gbr.uplink); - - ogs_debug(" MBRDL:%lld,UL:%lld", - (long long)bearer->qos.mbr.downlink, - (long long)bearer->qos.mbr.uplink); - ogs_debug(" GBRDL:%lld,UL:%lld", - (long long)bearer->qos.gbr.downlink, - (long long)bearer->qos.gbr.uplink); - - gbrQosInformation = - CALLOC(1, sizeof(struct S1AP_GBR_QosInformation)); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, - bearer->qos.mbr.downlink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, - bearer->qos.mbr.uplink); - asn_uint642INTEGER(&gbrQosInformation-> - e_RAB_GuaranteedBitrateDL, bearer->qos.gbr.downlink); - asn_uint642INTEGER(&gbrQosInformation-> - e_RAB_GuaranteedBitrateUL, bearer->qos.gbr.uplink); - e_rab->e_RABlevelQoSParameters.gbrQosInformation = - gbrQosInformation; + if (bearer->qos.mbr.downlink && bearer->qos.mbr.uplink && + bearer->qos.gbr.downlink && bearer->qos.gbr.uplink) { + + ogs_debug(" MBRDL:%lld,UL:%lld", + (long long)bearer->qos.mbr.downlink, + (long long)bearer->qos.mbr.uplink); + ogs_debug(" GBRDL:%lld,UL:%lld", + (long long)bearer->qos.gbr.downlink, + (long long)bearer->qos.gbr.uplink); + + gbrQosInformation = + CALLOC(1, sizeof(struct S1AP_GBR_QosInformation)); + asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, + bearer->qos.mbr.downlink); + asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, + bearer->qos.mbr.uplink); + asn_uint642INTEGER(&gbrQosInformation-> + e_RAB_GuaranteedBitrateDL, bearer->qos.gbr.downlink); + asn_uint642INTEGER(&gbrQosInformation-> + e_RAB_GuaranteedBitrateUL, bearer->qos.gbr.uplink); + e_rab->e_RABlevelQoSParameters.gbrQosInformation = + gbrQosInformation; + + } else { + ogs_error("Missing one or more MBR/GBR parameters; " + "defaulting to Non-GBR flow "); + ogs_error(" MBRDL:%lld,UL:%lld", + (long long)bearer->qos.mbr.downlink, + (long long)bearer->qos.mbr.uplink); + ogs_error(" GBRDL:%lld,UL:%lld", + (long long)bearer->qos.gbr.downlink, + (long long)bearer->qos.gbr.uplink); + } } rv = ogs_asn_ip_to_BIT_STRING( @@ -1141,21 +1150,31 @@ if (bearer->qos.mbr.downlink || bearer->qos.mbr.uplink || bearer->qos.gbr.downlink || bearer->qos.gbr.uplink) { - ogs_assert(bearer->qos.mbr.downlink); - ogs_assert(bearer->qos.mbr.uplink); - ogs_assert(bearer->qos.gbr.downlink); - ogs_assert(bearer->qos.gbr.uplink); - - gbrQosInformation = CALLOC(1, sizeof(S1AP_GBR_QosInformation_t)); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, - bearer->qos.mbr.downlink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, - bearer->qos.mbr.uplink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_GuaranteedBitrateDL, - bearer->qos.gbr.downlink); - asn_uint642INTEGER(&gbrQosInformation->e_RAB_GuaranteedBitrateUL, - bearer->qos.gbr.uplink); - e_rab->e_RABlevelQoSParameters.gbrQosInformation = gbrQosInformation; + if (bearer->qos.mbr.downlink && bearer->qos.mbr.uplink && + bearer->qos.gbr.downlink && bearer->qos.gbr.uplink) { + + gbrQosInformation = CALLOC(1, sizeof(S1AP_GBR_QosInformation_t)); + asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateDL, + bearer->qos.mbr.downlink); + asn_uint642INTEGER(&gbrQosInformation->e_RAB_MaximumBitrateUL, + bearer->qos.mbr.uplink); + asn_uint642INTEGER(&gbrQosInformation->e_RAB_GuaranteedBitrateDL, + bearer->qos.gbr.downlink); + asn_uint642INTEGER(&gbrQosInformation->e_RAB_GuaranteedBitrateUL, + bearer->qos.gbr.uplink); + e_rab->e_RABlevelQoSParameters.gbrQosInformation = + gbrQosInformation; + + } else { + ogs_error("Missing one or more MBR/GBR parameters; " + "defaulting to Non-GBR flow "); + ogs_error(" MBRDL:%lld,UL:%lld", + (long long)bearer->qos.mbr.downlink, + (long long)bearer->qos.mbr.uplink); + ogs_error(" GBRDL:%lld,UL:%lld", + (long long)bearer->qos.gbr.downlink, + (long long)bearer->qos.gbr.uplink); + } } rv = ogs_asn_ip_to_BIT_STRING(
View file
open5gs_2.7.5.tar.xz/src/mme/s1ap-handler.c -> open5gs_2.7.6.tar.xz/src/mme/s1ap-handler.c
Changed
@@ -1961,12 +1961,13 @@ break; case S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK: ogs_debug(" Action: S1 normal release"); - enb_ue_remove(enb_ue); - if (!mme_ue) { + + if (mme_ue) + enb_ue_deassociate_mme_ue(enb_ue, mme_ue); + else ogs_error("No UE(mme-ue) context"); - return; - } - enb_ue_unlink(mme_ue); + + enb_ue_remove(enb_ue); break; case S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE: ogs_debug(" Action: UE context remove"); @@ -2057,16 +2058,16 @@ break; case S1AP_UE_CTX_REL_S1_PAGING: ogs_debug(" Action: S1 paging"); - enb_ue_remove(enb_ue); - if (!mme_ue) { + if (mme_ue) { + enb_ue_deassociate_mme_ue(enb_ue, mme_ue); + + r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps); + ogs_expect(r == OGS_OK); + ogs_assert(r != OGS_ERROR); + } else ogs_error("No UE(mme-ue) context"); - return; - } - enb_ue_unlink(mme_ue); - r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps); - ogs_expect(r == OGS_OK); - ogs_assert(r != OGS_ERROR); + enb_ue_remove(enb_ue); break; default: ogs_error("Invalid Action%d", enb_ue->ue_ctx_rel_action);
View file
open5gs_2.7.5.tar.xz/src/mme/s1ap-sctp.c -> open5gs_2.7.6.tar.xz/src/mme/s1ap-sctp.c
Changed
@@ -245,14 +245,8 @@ s1ap_event_push(MME_EVENT_S1AP_MESSAGE, sock, addr, pkbuf, 0, 0); return; } else { - if (ogs_socket_errno != OGS_EAGAIN) { - ogs_fatal("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", - size, errno, strerror(errno), flags); - ogs_assert_if_reached(); - } else { - ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", - size, errno, strerror(errno), flags); - } + ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", + size, errno, strerror(errno), flags); } ogs_pkbuf_free(pkbuf);
View file
open5gs_2.7.5.tar.xz/src/mme/sgsap-sctp.c -> open5gs_2.7.6.tar.xz/src/mme/sgsap-sctp.c
Changed
@@ -183,14 +183,8 @@ sgsap_event_push(MME_EVENT_SGSAP_MESSAGE, sock, NULL, pkbuf, 0, 0); return; } else { - if (ogs_socket_errno != OGS_EAGAIN) { - ogs_fatal("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", - size, errno, strerror(errno), flags); - ogs_assert_if_reached(); - } else { - ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", - size, errno, strerror(errno), flags); - } + ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)", + size, errno, strerror(errno), flags); } ogs_pkbuf_free(pkbuf); }
View file
open5gs_2.7.5.tar.xz/src/nrf/init.c -> open5gs_2.7.6.tar.xz/src/nrf/init.c
Changed
@@ -102,7 +102,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/nrf/nf-sm.c -> open5gs_2.7.6.tar.xz/src/nrf/nf-sm.c
Changed
@@ -81,7 +81,7 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e) { - bool handled; + bool handled = false; ogs_sbi_nf_instance_t *nf_instance = NULL; ogs_sbi_stream_t *stream = NULL; @@ -128,7 +128,9 @@ handled = nrf_nnrf_handle_nf_register( nf_instance, stream, message); - if (handled == false) + if (handled == true) + OGS_FSM_TRAN(s, nrf_nf_state_registered); + else OGS_FSM_TRAN(s, nrf_nf_state_exception); break; @@ -139,6 +141,7 @@ ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, "Invalid HTTP method", message->h.method, NULL)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); END break; @@ -150,6 +153,7 @@ OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, "Invalid resource name", message->h.resource.component0, NULL)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); END break; @@ -161,9 +165,8 @@ OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, "Invalid resource name", message->h.service.name, NULL)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); END - - OGS_FSM_TRAN(s, nrf_nf_state_registered); break; default: @@ -175,7 +178,6 @@ message, "Unknown event", nrf_event_get_name(e), NULL)); OGS_FSM_TRAN(s, nrf_nf_state_exception); - break; } } @@ -278,6 +280,7 @@ ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, "Invalid HTTP method", message->h.method, NULL)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); END break; @@ -289,6 +292,7 @@ OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, "Invalid resource name", message->h.resource.component0, NULL)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); END break; @@ -300,6 +304,7 @@ OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, "Invalid resource name", message->h.service.name, NULL)); + OGS_FSM_TRAN(s, nrf_nf_state_exception); END break; @@ -312,7 +317,6 @@ message, "Unknown event", nrf_event_get_name(e), NULL)); OGS_FSM_TRAN(s, nrf_nf_state_exception); - break; } }
View file
open5gs_2.7.5.tar.xz/src/nrf/nrf-sm.c -> open5gs_2.7.6.tar.xz/src/nrf/nrf-sm.c
Changed
@@ -163,6 +163,16 @@ &message, "Not found", message.h.resource.component1, NULL)); END + } else { + if (NF_INSTANCE_ID_IS_SELF(nf_instance->id)) { + ogs_error("SELF Not allowed %s", nf_instance->id); + ogs_assert(true == + ogs_sbi_server_send_error(stream, + OGS_SBI_HTTP_STATUS_FORBIDDEN, + &message, "SELF Not allowed", + nf_instance->id, NULL)); + break; + } } if (nf_instance) {
View file
open5gs_2.7.5.tar.xz/src/nssf/init.c -> open5gs_2.7.6.tar.xz/src/nssf/init.c
Changed
@@ -61,7 +61,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -108,7 +108,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/nssf/nssf-sm.c -> open5gs_2.7.6.tar.xz/src/nssf/nssf-sm.c
Changed
@@ -205,10 +205,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
View file
open5gs_2.7.5.tar.xz/src/pcf/am-sm.c -> open5gs_2.7.6.tar.xz/src/pcf/am-sm.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -37,7 +37,7 @@ void pcf_am_state_operational(ogs_fsm_t *s, pcf_event_t *e) { bool handled; - pcf_ue_t *pcf_ue = NULL; + pcf_ue_am_t *pcf_ue_am = NULL; ogs_sbi_stream_t *stream = NULL; ogs_pool_id_t stream_id; @@ -48,8 +48,8 @@ pcf_sm_debug(e); - pcf_ue = pcf_ue_find_by_id(e->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_am = pcf_ue_am_find_by_id(e->pcf_ue_am_id); + ogs_assert(pcf_ue_am); switch (e->h.id) { case OGS_FSM_ENTRY_SIG: @@ -75,9 +75,9 @@ SWITCH(message->h.method) CASE(OGS_SBI_HTTP_METHOD_POST) handled = pcf_npcf_am_policy_control_handle_create( - pcf_ue, stream, message); + pcf_ue_am, stream, message); if (!handled) { - ogs_error("%s Cannot handle SBI message", pcf_ue->supi); + ogs_error("%s Cannot handle SBI message", pcf_ue_am->supi); OGS_FSM_TRAN(s, pcf_am_state_exception); } break; @@ -89,7 +89,7 @@ DEFAULT ogs_error("%s Invalid HTTP method %s", - pcf_ue->supi, message->h.method); + pcf_ue_am->supi, message->h.method); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, @@ -122,39 +122,40 @@ if (message->res_status == OGS_SBI_HTTP_STATUS_NOT_FOUND) { ogs_warn("%s Cannot find SUPI %d", - pcf_ue->supi, message->res_status); + pcf_ue_am->supi, message->res_status); } else { ogs_error("%s HTTP response error %d", - pcf_ue->supi, message->res_status); + pcf_ue_am->supi, message->res_status); } ogs_assert(true == ogs_sbi_server_send_error( stream, message->res_status, - NULL, "HTTP response error", pcf_ue->supi, + NULL, "HTTP response error", pcf_ue_am->supi, NULL)); break; } - pcf_nudr_dr_handle_query_am_data(pcf_ue, stream, message); + pcf_nudr_dr_handle_query_am_data( + pcf_ue_am, stream, message); break; DEFAULT ogs_error("%s Invalid resource name %s", - pcf_ue->supi, message->h.resource.component1); + pcf_ue_am->supi, message->h.resource.component1); ogs_assert_if_reached(); END break; DEFAULT ogs_error("%s Invalid resource name %s", - pcf_ue->supi, message->h.resource.component0); + pcf_ue_am->supi, message->h.resource.component0); ogs_assert_if_reached(); END break; DEFAULT ogs_error("%s Invalid API name %s", - pcf_ue->supi, message->h.service.name); + pcf_ue_am->supi, message->h.service.name); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, message, @@ -164,21 +165,22 @@ break; default: - ogs_error("%s Unknown event %s", pcf_ue->supi, pcf_event_get_name(e)); + ogs_error("%s Unknown event %s", + pcf_ue_am->supi, pcf_event_get_name(e)); break; } } void pcf_am_state_deleted(ogs_fsm_t *s, pcf_event_t *e) { - pcf_ue_t *pcf_ue = NULL; + pcf_ue_am_t *pcf_ue_am = NULL; ogs_assert(s); ogs_assert(e); pcf_sm_debug(e); - pcf_ue = pcf_ue_find_by_id(e->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_am = pcf_ue_am_find_by_id(e->pcf_ue_am_id); + ogs_assert(pcf_ue_am); switch (e->h.id) { case OGS_FSM_ENTRY_SIG: @@ -188,21 +190,22 @@ break; default: - ogs_error("%s Unknown event %s", pcf_ue->supi, pcf_event_get_name(e)); + ogs_error("%s Unknown event %s", pcf_ue_am->supi, + pcf_event_get_name(e)); break; } } void pcf_am_state_exception(ogs_fsm_t *s, pcf_event_t *e) { - pcf_ue_t *pcf_ue = NULL; + pcf_ue_am_t *pcf_ue_am = NULL; ogs_assert(s); ogs_assert(e); pcf_sm_debug(e); - pcf_ue = pcf_ue_find_by_id(e->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_am = pcf_ue_am_find_by_id(e->pcf_ue_am_id); + ogs_assert(pcf_ue_am); switch (e->h.id) { case OGS_FSM_ENTRY_SIG: @@ -212,7 +215,8 @@ break; default: - ogs_error("%s Unknown event %s", pcf_ue->supi, pcf_event_get_name(e)); + ogs_error("%s Unknown event %s", pcf_ue_am->supi, + pcf_event_get_name(e)); break; } }
View file
open5gs_2.7.5.tar.xz/src/pcf/context.c -> open5gs_2.7.6.tar.xz/src/pcf/context.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -23,7 +23,8 @@ int __pcf_log_domain; -static OGS_POOL(pcf_ue_pool, pcf_ue_t); +static OGS_POOL(pcf_ue_am_pool, pcf_ue_am_t); +static OGS_POOL(pcf_ue_sm_pool, pcf_ue_sm_t); static OGS_POOL(pcf_sess_pool, pcf_sess_t); static OGS_POOL(pcf_app_pool, pcf_app_t); @@ -42,14 +43,18 @@ ogs_log_install_domain(&__ogs_dbi_domain, "dbi", ogs_core()->log.level); ogs_log_install_domain(&__pcf_log_domain, "pcf", ogs_core()->log.level); - ogs_pool_init(&pcf_ue_pool, ogs_global_conf()->max.ue); + ogs_pool_init(&pcf_ue_am_pool, ogs_global_conf()->max.ue); + ogs_pool_init(&pcf_ue_sm_pool, ogs_global_conf()->max.ue); ogs_pool_init(&pcf_sess_pool, ogs_app()->pool.sess); ogs_pool_init(&pcf_app_pool, ogs_app()->pool.sess); - ogs_list_init(&self.pcf_ue_list); + ogs_list_init(&self.pcf_ue_am_list); + ogs_list_init(&self.pcf_ue_sm_list); - self.supi_hash = ogs_hash_make(); - ogs_assert(self.supi_hash); + self.supi_am_hash = ogs_hash_make(); + ogs_assert(self.supi_am_hash); + self.supi_sm_hash = ogs_hash_make(); + ogs_assert(self.supi_sm_hash); self.ipv4addr_hash = ogs_hash_make(); ogs_assert(self.ipv4addr_hash); self.ipv6prefix_hash = ogs_hash_make(); @@ -62,10 +67,13 @@ { ogs_assert(context_initialized == 1); - pcf_ue_remove_all(); + pcf_ue_am_remove_all(); + pcf_ue_sm_remove_all(); - ogs_assert(self.supi_hash); - ogs_hash_destroy(self.supi_hash); + ogs_assert(self.supi_am_hash); + ogs_hash_destroy(self.supi_am_hash); + ogs_assert(self.supi_sm_hash); + ogs_hash_destroy(self.supi_sm_hash); ogs_assert(self.ipv4addr_hash); ogs_hash_destroy(self.ipv4addr_hash); ogs_assert(self.ipv6prefix_hash); @@ -73,7 +81,8 @@ ogs_pool_final(&pcf_app_pool); ogs_pool_final(&pcf_sess_pool); - ogs_pool_final(&pcf_ue_pool); + ogs_pool_final(&pcf_ue_am_pool); + ogs_pool_final(&pcf_ue_sm_pool); context_initialized = 0; } @@ -335,110 +344,164 @@ return OGS_OK; } -pcf_ue_t *pcf_ue_add(char *supi) +pcf_ue_am_t *pcf_ue_am_add(char *supi) { pcf_event_t e; - pcf_ue_t *pcf_ue = NULL; + pcf_ue_am_t *pcf_ue_am = NULL; ogs_assert(supi); - ogs_pool_id_calloc(&pcf_ue_pool, &pcf_ue); - ogs_assert(pcf_ue); + ogs_pool_id_calloc(&pcf_ue_am_pool, &pcf_ue_am); + ogs_assert(pcf_ue_am); /* SBI Type */ - pcf_ue->sbi.type = OGS_SBI_OBJ_UE_TYPE; + pcf_ue_am->sbi.type = OGS_SBI_OBJ_UE_TYPE; /* SBI Features */ - OGS_SBI_FEATURES_SET(pcf_ue->am_policy_control_features, + OGS_SBI_FEATURES_SET(pcf_ue_am->am_policy_control_features, OGS_SBI_NPCF_AM_POLICY_CONTROL_UE_AMBR_AUTHORIZATION); - pcf_ue->association_id = ogs_msprintf("%d", - (int)ogs_pool_index(&pcf_ue_pool, pcf_ue)); - ogs_assert(pcf_ue->association_id); - - pcf_ue->supi = ogs_strdup(supi); - ogs_assert(pcf_ue->supi); - ogs_hash_set(self.supi_hash, pcf_ue->supi, strlen(pcf_ue->supi), pcf_ue); + pcf_ue_am->association_id = ogs_msprintf("%d", + (int)ogs_pool_index(&pcf_ue_am_pool, pcf_ue_am)); + ogs_assert(pcf_ue_am->association_id); + + pcf_ue_am->supi = ogs_strdup(supi); + ogs_assert(pcf_ue_am->supi); + ogs_hash_set(self.supi_am_hash, pcf_ue_am->supi, strlen(pcf_ue_am->supi), pcf_ue_am); memset(&e, 0, sizeof(e)); - e.pcf_ue_id = pcf_ue->id; - ogs_fsm_init(&pcf_ue->sm, pcf_am_state_initial, pcf_am_state_final, &e); + e.pcf_ue_am_id = pcf_ue_am->id; + ogs_fsm_init(&pcf_ue_am->sm, pcf_am_state_initial, pcf_am_state_final, &e); - ogs_list_add(&self.pcf_ue_list, pcf_ue); + ogs_list_add(&self.pcf_ue_am_list, pcf_ue_am); - return pcf_ue; + return pcf_ue_am; } -void pcf_ue_remove(pcf_ue_t *pcf_ue) +void pcf_ue_am_remove(pcf_ue_am_t *pcf_ue_am) { pcf_event_t e; - ogs_assert(pcf_ue); + ogs_assert(pcf_ue_am); - ogs_list_remove(&self.pcf_ue_list, pcf_ue); + ogs_list_remove(&self.pcf_ue_am_list, pcf_ue_am); memset(&e, 0, sizeof(e)); - e.pcf_ue_id = pcf_ue->id; - ogs_fsm_fini(&pcf_ue->sm, &e); + e.pcf_ue_am_id = pcf_ue_am->id; + ogs_fsm_fini(&pcf_ue_am->sm, &e); /* Free SBI object memory */ - if (ogs_list_count(&pcf_ue->sbi.xact_list)) + if (ogs_list_count(&pcf_ue_am->sbi.xact_list)) ogs_error("UE transaction %d", - ogs_list_count(&pcf_ue->sbi.xact_list)); - ogs_sbi_object_free(&pcf_ue->sbi); + ogs_list_count(&pcf_ue_am->sbi.xact_list)); + ogs_sbi_object_free(&pcf_ue_am->sbi); - pcf_sess_remove_all(pcf_ue); + OpenAPI_policy_association_request_free(pcf_ue_am->policy_association_request); + if (pcf_ue_am->subscribed_ue_ambr) + OpenAPI_ambr_free(pcf_ue_am->subscribed_ue_ambr); - OpenAPI_policy_association_request_free(pcf_ue->policy_association_request); - if (pcf_ue->subscribed_ue_ambr) - OpenAPI_ambr_free(pcf_ue->subscribed_ue_ambr); + ogs_assert(pcf_ue_am->association_id); + ogs_free(pcf_ue_am->association_id); - ogs_assert(pcf_ue->association_id); - ogs_free(pcf_ue->association_id); + ogs_assert(pcf_ue_am->supi); + ogs_hash_set(self.supi_am_hash, pcf_ue_am->supi, strlen(pcf_ue_am->supi), NULL); + ogs_free(pcf_ue_am->supi); - ogs_assert(pcf_ue->supi); - ogs_hash_set(self.supi_hash, pcf_ue->supi, strlen(pcf_ue->supi), NULL); - ogs_free(pcf_ue->supi); + if (pcf_ue_am->notification_uri) + ogs_free(pcf_ue_am->notification_uri); + if (pcf_ue_am->namf.client) + ogs_sbi_client_remove(pcf_ue_am->namf.client); - if (pcf_ue->notification_uri) - ogs_free(pcf_ue->notification_uri); - if (pcf_ue->namf.client) - ogs_sbi_client_remove(pcf_ue->namf.client); + if (pcf_ue_am->gpsi) + ogs_free(pcf_ue_am->gpsi); + if (pcf_ue_am->pei) + ogs_free(pcf_ue_am->pei); - if (pcf_ue->gpsi) - ogs_free(pcf_ue->gpsi); - if (pcf_ue->pei) - ogs_free(pcf_ue->pei); + ogs_pool_id_free(&pcf_ue_am_pool, pcf_ue_am); +} + +void pcf_ue_am_remove_all(void) +{ + pcf_ue_am_t *pcf_ue_am = NULL, *next = NULL;; + + ogs_list_for_each_safe(&self.pcf_ue_am_list, next, pcf_ue_am) + pcf_ue_am_remove(pcf_ue_am); +} + +pcf_ue_am_t *pcf_ue_am_find_by_supi(char *supi) +{ + ogs_assert(supi);
View file
open5gs_2.7.5.tar.xz/src/pcf/context.h -> open5gs_2.7.6.tar.xz/src/pcf/context.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -38,14 +38,18 @@ #define OGS_LOG_DOMAIN __pcf_log_domain typedef struct pcf_context_s { - ogs_list_t pcf_ue_list; - ogs_hash_t *supi_hash; + ogs_list_t pcf_ue_am_list; +#define PCF_UE_SM_IS_LAST_SESSION(__pCF) \ + ((__pCF) && (ogs_list_count(&(__pCF)->sess_list)) == 1) + ogs_list_t pcf_ue_sm_list; + ogs_hash_t *supi_am_hash; + ogs_hash_t *supi_sm_hash; ogs_hash_t *ipv4addr_hash; ogs_hash_t *ipv6prefix_hash; } pcf_context_t; -struct pcf_ue_s { +struct pcf_ue_am_s { ogs_sbi_object_t sbi; ogs_pool_id_t id; ogs_fsm_t sm; @@ -70,10 +74,29 @@ OpenAPI_policy_association_request_t *policy_association_request; OpenAPI_ambr_t *subscribed_ue_ambr; +}; + +struct pcf_ue_sm_s { + ogs_lnode_t lnode; + ogs_pool_id_t id; + + char *supi; + char *gpsi; ogs_list_t sess_list; }; +#define PCF_SESS_CLEAR(__sESS) \ + do { \ + pcf_ue_sm_t *pcf_ue_sm = NULL; \ + ogs_assert(__sESS); \ + pcf_ue_sm = pcf_ue_sm_find_by_id((__sESS)->pcf_ue_sm_id); \ + ogs_assert(pcf_ue_sm); \ + if (PCF_UE_SM_IS_LAST_SESSION(pcf_ue_sm)) \ + pcf_ue_sm_remove(pcf_ue_sm); \ + else \ + pcf_sess_remove(__sESS); \ + } while(0) struct pcf_sess_s { ogs_sbi_object_t sbi; ogs_pool_id_t id; @@ -156,7 +179,7 @@ ogs_list_t app_list; /* Related Context */ - ogs_pool_id_t pcf_ue_id; + ogs_pool_id_t pcf_ue_sm_id; }; typedef struct pcf_app_s { @@ -181,30 +204,37 @@ int pcf_context_parse_config(void); -pcf_ue_t *pcf_ue_add(char *supi); -void pcf_ue_remove(pcf_ue_t *pcf_ue); -void pcf_ue_remove_all(void); -pcf_ue_t *pcf_ue_find_by_supi(char *supi); -pcf_ue_t *pcf_ue_find_by_association_id(char *association_id); +pcf_ue_am_t *pcf_ue_am_add(char *supi); +void pcf_ue_am_remove(pcf_ue_am_t *pcf_ue_am); +void pcf_ue_am_remove_all(void); +pcf_ue_am_t *pcf_ue_am_find_by_supi(char *supi); +pcf_ue_am_t *pcf_ue_am_find_by_association_id(char *association_id); + +pcf_ue_sm_t *pcf_ue_sm_add(char *supi); +void pcf_ue_sm_remove(pcf_ue_sm_t *pcf_ue_sm); +void pcf_ue_sm_remove_all(void); +pcf_ue_sm_t *pcf_ue_sm_find_by_supi(char *supi); +pcf_ue_sm_t *pcf_ue_sm_find_by_association_id(char *association_id); -pcf_sess_t *pcf_sess_add(pcf_ue_t *pcf_ue, uint8_t psi); +pcf_sess_t *pcf_sess_add(pcf_ue_sm_t *pcf_ue_sm, uint8_t psi); void pcf_sess_remove(pcf_sess_t *sess); -void pcf_sess_remove_all(pcf_ue_t *pcf_ue); +void pcf_sess_remove_all(pcf_ue_sm_t *pcf_ue_sm); bool pcf_sess_set_ipv4addr(pcf_sess_t *sess, char *ipv4addr); bool pcf_sess_set_ipv6prefix(pcf_sess_t *sess, char *ipv6prefix); pcf_sess_t *pcf_sess_find(uint32_t index); pcf_sess_t *pcf_sess_find_by_sm_policy_id(char *sm_policy_id); -pcf_sess_t *pcf_sess_find_by_psi(pcf_ue_t *pcf_ue, uint8_t psi); -pcf_sess_t *pcf_sess_find_by_dnn(pcf_ue_t *pcf_ue, char *dnn); +pcf_sess_t *pcf_sess_find_by_psi(pcf_ue_sm_t *pcf_ue_sm, uint8_t psi); +pcf_sess_t *pcf_sess_find_by_dnn(pcf_ue_sm_t *pcf_ue_sm, char *dnn); pcf_sess_t *pcf_sess_find_by_ipv4addr(char *ipv4addr_string); pcf_sess_t *pcf_sess_find_by_ipv6addr(char *ipv6addr_string); pcf_sess_t *pcf_sess_find_by_ipv6prefix(char *ipv6prefix_string); int pcf_sessions_number_by_snssai_and_dnn( - pcf_ue_t *pcf_ue, ogs_s_nssai_t *s_nssai, char *dnn); + pcf_ue_sm_t *pcf_ue_sm, ogs_s_nssai_t *s_nssai, char *dnn); -pcf_ue_t *pcf_ue_find_by_id(ogs_pool_id_t id); +pcf_ue_am_t *pcf_ue_am_find_by_id(ogs_pool_id_t id); +pcf_ue_sm_t *pcf_ue_sm_find_by_id(ogs_pool_id_t id); pcf_sess_t *pcf_sess_find_by_id(ogs_pool_id_t id); pcf_app_t *pcf_app_add(pcf_sess_t *sess);
View file
open5gs_2.7.5.tar.xz/src/pcf/event.h -> open5gs_2.7.6.tar.xz/src/pcf/event.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -26,14 +26,16 @@ extern "C" { #endif -typedef struct pcf_ue_s pcf_ue_t; +typedef struct pcf_ue_am_s pcf_ue_am_t; +typedef struct pcf_ue_sm_s pcf_ue_sm_t; typedef struct pcf_sess_s pcf_sess_t; typedef struct pcf_app_s pcf_app_t; typedef struct pcf_event_s { ogs_event_t h; - ogs_pool_id_t pcf_ue_id; + ogs_pool_id_t pcf_ue_am_id; + ogs_pool_id_t pcf_ue_sm_id; ogs_pool_id_t sess_id; pcf_app_t *app; } pcf_event_t;
View file
open5gs_2.7.5.tar.xz/src/pcf/init.c -> open5gs_2.7.6.tar.xz/src/pcf/init.c
Changed
@@ -74,7 +74,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -129,7 +129,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/pcf/namf-build.c -> open5gs_2.7.6.tar.xz/src/pcf/namf-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -20,21 +20,21 @@ #include "namf-build.h" ogs_sbi_request_t *pcf_namf_callback_build_am_policy_control( - pcf_ue_t *pcf_ue, void *data) + pcf_ue_am_t *pcf_ue_am, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; OpenAPI_policy_update_t PolicyUpdate; - ogs_assert(pcf_ue); - ogs_assert(pcf_ue->notification_uri); + ogs_assert(pcf_ue_am); + ogs_assert(pcf_ue_am->notification_uri); memset(&PolicyUpdate, 0, sizeof(PolicyUpdate)); memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; - message.h.uri = pcf_ue->notification_uri; + message.h.uri = pcf_ue_am->notification_uri; message.PolicyUpdate = &PolicyUpdate;
View file
open5gs_2.7.5.tar.xz/src/pcf/namf-build.h -> open5gs_2.7.6.tar.xz/src/pcf/namf-build.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -27,7 +27,7 @@ #endif ogs_sbi_request_t *pcf_namf_callback_build_am_policy_control( - pcf_ue_t *pcf_ue, void *data); + pcf_ue_am_t *pcf_ue_am, void *data); #ifdef __cplusplus }
View file
open5gs_2.7.5.tar.xz/src/pcf/nbsf-build.c -> open5gs_2.7.6.tar.xz/src/pcf/nbsf-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -22,7 +22,7 @@ ogs_sbi_request_t *pcf_nbsf_management_build_register( pcf_sess_t *sess, void *data) { - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; @@ -40,8 +40,8 @@ int i; ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST; @@ -53,8 +53,8 @@ memset(&PcfBinding, 0, sizeof(PcfBinding)); memset(&sNssai, 0, sizeof(sNssai)); - PcfBinding.supi = pcf_ue->supi; - PcfBinding.gpsi = pcf_ue->gpsi; + PcfBinding.supi = pcf_ue_sm->supi; + PcfBinding.gpsi = pcf_ue_sm->gpsi; PcfBinding.ipv4_addr = sess->ipv4addr_string; PcfBinding.ipv6_prefix = sess->ipv6prefix_string; @@ -183,14 +183,14 @@ ogs_sbi_request_t *pcf_nbsf_management_build_de_register( pcf_sess_t *sess, void *data) { - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); ogs_assert(sess->binding.resource_uri); memset(&message, 0, sizeof(message));
View file
open5gs_2.7.5.tar.xz/src/pcf/nbsf-handler.c -> open5gs_2.7.6.tar.xz/src/pcf/nbsf-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -26,7 +26,7 @@ { int rv, status = 0; char *strerror = NULL; - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; ogs_sbi_server_t *server = NULL; ogs_sbi_header_t header; @@ -42,27 +42,27 @@ ogs_sockaddr_t *addr = NULL, *addr6 = NULL; ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); ogs_assert(stream); server = ogs_sbi_server_from_stream(stream); ogs_assert(server); ogs_assert(recvmsg); - ogs_assert(pcf_ue->supi); + ogs_assert(pcf_ue_sm->supi); ogs_assert(sess->dnn); if (!recvmsg->http.location) { strerror = ogs_msprintf("%s:%d No http.location", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } if (!recvmsg->PcfBinding) { strerror = ogs_msprintf("%s:%d No PcfBinding", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } @@ -80,13 +80,13 @@ rv = ogs_sbi_parse_header(&message, &header); if (rv != OGS_OK) { strerror = ogs_msprintf("%s:%d Cannot parse http.location %s", - pcf_ue->supi, sess->psi, recvmsg->http.location); + pcf_ue_sm->supi, sess->psi, recvmsg->http.location); goto cleanup; } if (!message.h.resource.component1) { strerror = ogs_msprintf("%s:%d No Binding ID %s", - pcf_ue->supi, sess->psi, recvmsg->http.location); + pcf_ue_sm->supi, sess->psi, recvmsg->http.location); ogs_sbi_header_free(&header); goto cleanup; @@ -96,18 +96,18 @@ &scheme, &fqdn, &fqdn_port, &addr, &addr6, header.uri); if (rc == false || scheme == OpenAPI_uri_scheme_NULL) { strerror = ogs_msprintf("%s:%d Invalid URI %s", - pcf_ue->supi, sess->psi, header.uri); + pcf_ue_sm->supi, sess->psi, header.uri); ogs_sbi_header_free(&header); goto cleanup; } client = ogs_sbi_client_find(scheme, fqdn, fqdn_port, addr, addr6); if (!client) { - ogs_debug("%s:%d ogs_sbi_client_add()", pcf_ue->supi, sess->psi); + ogs_debug("%s:%d ogs_sbi_client_add()", pcf_ue_sm->supi, sess->psi); client = ogs_sbi_client_add(scheme, fqdn, fqdn_port, addr, addr6); if (!client) { strerror = ogs_msprintf("%s:%d ogs_sbi_client_add() failed", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); ogs_sbi_header_free(&header); ogs_free(fqdn);
View file
open5gs_2.7.5.tar.xz/src/pcf/nnrf-handler.c -> open5gs_2.7.6.tar.xz/src/pcf/nnrf-handler.c
Changed
@@ -29,7 +29,8 @@ ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL; ogs_sbi_discovery_option_t *discovery_option = NULL; - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; + pcf_ue_am_t *pcf_ue_am = NULL; pcf_sess_t *sess = NULL; OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL; @@ -60,13 +61,13 @@ } if (sbi_object->type == OGS_SBI_OBJ_UE_TYPE) { - pcf_ue = pcf_ue_find_by_id(sbi_object_id); - ogs_assert(pcf_ue); + pcf_ue_am = pcf_ue_am_find_by_id(sbi_object_id); + ogs_assert(pcf_ue_am); } else if (sbi_object->type == OGS_SBI_OBJ_SESS_TYPE) { sess = pcf_sess_find_by_id(sbi_object_id); ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); } else { ogs_fatal("(NF discover) Not implemented %s:%d", ogs_sbi_service_type_to_name(service_type), sbi_object->type); @@ -78,8 +79,9 @@ nf_instance = ogs_sbi_nf_instance_find_by_discovery_param( target_nf_type, requester_nf_type, discovery_option); if (!nf_instance) { - ogs_error("%s:%d (NF discover) No %s:%s", - pcf_ue ? pcf_ue->supi : "Unknown", + ogs_error("%s:%s:%d (NF discover) No %s:%s", + pcf_ue_am ? pcf_ue_am->supi : "Unknown", + pcf_ue_sm ? pcf_ue_sm->supi : "Unknown", sess ? sess->psi : 0, ogs_sbi_service_type_to_name(service_type), OpenAPI_nf_type_ToString(requester_nf_type));
View file
open5gs_2.7.5.tar.xz/src/pcf/npcf-handler.c -> open5gs_2.7.6.tar.xz/src/pcf/npcf-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -21,7 +21,7 @@ #include "npcf-handler.h" -bool pcf_npcf_am_policy_control_handle_create(pcf_ue_t *pcf_ue, +bool pcf_npcf_am_policy_control_handle_create(pcf_ue_am_t *pcf_ue_am, ogs_sbi_stream_t *stream, ogs_sbi_message_t *message) { bool rc; @@ -40,7 +40,7 @@ uint16_t fqdn_port = 0; ogs_sockaddr_t *addr = NULL, *addr6 = NULL; - ogs_assert(pcf_ue); + ogs_assert(pcf_ue_am); ogs_assert(stream); server = ogs_sbi_server_from_stream(stream); ogs_assert(server); @@ -48,35 +48,35 @@ PolicyAssociationRequest = message->PolicyAssociationRequest; if (!PolicyAssociationRequest) { - ogs_error("%s No PolicyAssociationRequest", pcf_ue->supi); + ogs_error("%s No PolicyAssociationRequest", pcf_ue_am->supi); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - message, "%s No PolicyAssociationRequest", pcf_ue->supi, + message, "%s No PolicyAssociationRequest", pcf_ue_am->supi, NULL)); return false; } if (!PolicyAssociationRequest->notification_uri) { - ogs_error("%s No notificationUri", pcf_ue->supi); + ogs_error("%s No notificationUri", pcf_ue_am->supi); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - message, "No notificationUri", pcf_ue->supi, NULL)); + message, "No notificationUri", pcf_ue_am->supi, NULL)); return false; } if (!PolicyAssociationRequest->supi) { - ogs_error("%s No supi", pcf_ue->supi); + ogs_error("%s No supi", pcf_ue_am->supi); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - message, "No supi", pcf_ue->supi, NULL)); + message, "No supi", pcf_ue_am->supi, NULL)); return false; } if (!PolicyAssociationRequest->supp_feat) { - ogs_error("%s No suppFeat", pcf_ue->supi); + ogs_error("%s No suppFeat", pcf_ue_am->supi); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - message, "No suppFeat", pcf_ue->supi, NULL)); + message, "No suppFeat", pcf_ue_am->supi, NULL)); return false; } @@ -84,18 +84,18 @@ PolicyAssociationRequest->notification_uri); if (rc == false || scheme == OpenAPI_uri_scheme_NULL) { ogs_error("%s Invalid URI %s", - pcf_ue->supi, PolicyAssociationRequest->notification_uri); + pcf_ue_am->supi, PolicyAssociationRequest->notification_uri); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, - message, "%s Invalid URI", pcf_ue->supi, NULL)); + message, "%s Invalid URI", pcf_ue_am->supi, NULL)); return false; } - if (pcf_ue->notification_uri) - ogs_free(pcf_ue->notification_uri); - pcf_ue->notification_uri = ogs_strdup( + if (pcf_ue_am->notification_uri) + ogs_free(pcf_ue_am->notification_uri); + pcf_ue_am->notification_uri = ogs_strdup( PolicyAssociationRequest->notification_uri); - ogs_assert(pcf_ue->notification_uri); + ogs_assert(pcf_ue_am->notification_uri); client = ogs_sbi_client_find(scheme, fqdn, fqdn_port, addr, addr6); if (!client) { @@ -111,7 +111,7 @@ return false; } } - OGS_SBI_SETUP_CLIENT(&pcf_ue->namf, client); + OGS_SBI_SETUP_CLIENT(&pcf_ue_am->namf, client); ogs_free(fqdn); ogs_freeaddrinfo(addr); @@ -120,26 +120,26 @@ supported_features = ogs_uint64_from_string_hexadecimal( PolicyAssociationRequest->supp_feat); - pcf_ue->am_policy_control_features &= supported_features; + pcf_ue_am->am_policy_control_features &= supported_features; if (PolicyAssociationRequest->gpsi) { - if (pcf_ue->gpsi) - ogs_free(pcf_ue->gpsi); - pcf_ue->gpsi = ogs_strdup(PolicyAssociationRequest->gpsi); + if (pcf_ue_am->gpsi) + ogs_free(pcf_ue_am->gpsi); + pcf_ue_am->gpsi = ogs_strdup(PolicyAssociationRequest->gpsi); } - pcf_ue->access_type = PolicyAssociationRequest->access_type; + pcf_ue_am->access_type = PolicyAssociationRequest->access_type; if (PolicyAssociationRequest->pei) { - if (pcf_ue->pei) - ogs_free(pcf_ue->pei); - pcf_ue->pei = ogs_strdup(PolicyAssociationRequest->pei); + if (pcf_ue_am->pei) + ogs_free(pcf_ue_am->pei); + pcf_ue_am->pei = ogs_strdup(PolicyAssociationRequest->pei); } Guami = PolicyAssociationRequest->guami; if (Guami && Guami->amf_id && Guami->plmn_id && Guami->plmn_id->mnc && Guami->plmn_id->mcc) { - ogs_sbi_parse_guami(&pcf_ue->guami, PolicyAssociationRequest->guami); + ogs_sbi_parse_guami(&pcf_ue_am->guami, PolicyAssociationRequest->guami); } OpenAPI_list_for_each(PolicyAssociationRequest->allowed_snssais, node) { @@ -149,26 +149,27 @@ s_nssai.sst = Snssai->sst; s_nssai.sd = ogs_s_nssai_sd_from_string(Snssai->sd); - pcf_metrics_inst_by_slice_add(&pcf_ue->guami.plmn_id, + pcf_metrics_inst_by_slice_add(&pcf_ue_am->guami.plmn_id, &s_nssai, PCF_METR_CTR_PA_POLICYAMASSOREQ, 1); } else { - ogs_error("%s No Snssai", pcf_ue->supi); + ogs_error("%s No Snssai", pcf_ue_am->supi); } } if (PolicyAssociationRequest->rat_type) - pcf_ue->rat_type = PolicyAssociationRequest->rat_type; + pcf_ue_am->rat_type = PolicyAssociationRequest->rat_type; - pcf_ue->policy_association_request = + pcf_ue_am->policy_association_request = OpenAPI_policy_association_request_copy( - pcf_ue->policy_association_request, + pcf_ue_am->policy_association_request, message->PolicyAssociationRequest); if (PolicyAssociationRequest->ue_ambr) - pcf_ue->subscribed_ue_ambr = OpenAPI_ambr_copy( - pcf_ue->subscribed_ue_ambr, PolicyAssociationRequest->ue_ambr); + pcf_ue_am->subscribed_ue_ambr = OpenAPI_ambr_copy( + pcf_ue_am->subscribed_ue_ambr, + PolicyAssociationRequest->ue_ambr); - if (ogs_sbi_supi_in_vplmn(pcf_ue->supi) == true) { + if (ogs_sbi_supi_in_vplmn(pcf_ue_am->supi) == true) { /* Visited PLMN */ OpenAPI_policy_association_t PolicyAssociation; @@ -177,9 +178,9 @@ ogs_sbi_response_t *response = NULL; memset(&PolicyAssociation, 0, sizeof(PolicyAssociation)); - PolicyAssociation.request = pcf_ue->policy_association_request; + PolicyAssociation.request = pcf_ue_am->policy_association_request; PolicyAssociation.supp_feat = - ogs_uint64_to_string(pcf_ue->am_policy_control_features); + ogs_uint64_to_string(pcf_ue_am->am_policy_control_features); ogs_assert(PolicyAssociation.supp_feat); memset(&header, 0, sizeof(header)); @@ -187,7 +188,7 @@ (char *)OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL; header.api.version = (char *)OGS_SBI_API_V1; header.resource.component0 = (char *)OGS_SBI_RESOURCE_NAME_POLICIES; - header.resource.component1 = pcf_ue->association_id; + header.resource.component1 = pcf_ue_am->association_id; memset(&sendmsg, 0, sizeof(sendmsg)); sendmsg.PolicyAssociation = &PolicyAssociation; @@ -205,8 +206,8 @@ return true; } else { /* Home PLMN */
View file
open5gs_2.7.5.tar.xz/src/pcf/npcf-handler.h -> open5gs_2.7.6.tar.xz/src/pcf/npcf-handler.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -26,7 +26,7 @@ extern "C" { #endif -bool pcf_npcf_am_policy_control_handle_create(pcf_ue_t *pcf_ue, +bool pcf_npcf_am_policy_control_handle_create(pcf_ue_am_t *pcf_ue_am, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg); bool pcf_npcf_smpolicycontrol_handle_create(pcf_sess_t *sess,
View file
open5gs_2.7.5.tar.xz/src/pcf/nudr-build.c -> open5gs_2.7.6.tar.xz/src/pcf/nudr-build.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -20,12 +20,12 @@ #include "nudr-build.h" ogs_sbi_request_t *pcf_nudr_dr_build_query_am_data( - pcf_ue_t *pcf_ue, void *data) + pcf_ue_am_t *pcf_ue_am, void *data) { ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; - ogs_assert(pcf_ue); + ogs_assert(pcf_ue_am); memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; @@ -33,7 +33,7 @@ message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component0 = (char *)OGS_SBI_RESOURCE_NAME_POLICY_DATA; message.h.resource.component1 = (char *)OGS_SBI_RESOURCE_NAME_UES; - message.h.resource.component2 = pcf_ue->supi; + message.h.resource.component2 = pcf_ue_am->supi; message.h.resource.component3 = (char *)OGS_SBI_RESOURCE_NAME_AM_DATA; request = ogs_sbi_build_request(&message); @@ -45,14 +45,14 @@ ogs_sbi_request_t *pcf_nudr_dr_build_query_sm_data( pcf_sess_t *sess, void *data) { - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; ogs_sbi_message_t message; ogs_sbi_request_t *request = NULL; ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); memset(&message, 0, sizeof(message)); message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET; @@ -60,7 +60,7 @@ message.h.api.version = (char *)OGS_SBI_API_V1; message.h.resource.component0 = (char *)OGS_SBI_RESOURCE_NAME_POLICY_DATA; message.h.resource.component1 = (char *)OGS_SBI_RESOURCE_NAME_UES; - message.h.resource.component2 = pcf_ue->supi; + message.h.resource.component2 = pcf_ue_sm->supi; message.h.resource.component3 = (char *)OGS_SBI_RESOURCE_NAME_SM_DATA; message.param.snssai_presence = true;
View file
open5gs_2.7.5.tar.xz/src/pcf/nudr-build.h -> open5gs_2.7.6.tar.xz/src/pcf/nudr-build.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -27,7 +27,7 @@ #endif ogs_sbi_request_t *pcf_nudr_dr_build_query_am_data( - pcf_ue_t *pcf_ue, void *data); + pcf_ue_am_t *pcf_ue_am, void *data); ogs_sbi_request_t *pcf_nudr_dr_build_query_sm_data( pcf_sess_t *sess, void *data);
View file
open5gs_2.7.5.tar.xz/src/pcf/nudr-handler.c -> open5gs_2.7.6.tar.xz/src/pcf/nudr-handler.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -22,7 +22,8 @@ #include "nudr-handler.h" bool pcf_nudr_dr_handle_query_am_data( - pcf_ue_t *pcf_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg) + pcf_ue_am_t *pcf_ue_am, + ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg) { int rv, status = 0; char *strerror = NULL; @@ -34,7 +35,7 @@ ogs_subscription_data_t subscription_data; - ogs_assert(pcf_ue); + ogs_assert(pcf_ue_am); ogs_assert(stream); server = ogs_sbi_server_from_stream(stream); ogs_assert(server); @@ -51,52 +52,52 @@ OpenAPI_lnode_t *node = NULL; if (!recvmsg->AmPolicyData) { - strerror = ogs_msprintf("%s No AmPolicyData", pcf_ue->supi); + strerror = ogs_msprintf("%s No AmPolicyData", pcf_ue_am->supi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } - if (!pcf_ue->policy_association_request) { + if (!pcf_ue_am->policy_association_request) { strerror = ogs_msprintf("%s No PolicyAssociationRequest", - pcf_ue->supi); + pcf_ue_am->supi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } - rv = ogs_dbi_subscription_data(pcf_ue->supi, &subscription_data); + rv = ogs_dbi_subscription_data(pcf_ue_am->supi, &subscription_data); if (rv != OGS_OK) { strerror = ogs_msprintf("%s Cannot find SUPI in DB", - pcf_ue->supi); + pcf_ue_am->supi); status = OGS_SBI_HTTP_STATUS_NOT_FOUND; goto cleanup; } if (!subscription_data.ambr.uplink && !subscription_data.ambr.downlink) { - strerror = ogs_msprintf("%s No UE-AMBR", pcf_ue->supi); + strerror = ogs_msprintf("%s No UE-AMBR", pcf_ue_am->supi); status = OGS_SBI_HTTP_STATUS_NOT_FOUND; goto cleanup; } memset(&PolicyAssociation, 0, sizeof(PolicyAssociation)); - PolicyAssociation.request = pcf_ue->policy_association_request; + PolicyAssociation.request = pcf_ue_am->policy_association_request; PolicyAssociation.supp_feat = - ogs_uint64_to_string(pcf_ue->am_policy_control_features); + ogs_uint64_to_string(pcf_ue_am->am_policy_control_features); ogs_assert(PolicyAssociation.supp_feat); TriggerList = OpenAPI_list_create(); ogs_assert(TriggerList); memset(&UeAmbr, 0, sizeof(UeAmbr)); - if (OGS_SBI_FEATURES_IS_SET(pcf_ue->am_policy_control_features, + if (OGS_SBI_FEATURES_IS_SET(pcf_ue_am->am_policy_control_features, OGS_SBI_NPCF_AM_POLICY_CONTROL_UE_AMBR_AUTHORIZATION)) { - if (pcf_ue->subscribed_ue_ambr) { + if (pcf_ue_am->subscribed_ue_ambr) { ogs_bitrate_t subscribed_ue_ambr; subscribed_ue_ambr.uplink = ogs_sbi_bitrate_from_string( - pcf_ue->subscribed_ue_ambr->uplink); + pcf_ue_am->subscribed_ue_ambr->uplink); subscribed_ue_ambr.downlink = ogs_sbi_bitrate_from_string( - pcf_ue->subscribed_ue_ambr->downlink); + pcf_ue_am->subscribed_ue_ambr->downlink); if (((subscribed_ue_ambr.uplink / 1000) != (subscription_data.ambr.uplink / 1000)) || @@ -124,7 +125,7 @@ header.api.version = (char *)OGS_SBI_API_V1; header.resource.component0 = (char *)OGS_SBI_RESOURCE_NAME_POLICIES; - header.resource.component1 = pcf_ue->association_id; + header.resource.component1 = pcf_ue_am->association_id; memset(&sendmsg, 0, sizeof(sendmsg)); sendmsg.PolicyAssociation = &PolicyAssociation; @@ -148,17 +149,18 @@ ogs_subscription_data_free(&subscription_data); - OpenAPI_list_for_each(PolicyAssociation.request->allowed_snssais, node) { + OpenAPI_list_for_each( + PolicyAssociation.request->allowed_snssais, node) { struct OpenAPI_snssai_s *Snssai = node->data; if (Snssai) { ogs_s_nssai_t s_nssai; s_nssai.sst = Snssai->sst; s_nssai.sd = ogs_s_nssai_sd_from_string(Snssai->sd); - pcf_metrics_inst_by_slice_add(&pcf_ue->guami.plmn_id, + pcf_metrics_inst_by_slice_add(&pcf_ue_am->guami.plmn_id, &s_nssai, PCF_METR_CTR_PA_POLICYAMASSOSUCC, 1); } else { - ogs_error("%s No Snssai", pcf_ue->supi); + ogs_error("%s No Snssai", pcf_ue_am->supi); } } @@ -166,7 +168,7 @@ DEFAULT strerror = ogs_msprintf("%s Invalid resource name %s", - pcf_ue->supi, recvmsg->h.resource.component3); + pcf_ue_am->supi, recvmsg->h.resource.component3); END cleanup: @@ -188,13 +190,13 @@ { int status = 0; char *strerror = NULL; - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; ogs_sbi_server_t *server = NULL; int r; ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); ogs_assert(stream); server = ogs_sbi_server_from_stream(stream); ogs_assert(server); @@ -205,7 +207,7 @@ CASE(OGS_SBI_RESOURCE_NAME_SM_DATA) if (!recvmsg->SmPolicyData) { strerror = ogs_msprintf("%s:%d No SmPolicyData", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } @@ -221,7 +223,8 @@ DEFAULT strerror = ogs_msprintf("%s:%d Invalid resource name %s", - pcf_ue->supi, sess->psi, recvmsg->h.resource.component3); + pcf_ue_sm->supi, sess->psi, + recvmsg->h.resource.component3); END cleanup:
View file
open5gs_2.7.5.tar.xz/src/pcf/nudr-handler.h -> open5gs_2.7.6.tar.xz/src/pcf/nudr-handler.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -27,7 +27,8 @@ #endif bool pcf_nudr_dr_handle_query_am_data( - pcf_ue_t *pcf_ue, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg); + pcf_ue_am_t *pcf_ue_am, + ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg); bool pcf_nudr_dr_handle_query_sm_data( pcf_sess_t *sess, ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
View file
open5gs_2.7.5.tar.xz/src/pcf/pcf-sm.c -> open5gs_2.7.6.tar.xz/src/pcf/pcf-sm.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -53,8 +53,9 @@ ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL; - pcf_ue_t *pcf_ue = NULL; - ogs_pool_id_t pcf_ue_id = OGS_INVALID_POOL_ID; + pcf_ue_am_t *pcf_ue_am = NULL; + ogs_pool_id_t pcf_ue_am_id = OGS_INVALID_POOL_ID; + pcf_ue_sm_t *pcf_ue_sm = NULL; pcf_sess_t *sess = NULL; ogs_pool_id_t sess_id = OGS_INVALID_POOL_ID; pcf_app_t *app_session = NULL; @@ -140,18 +141,18 @@ CASE(OGS_SBI_HTTP_METHOD_POST) if (message.PolicyAssociationRequest && message.PolicyAssociationRequest->supi) { - pcf_ue = pcf_ue_find_by_supi( + pcf_ue_am = pcf_ue_am_find_by_supi( message.PolicyAssociationRequest->supi); - if (!pcf_ue) { - pcf_ue = pcf_ue_add( + if (!pcf_ue_am) { + pcf_ue_am = pcf_ue_am_add( message.PolicyAssociationRequest->supi); - ogs_assert(pcf_ue); + ogs_assert(pcf_ue_am); } } break; CASE(OGS_SBI_HTTP_METHOD_DELETE) if (message.h.resource.component1) { - pcf_ue = pcf_ue_find_by_association_id( + pcf_ue_am = pcf_ue_am_find_by_association_id( message.h.resource.component1); } else { ogs_error("No Policy Association Id"); @@ -160,7 +161,7 @@ DEFAULT END - if (!pcf_ue) { + if (!pcf_ue_am) { ogs_error("Not found %s", message.h.method); ogs_assert(true == ogs_sbi_server_send_error(stream, @@ -169,17 +170,17 @@ break; } - ogs_assert(OGS_FSM_STATE(&pcf_ue->sm)); + ogs_assert(OGS_FSM_STATE(&pcf_ue_am->sm)); - e->pcf_ue_id = pcf_ue->id; + e->pcf_ue_am_id = pcf_ue_am->id; e->h.sbi.message = &message; - ogs_fsm_dispatch(&pcf_ue->sm, e); - if (OGS_FSM_CHECK(&pcf_ue->sm, pcf_am_state_exception)) { - ogs_error("%s State machine exception", pcf_ue->supi); - pcf_ue_remove(pcf_ue); - } else if (OGS_FSM_CHECK(&pcf_ue->sm, pcf_am_state_deleted)) { - ogs_debug("%s PCF-AM removed", pcf_ue->supi); - pcf_ue_remove(pcf_ue); + ogs_fsm_dispatch(&pcf_ue_am->sm, e); + if (OGS_FSM_CHECK(&pcf_ue_am->sm, pcf_am_state_exception)) { + ogs_error("%s State machine exception", pcf_ue_am->supi); + pcf_ue_am_remove(pcf_ue_am); + } else if (OGS_FSM_CHECK(&pcf_ue_am->sm, pcf_am_state_deleted)) { + ogs_debug("%s PCF-AM removed", pcf_ue_am->supi); + pcf_ue_am_remove(pcf_ue_am); } break; @@ -191,14 +192,14 @@ message.SmPolicyContextData->supi && message.SmPolicyContextData->pdu_session_id) { - pcf_ue = pcf_ue_find_by_supi( + pcf_ue_sm = pcf_ue_sm_find_by_supi( message.SmPolicyContextData->supi); - if (!pcf_ue) { + if (!pcf_ue_sm) { if (!strcmp(message.h.method, OGS_SBI_HTTP_METHOD_POST)) { - pcf_ue = pcf_ue_add( + pcf_ue_sm = pcf_ue_sm_add( message.SmPolicyContextData->supi); - if (!pcf_ue) { + if (!pcf_ue_sm) { ogs_error("%s:%d Invalid Request %s", message.SmPolicyContextData->supi, message.SmPolicyContextData-> @@ -218,13 +219,13 @@ } } - if (pcf_ue) { - sess = pcf_sess_find_by_psi(pcf_ue, message. + if (pcf_ue_sm) { + sess = pcf_sess_find_by_psi(pcf_ue_sm, message. SmPolicyContextData->pdu_session_id); if (!sess) { if (!strcmp(message.h.method, OGS_SBI_HTTP_METHOD_POST)) { - sess = pcf_sess_add(pcf_ue, message. + sess = pcf_sess_add(pcf_ue_sm, message. SmPolicyContextData->pdu_session_id); if (!sess) { ogs_error("%s:%d " @@ -236,7 +237,7 @@ message.h.method); } else ogs_debug("%s:%d PCF session added", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); } else { ogs_error("%s:%d " "Invalid HTTP method %s", @@ -258,15 +259,15 @@ END if (!sess) { ogs_error("Not found %s", message.h.uri); - /* - * TS29.512 - * 4.2.2.2 SM Policy Association establishment - * - * If the user information received within the "supi" attribute is - * unknown, the PCF shall reject the request with an HTTP "400 Bad - * Request" response message including the "cause" attribute - * of the ProblemDetails data structure set to "USER_UNKNOWN". - */ + /* + * TS29.512 + * 4.2.2.2 SM Policy Association establishment + * + * If the user information received within the "supi" attribute is + * unknown, the PCF shall reject the request with an HTTP "400 Bad + * Request" response message including the "cause" attribute + * of the ProblemDetails data structure set to "USER_UNKNOWN". + */ ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, @@ -280,10 +281,11 @@ e->h.sbi.message = &message; ogs_fsm_dispatch(&sess->sm, e); if (OGS_FSM_CHECK(&sess->sm, pcf_sm_state_exception)) { - /* Clang scan-build SA: NULL pointer dereference: pcf_ue=NULL, remove logging of pcf_ue->supi. */ + /* Clang scan-build SA: NULL pointer dereference: + * pcf_ue_sm=NULL, remove logging of pcf_ue_sm->supi. */ ogs_error("%s:%d State machine exception", - pcf_ue ? pcf_ue->supi : "Unknown", sess->psi); - pcf_sess_remove(sess); + pcf_ue_sm ? pcf_ue_sm->supi : "Unknown", sess->psi); + PCF_SESS_CLEAR(sess); } break; @@ -332,10 +334,11 @@ e->h.sbi.message = &message; ogs_fsm_dispatch(&sess->sm, e); if (OGS_FSM_CHECK(&sess->sm, pcf_sm_state_exception)) { - /* Clang scan-build SA: NULL pointer dereference: pcf_ue=NULL, remove logging of pcf_ue->supi. */ + /* Clang scan-build SA: NULL pointer dereference: + * pcf_ue_sm=NULL, remove logging of pcf_ue_sm->supi. */ ogs_error("%s:%d State machine exception", - pcf_ue ? pcf_ue->supi : "Unknown", sess->psi); - pcf_sess_remove(sess); + pcf_ue_sm ? pcf_ue_sm->supi : "Unknown", sess->psi); + PCF_SESS_CLEAR(sess); } break; @@ -378,10 +381,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be
View file
open5gs_2.7.5.tar.xz/src/pcf/sbi-path.c -> open5gs_2.7.6.tar.xz/src/pcf/sbi-path.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -37,6 +37,7 @@ ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SCP); ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AMF); ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_SMF); + ogs_sbi_nf_instance_add_allowed_nf_type(nf_instance, OpenAPI_nf_type_AF); /* Build NF service information. It will be transmitted to NRF. */ if (ogs_sbi_nf_service_is_available( @@ -68,6 +69,8 @@ ogs_assert(service); ogs_sbi_nf_service_add_version( service, OGS_SBI_API_V1, OGS_SBI_API_V1_0_0, NULL); + ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_AF); + ogs_sbi_nf_service_add_allowed_nf_type(service, OpenAPI_nf_type_PCF); policyauthorization_enabled = true; } @@ -166,23 +169,23 @@ return OGS_OK; } -int pcf_ue_sbi_discover_and_send( +int pcf_ue_am_sbi_discover_and_send( ogs_sbi_service_type_e service_type, ogs_sbi_discovery_option_t *discovery_option, - ogs_sbi_request_t *(*build)(pcf_ue_t *pcf_ue, void *data), - pcf_ue_t *pcf_ue, ogs_sbi_stream_t *stream, void *data) + ogs_sbi_request_t *(*build)(pcf_ue_am_t *pcf_ue_am, void *data), + pcf_ue_am_t *pcf_ue_am, ogs_sbi_stream_t *stream, void *data) { int r; r = pcf_sbi_discover_and_send( - pcf_ue->id, &pcf_ue->sbi, service_type, discovery_option, - (ogs_sbi_build_f)build, pcf_ue, stream, data); + pcf_ue_am->id, &pcf_ue_am->sbi, service_type, discovery_option, + (ogs_sbi_build_f)build, pcf_ue_am, stream, data); if (r != OGS_OK) { - ogs_error("pcf_ue_sbi_discover_and_send() failed"); + ogs_error("pcf_ue_am_sbi_discover_and_send() failed"); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, - "Cannot discover", pcf_ue->supi, NULL)); + "Cannot discover", pcf_ue_am->supi, NULL)); return r; } @@ -257,17 +260,17 @@ return OGS_OK; } -bool pcf_sbi_send_am_policy_control_notify(pcf_ue_t *pcf_ue) +bool pcf_sbi_send_am_policy_control_notify(pcf_ue_am_t *pcf_ue_am) { bool rc; ogs_sbi_request_t *request = NULL; ogs_sbi_client_t *client = NULL; - ogs_assert(pcf_ue); - client = pcf_ue->namf.client; + ogs_assert(pcf_ue_am); + client = pcf_ue_am->namf.client; ogs_assert(client); - request = pcf_namf_callback_build_am_policy_control(pcf_ue, NULL); + request = pcf_namf_callback_build_am_policy_control(pcf_ue_am, NULL); if (!request) { ogs_error("pcf_namf_callback_build_am_policy_control() failed"); return false; @@ -287,7 +290,7 @@ { int i, rv, status = 0; char *strerror = NULL; - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; ogs_sbi_server_t *server = NULL; ogs_sbi_message_t sendmsg; @@ -320,24 +323,24 @@ OpenAPI_list_t *PolicyCtrlReqTriggers = NULL; ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); ogs_assert(stream); server = ogs_sbi_server_from_stream(stream); ogs_assert(server); memset(&session_data, 0, sizeof(ogs_session_data_t)); - ogs_assert(pcf_ue->supi); + ogs_assert(pcf_ue_sm->supi); ogs_assert(sess->dnn); rv = pcf_db_qos_data( - pcf_ue->supi, + pcf_ue_sm->supi, sess->home.presence == true ? &sess->home.plmn_id : NULL, &sess->s_nssai, sess->dnn, &session_data); if (rv != OGS_OK) { strerror = ogs_msprintf("%s:%d Cannot find SUPI in DB", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_NOT_FOUND; goto cleanup; } @@ -345,20 +348,20 @@ session = &session_data.session; if (!session->qos.index) { - strerror = ogs_msprintf("%s:%d No 5QI", pcf_ue->supi, sess->psi); + strerror = ogs_msprintf("%s:%d No 5QI", pcf_ue_sm->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } if (!session->qos.arp.priority_level) { strerror = ogs_msprintf("%s:%d No Priority Level", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } if (!session->ambr.uplink && !session->ambr.downlink) { strerror = ogs_msprintf("%s:%d No Session-AMBR", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); status = OGS_SBI_HTTP_STATUS_BAD_REQUEST; goto cleanup; } @@ -596,7 +599,8 @@ if (SmPolicyDecision.supp_feat) ogs_free(SmPolicyDecision.supp_feat); - pcf_metrics_inst_by_slice_add(&pcf_ue->guami.plmn_id, + pcf_metrics_inst_by_slice_add( + sess->home.presence == true ? &sess->home.plmn_id : NULL, &sess->s_nssai, PCF_METR_CTR_PA_POLICYSMASSOSUCC, 1); OGS_SESSION_DATA_FREE(&session_data);
View file
open5gs_2.7.5.tar.xz/src/pcf/sbi-path.h -> open5gs_2.7.6.tar.xz/src/pcf/sbi-path.h
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -35,18 +35,18 @@ bool pcf_sbi_send_request( ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact); -int pcf_ue_sbi_discover_and_send( +int pcf_ue_am_sbi_discover_and_send( ogs_sbi_service_type_e service_type, ogs_sbi_discovery_option_t *discovery_option, - ogs_sbi_request_t *(*build)(pcf_ue_t *pcf_ue, void *data), - pcf_ue_t *pcf_ue, ogs_sbi_stream_t *stream, void *data); + ogs_sbi_request_t *(*build)(pcf_ue_am_t *pcf_ue_am, void *data), + pcf_ue_am_t *pcf_ue_am, ogs_sbi_stream_t *stream, void *data); int pcf_sess_sbi_discover_and_send( ogs_sbi_service_type_e service_type, ogs_sbi_discovery_option_t *discovery_option, ogs_sbi_request_t *(*build)(pcf_sess_t *sess, void *data), pcf_sess_t *sess, ogs_sbi_stream_t *stream, void *data); -bool pcf_sbi_send_am_policy_control_notify(pcf_ue_t *pcf_ue); +bool pcf_sbi_send_am_policy_control_notify(pcf_ue_am_t *pcf_ue_am); bool pcf_sbi_send_smpolicycontrol_create_response( pcf_sess_t *sess, ogs_sbi_stream_t *stream); bool pcf_sbi_send_smpolicycontrol_update_notify(
View file
open5gs_2.7.5.tar.xz/src/pcf/sm-sm.c -> open5gs_2.7.6.tar.xz/src/pcf/sm-sm.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -38,7 +38,7 @@ void pcf_sm_state_operational(ogs_fsm_t *s, pcf_event_t *e) { bool handled; - pcf_ue_t *pcf_ue = NULL; + pcf_ue_sm_t *pcf_ue_sm = NULL; pcf_sess_t *sess = NULL; ogs_sbi_stream_t *stream = NULL; @@ -52,8 +52,8 @@ sess = pcf_sess_find_by_id(e->sess_id); ogs_assert(sess); - pcf_ue = pcf_ue_find_by_id(sess->pcf_ue_id); - ogs_assert(pcf_ue); + pcf_ue_sm = pcf_ue_sm_find_by_id(sess->pcf_ue_sm_id); + ogs_assert(pcf_ue_sm); switch (e->h.id) { case OGS_FSM_ENTRY_SIG: @@ -84,7 +84,7 @@ if (!handled) { ogs_error("%s:%d " "pcf_npcf_smpolicycontrol_handle_create() failed", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); OGS_FSM_TRAN(s, pcf_sm_state_exception); } } else { @@ -95,14 +95,14 @@ if (!handled) { ogs_error("%s:%d " "pcf_npcf_smpolicycontrol_handle_delete() failed", - pcf_ue->supi, sess->psi); + pcf_ue_sm->supi, sess->psi); OGS_FSM_TRAN(s, pcf_sm_state_exception); } break; DEFAULT ogs_error("%s:%d Invalid HTTP URI %s", - pcf_ue->supi, sess->psi, message->h.uri); + pcf_ue_sm->supi, sess->psi, message->h.uri); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, @@ -121,7 +121,7 @@ break; DEFAULT ogs_error("%s:%d Invalid resource name %s", - pcf_ue->supi, sess->psi, + pcf_ue_sm->supi, sess->psi, message->h.resource.component2); ogs_assert(true == ogs_sbi_server_send_error(stream, @@ -136,7 +136,7 @@ break; DEFAULT ogs_error("%s:%d Unknown method %s", - pcf_ue->supi, sess->psi, message->h.method); + pcf_ue_sm->supi, sess->psi, message->h.method); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, @@ -151,7 +151,7 @@ break; DEFAULT ogs_error("%s:%d Unknown method %s", - pcf_ue->supi, sess->psi, message->h.method); + pcf_ue_sm->supi, sess->psi, message->h.method); ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_METHOD_NOT_ALLOWED, message, @@ -162,7 +162,7 @@ DEFAULT ogs_error("%s:%d Invalid API name %s", - pcf_ue->supi, sess->psi, message->h.service.name); + pcf_ue_sm->supi, sess->psi, message->h.service.name); ogs_assert_if_reached(); END break; @@ -192,42 +192,44 @@ if (message->res_status == OGS_SBI_HTTP_STATUS_NOT_FOUND) { ogs_warn("%s:%d Cannot find SUPI %d", - pcf_ue->supi, sess->psi, message->res_status); - /* - * TS29.512 - * 4.2.2.2 SM Policy Association establishment - * - * If the user information received within the "supi" - * attribute is unknown, the PCF shall reject the - * request with an HTTP "400 Bad Request" response - * message including the "cause" attribute of the - * ProblemDetails data structure set to "USER_UNKNOWN". - */ + pcf_ue_sm->supi, + sess->psi, message->res_status); + /* + * TS29.512 + * 4.2.2.2 SM Policy Association establishment + * + * If the user information received within the "supi" + * attribute is unknown, the PCF shall reject the + * request with an HTTP "400 Bad Request" response + * message including the "cause" attribute of the + * ProblemDetails data structure set to "USER_UNKNOWN". + */ ogs_assert(true == ogs_sbi_server_send_error( stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, NULL, "End user is unknown to the PCF", - pcf_ue->supi, "USER_UNKNOWN")); + pcf_ue_sm->supi, "USER_UNKNOWN")); } else { ogs_error("%s:%d HTTP response error %d", - pcf_ue->supi, sess->psi, message->res_status); - /* - * TS29.512 - * 4.2.2.2 SM Policy Association establishment - * - * If the PCF, based on local configuration and/or - * operator policies, denies the creation of the - * Individual SM Policy resource, the PCF may reject - * the request and include in an HTTP "403 Forbidden" - * response message the "cause" attribute of the - * ProblemDetails data structure set to - * "POLICY_CONTEXT_DENIED". - */ + pcf_ue_sm->supi, + sess->psi, message->res_status); + /* + * TS29.512 + * 4.2.2.2 SM Policy Association establishment + * + * If the PCF, based on local configuration and/or + * operator policies, denies the creation of the + * Individual SM Policy resource, the PCF may reject + * the request and include in an HTTP "403 Forbidden" + * response message the "cause" attribute of the + * ProblemDetails data structure set to + * "POLICY_CONTEXT_DENIED". + */ ogs_assert(true == ogs_sbi_server_send_error( stream, OGS_SBI_HTTP_STATUS_FORBIDDEN, NULL, "HTTP response error", - pcf_ue->supi, "POLICY_CONTEXT_DENIED")); + pcf_ue_sm->supi, "POLICY_CONTEXT_DENIED")); } break; } @@ -237,7 +239,7 @@ DEFAULT ogs_error("%s:%d Invalid resource name %s", - pcf_ue->supi, sess->psi, + pcf_ue_sm->supi, sess->psi, message->h.resource.component1); ogs_assert_if_reached(); END @@ -245,7 +247,7 @@ DEFAULT ogs_error("%s:%d Invalid resource name %s", - pcf_ue->supi, sess->psi, + pcf_ue_sm->supi, sess->psi, message->h.resource.component0); ogs_assert_if_reached(); END @@ -260,7 +262,7 @@ if (message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT) { ogs_warn("%s:%d HTTP response error %d", - pcf_ue->supi, sess->psi, message->res_status); + pcf_ue_sm->supi, sess->psi, message->res_status); /* * The PCfBindings resource for that UE may not exist in the BSF @@ -272,7 +274,8 @@ ogs_assert(true == ogs_sbi_server_send_error(stream, message->res_status, - NULL, "HTTP response error", pcf_ue->supi)); + NULL, "HTTP response error", + pcf_ue_sm->supi)); OGS_FSM_TRAN(s, pcf_sm_state_exception); break; #endif @@ -284,7 +287,7 @@ break; DEFAULT
View file
open5gs_2.7.5.tar.xz/src/pcrf/pcrf-init.c -> open5gs_2.7.6.tar.xz/src/pcrf/pcrf-init.c
Changed
@@ -103,7 +103,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/scp/init.c -> open5gs_2.7.6.tar.xz/src/scp/init.c
Changed
@@ -63,7 +63,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -110,7 +110,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/scp/scp-sm.c -> open5gs_2.7.6.tar.xz/src/scp/scp-sm.c
Changed
@@ -167,10 +167,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
View file
open5gs_2.7.5.tar.xz/src/sepp/app.c -> open5gs_2.7.6.tar.xz/src/sepp/app.c
Changed
@@ -25,7 +25,7 @@ rv = sepp_initialize(); if (rv != OGS_OK) { - ogs_error("Failed to intialize SEPP"); + ogs_error("Failed to initialize SEPP"); return rv; } ogs_info("SEPP initialize...done");
View file
open5gs_2.7.5.tar.xz/src/sepp/init.c -> open5gs_2.7.6.tar.xz/src/sepp/init.c
Changed
@@ -64,7 +64,7 @@ ogs_sbi_nf_instance_t *nf_instance = NULL; sepp_node_t *sepp_node = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -115,7 +115,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/sepp/sepp-sm.c -> open5gs_2.7.6.tar.xz/src/sepp/sepp-sm.c
Changed
@@ -241,11 +241,32 @@ nf_instance = e->h.sbi.data; ogs_assert(nf_instance); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ old_state = OGS_FSM_STATE(&nf_instance->sm); - ogs_assert(old_state); - - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + if (old_state) { + e->h.sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); /* * The SEPP on the H-PLMN should send a n32c-handshake message
View file
open5gs_2.7.5.tar.xz/src/sgwc/context.h -> open5gs_2.7.6.tar.xz/src/sgwc/context.h
Changed
@@ -83,7 +83,7 @@ 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 NODE */ + uint64_t sgwc_sxa_seid; /* SGW-C SEID is derived from NODE */ uint64_t sgwu_sxa_seid; /* SGW-U SEID is received from Peer */ /* APN Configuration */
View file
open5gs_2.7.5.tar.xz/src/sgwc/init.c -> open5gs_2.7.6.tar.xz/src/sgwc/init.c
Changed
@@ -110,7 +110,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/sgwc/pfcp-path.c -> open5gs_2.7.6.tar.xz/src/sgwc/pfcp-path.c
Changed
@@ -19,7 +19,7 @@ #include "pfcp-path.h" -static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_assoicate) +static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_associate) { sgwc_event_t e; @@ -28,7 +28,7 @@ memset(&e, 0, sizeof(e)); e.pfcp_node = node; - if (try_to_assoicate == true) { + if (try_to_associate == true) { node->t_association = ogs_timer_add(ogs_app()->timer_mgr, sgwc_timer_pfcp_association, node); ogs_assert(node->t_association);
View file
open5gs_2.7.5.tar.xz/src/sgwu/context.h -> open5gs_2.7.6.tar.xz/src/sgwu/context.h
Changed
@@ -52,7 +52,7 @@ ogs_pfcp_sess_t pfcp; - uint64_t sgwu_sxa_seid; /* SGW-U SEID is dervied from INDEX */ + uint64_t sgwu_sxa_seid; /* SGW-U SEID is derived from INDEX */ struct { uint64_t seid; ogs_ip_t ip;
View file
open5gs_2.7.5.tar.xz/src/sgwu/init.c -> open5gs_2.7.6.tar.xz/src/sgwu/init.c
Changed
@@ -107,7 +107,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/sgwu/pfcp-path.c -> open5gs_2.7.6.tar.xz/src/sgwu/pfcp-path.c
Changed
@@ -19,7 +19,7 @@ #include "pfcp-path.h" -static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_assoicate) +static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_associate) { sgwu_event_t e; @@ -28,7 +28,7 @@ memset(&e, 0, sizeof(e)); e.pfcp_node = node; - if (try_to_assoicate == true) { + if (try_to_associate == true) { node->t_association = ogs_timer_add(ogs_app()->timer_mgr, sgwu_timer_association, node); ogs_assert(node->t_association);
View file
open5gs_2.7.5.tar.xz/src/sgwu/sxa-handler.c -> open5gs_2.7.6.tar.xz/src/sgwu/sxa-handler.c
Changed
@@ -363,7 +363,7 @@ ogs_pfcp_xact_commit(xact); - ogs_debug("Session report resopnse"); + ogs_debug("Session report response"); cause_value = OGS_PFCP_CAUSE_REQUEST_ACCEPTED;
View file
open5gs_2.7.5.tar.xz/src/smf/context.c -> open5gs_2.7.6.tar.xz/src/smf/context.c
Changed
@@ -1084,6 +1084,9 @@ ogs_free(smf_ue->supi); } + if (smf_ue->gpsi) + ogs_free(smf_ue->gpsi); + if (smf_ue->imsi_len) { ogs_hash_set(self.imsi_hash, smf_ue->imsi, smf_ue->imsi_len, NULL); } @@ -1194,14 +1197,19 @@ ogs_pfcp_self()->pfcp_node = ogs_list_last(&ogs_pfcp_self()->pfcp_peer_list); - /* setup GTP session with selected UPF */ - ogs_pfcp_self()->pfcp_node = - selected_upf_node(ogs_pfcp_self()->pfcp_node, sess); - ogs_assert(ogs_pfcp_self()->pfcp_node); - OGS_SETUP_PFCP_NODE(sess, ogs_pfcp_self()->pfcp_node); - ogs_debug("UE using UPF on IP %s", - ogs_sockaddr_to_string_static( - ogs_pfcp_self()->pfcp_node->addr_list)); + if (ogs_pfcp_self()->pfcp_node) { + /* setup GTP session with selected UPF */ + ogs_pfcp_self()->pfcp_node = + selected_upf_node(ogs_pfcp_self()->pfcp_node, sess); + ogs_assert(ogs_pfcp_self()->pfcp_node); + OGS_SETUP_PFCP_NODE(sess, ogs_pfcp_self()->pfcp_node); + ogs_debug("UE using UPF on IP %s", + ogs_sockaddr_to_string_static( + ogs_pfcp_self()->pfcp_node->addr_list)); + } else { + ogs_error("No suitable UPF found for session"); + ogs_assert(sess->pfcp_node == NULL); + } } smf_sess_t *smf_sess_add_by_apn(smf_ue_t *smf_ue, char *apn, uint8_t rat_type) @@ -1505,7 +1513,7 @@ } if (SmContextCreateData->is_pdu_session_id == false) { - ogs_error("PDU session identitiy is unassigned"); + ogs_error("PDU session identity is unassigned"); return NULL; } @@ -2923,7 +2931,11 @@ memset(&pco_ipcp, 0, sizeof(pco_ipcp)); size = ogs_pco_parse(&ue, buffer, length); - ogs_assert(size); + if (size != length) { + ogs_error("ogs_pco_parse() failed size:%d != length:%d", + size, length); + return 0; + } memset(&smf, 0, sizeof(ogs_pco_t)); smf.ext = ue.ext; @@ -3135,6 +3147,7 @@ } size = ogs_pco_build(pco_buf, OGS_MAX_PCO_LEN, &smf); + ogs_expect(size > 0); return size; }
View file
open5gs_2.7.5.tar.xz/src/smf/context.h -> open5gs_2.7.6.tar.xz/src/smf/context.h
Changed
@@ -117,6 +117,9 @@ /* SUPI */ char *supi; + /* GPSI */ + char *gpsi; + /* IMSI */ uint8_t imsiOGS_MAX_IMSI_LEN; int imsi_len; @@ -254,7 +257,7 @@ 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 NODE */ + uint64_t smf_n4_seid; /* SMF SEID is derived from NODE */ uint64_t upf_n4_seid; /* UPF SEID is received from Peer */ uint32_t upf_n3_teid; /* UPF-N3 TEID */
View file
open5gs_2.7.5.tar.xz/src/smf/gn-build.c -> open5gs_2.7.6.tar.xz/src/smf/gn-build.c
Changed
@@ -214,7 +214,12 @@ sess->gtp.ue_pco.len && sess->gtp.ue_pco.data) { pco_len = smf_pco_build( pco_buf, sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); - ogs_assert(pco_len > 0); + if (pco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); + return NULL; + } rsp->protocol_configuration_options.presence = 1; rsp->protocol_configuration_options.data = pco_buf; rsp->protocol_configuration_options.len = pco_len; @@ -382,7 +387,12 @@ sess->gtp.ue_pco.len && sess->gtp.ue_pco.data) { pco_len = smf_pco_build( pco_buf, sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); - ogs_assert(pco_len > 0); + if (pco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); + return NULL; + } rsp->protocol_configuration_options.presence = 1; rsp->protocol_configuration_options.data = pco_buf; rsp->protocol_configuration_options.len = pco_len; @@ -445,7 +455,12 @@ sess->gtp.ue_pco.len && sess->gtp.ue_pco.data) { pco_len = smf_pco_build( pco_buf, sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); - ogs_assert(pco_len > 0); + if (pco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); + return NULL; + } rsp->protocol_configuration_options.presence = 1; rsp->protocol_configuration_options.data = pco_buf; rsp->protocol_configuration_options.len = pco_len;
View file
open5gs_2.7.5.tar.xz/src/smf/gn-handler.c -> open5gs_2.7.6.tar.xz/src/smf/gn-handler.c
Changed
@@ -284,10 +284,19 @@ /* Select PGW based on UE Location Information */ smf_sess_select_upf(sess); + /* Check if UPF selection was successful */ + if (!sess->pfcp_node) { + ogs_error("%s:%s No UPF available for session", + smf_ue->imsi_bcd, sess->session.name); + return OGS_GTP1_CAUSE_SYSTEM_FAILURE; + } + /* Check if selected PGW is associated with SMF */ - ogs_assert(sess->pfcp_node); - if (!OGS_FSM_CHECK(&sess->pfcp_node->sm, smf_pfcp_state_associated)) + if (!OGS_FSM_CHECK(&sess->pfcp_node->sm, smf_pfcp_state_associated)) { + ogs_error("%s:%s selected UPF is not assocated with SMF", + smf_ue->imsi_bcd, sess->session.name); return OGS_GTP1_CAUSE_NO_RESOURCES_AVAILABLE; + } if ((pfcp_cause = smf_sess_set_ue_ip(sess)) != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) { cause_value = gtp_cause_from_pfcp(pfcp_cause, 1);
View file
open5gs_2.7.5.tar.xz/src/smf/gsm-build.c -> open5gs_2.7.6.tar.xz/src/smf/gsm-build.c
Changed
@@ -225,7 +225,12 @@ 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); + if (epco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->nas.ue_epco.buffer, sess->nas.ue_epco.length); + goto cleanup; + } pdu_session_establishment_accept->presencemask |= OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_PRESENT; extended_protocol_configuration_options->buffer = epco_buf;
View file
open5gs_2.7.5.tar.xz/src/smf/gsm-sm.c -> open5gs_2.7.6.tar.xz/src/smf/gsm-sm.c
Changed
@@ -748,7 +748,12 @@ param.state = SMF_UE_REQUESTED_PDU_SESSION_ESTABLISHMENT; param.n1smbuf = gsm_build_pdu_session_establishment_accept(sess); - ogs_assert(param.n1smbuf); + if (!param.n1smbuf) { + ogs_error("gsm_build_pdu_session_establishment_accept() " + "failed"); + OGS_FSM_TRAN(s, smf_gsm_state_5gc_n1_n2_reject); + return; + } param.n2smbuf = ngap_build_pdu_session_resource_setup_request_transfer( sess); @@ -1584,6 +1589,23 @@ stream, OGS_SBI_HTTP_STATUS_BAD_REQUEST, n1smbuf, OpenAPI_n2_sm_info_type_NULL, NULL); break; + CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) + SWITCH(sbi_message->h.resource.component0) + CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXTS) + ogs_error("%s:%d Ignore SBI message " + "state %d res_status %d", + smf_ue->supi, sess->psi, + e->h.sbi.state, sbi_message->res_status); + break; + + DEFAULT + ogs_error("%s:%d Invalid resource name %s", + smf_ue->supi, sess->psi, + sbi_message->h.resource.component0); + ogs_assert_if_reached(); + END + break; + DEFAULT ogs_error("%s:%d Invalid API name %s", smf_ue->supi, sess->psi, sbi_message->h.service.name); @@ -1804,7 +1826,7 @@ CASE(OGS_SBI_SERVICE_NAME_NAMF_COMM) SWITCH(sbi_message->h.resource.component0) CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXTS) - ogs_warn("%s:%d state %d res_status %d", + ogs_error("%s:%d state %d res_status %d", smf_ue->supi, sess->psi, e->h.sbi.state, sbi_message->res_status); smf_namf_comm_handle_n1_n2_message_transfer( @@ -1873,7 +1895,7 @@ break; DEFAULT - ogs_warn("%s Ignore invalid HTTP method %s", + ogs_error("%s Ignore invalid HTTP method %s", smf_ue->supi, sbi_message->h.method); END break; @@ -2238,7 +2260,7 @@ break; DEFAULT - ogs_warn("Ignore invalid HTTP method %s", + ogs_error("Ignore invalid HTTP method %s", sbi_message->h.method); END break;
View file
open5gs_2.7.5.tar.xz/src/smf/init.c -> open5gs_2.7.6.tar.xz/src/smf/init.c
Changed
@@ -101,7 +101,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -162,7 +162,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/smf/ngap-build.c -> open5gs_2.7.6.tar.xz/src/smf/ngap-build.c
Changed
@@ -260,23 +260,33 @@ if (qos_flow->qos.mbr.downlink || qos_flow->qos.mbr.uplink || qos_flow->qos.gbr.downlink || qos_flow->qos.gbr.uplink) { - ogs_assert(qos_flow->qos.mbr.downlink); - ogs_assert(qos_flow->qos.mbr.uplink); - ogs_assert(qos_flow->qos.gbr.downlink); - ogs_assert(qos_flow->qos.gbr.uplink); - - qosFlowLevelQosParameters->gBR_QosInformation = - gBR_QosInformation = CALLOC(1, sizeof(*gBR_QosInformation)); - ogs_assert(gBR_QosInformation); - - asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateDL, - qos_flow->qos.mbr.downlink); - asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateUL, - qos_flow->qos.mbr.uplink); - asn_uint642INTEGER(&gBR_QosInformation-> - guaranteedFlowBitRateDL, qos_flow->qos.gbr.downlink); - asn_uint642INTEGER(&gBR_QosInformation-> - guaranteedFlowBitRateUL, qos_flow->qos.gbr.uplink); + + if (qos_flow->qos.mbr.downlink && qos_flow->qos.mbr.uplink && + qos_flow->qos.gbr.downlink && qos_flow->qos.gbr.uplink) { + + qosFlowLevelQosParameters->gBR_QosInformation = + gBR_QosInformation = CALLOC(1, sizeof(*gBR_QosInformation)); + ogs_assert(gBR_QosInformation); + + asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateDL, + qos_flow->qos.mbr.downlink); + asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateUL, + qos_flow->qos.mbr.uplink); + asn_uint642INTEGER(&gBR_QosInformation-> + guaranteedFlowBitRateDL, qos_flow->qos.gbr.downlink); + asn_uint642INTEGER(&gBR_QosInformation-> + guaranteedFlowBitRateUL, qos_flow->qos.gbr.uplink); + + } else { + ogs_error("Missing one or more MBR/GBR parameters; " + "defaulting to Non-GBR flow "); + ogs_error(" MBRDL:%lld,UL:%lld", + (long long)qos_flow->qos.mbr.downlink, + (long long)qos_flow->qos.mbr.uplink); + ogs_error(" GBRDL:%lld,UL:%lld", + (long long)qos_flow->qos.gbr.downlink, + (long long)qos_flow->qos.gbr.uplink); + } } } @@ -355,22 +365,32 @@ if (qos_presence == true && (qos_flow->qos.mbr.downlink || qos_flow->qos.mbr.uplink || qos_flow->qos.gbr.downlink || qos_flow->qos.gbr.uplink)) { - ogs_assert(qos_flow->qos.mbr.downlink); - ogs_assert(qos_flow->qos.mbr.uplink); - ogs_assert(qos_flow->qos.gbr.downlink); - ogs_assert(qos_flow->qos.gbr.uplink); - - qosFlowLevelQosParameters->gBR_QosInformation = - gBR_QosInformation = CALLOC(1, sizeof(*gBR_QosInformation)); - - asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateDL, - qos_flow->qos.mbr.downlink); - asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateUL, - qos_flow->qos.mbr.uplink); - asn_uint642INTEGER(&gBR_QosInformation-> - guaranteedFlowBitRateDL, qos_flow->qos.gbr.downlink); - asn_uint642INTEGER(&gBR_QosInformation-> - guaranteedFlowBitRateUL, qos_flow->qos.gbr.uplink); + + if (qos_flow->qos.mbr.downlink && qos_flow->qos.mbr.uplink && + qos_flow->qos.gbr.downlink && qos_flow->qos.gbr.uplink) { + + qosFlowLevelQosParameters->gBR_QosInformation = + gBR_QosInformation = CALLOC(1, sizeof(*gBR_QosInformation)); + + asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateDL, + qos_flow->qos.mbr.downlink); + asn_uint642INTEGER(&gBR_QosInformation->maximumFlowBitRateUL, + qos_flow->qos.mbr.uplink); + asn_uint642INTEGER(&gBR_QosInformation-> + guaranteedFlowBitRateDL, qos_flow->qos.gbr.downlink); + asn_uint642INTEGER(&gBR_QosInformation-> + guaranteedFlowBitRateUL, qos_flow->qos.gbr.uplink); + + } else { + ogs_error("Missing one or more MBR/GBR parameters; " + "defaulting to Non-GBR flow "); + ogs_error(" MBRDL:%lld,UL:%lld", + (long long)qos_flow->qos.mbr.downlink, + (long long)qos_flow->qos.mbr.uplink); + ogs_error(" GBRDL:%lld,UL:%lld", + (long long)qos_flow->qos.gbr.downlink, + (long long)qos_flow->qos.gbr.uplink); + } } }
View file
open5gs_2.7.5.tar.xz/src/smf/ngap-handler.c -> open5gs_2.7.6.tar.xz/src/smf/ngap-handler.c
Changed
@@ -489,8 +489,12 @@ OGS_PFCP_MODIFY_XN_HANDOVER|OGS_PFCP_MODIFY_END_MARKER, 0)); } else { - /* ACTIVATED Is NOT Included in RESPONSE */ - ogs_assert(true == ogs_sbi_send_http_status_no_content(stream)); + ogs_pkbuf_t *n2smbuf = + ngap_build_path_switch_request_ack_transfer(sess); + ogs_assert(n2smbuf); + + smf_sbi_send_sm_context_updated_data_n2smbuf(sess, stream, + OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK, n2smbuf); } rv = OGS_OK;
View file
open5gs_2.7.5.tar.xz/src/smf/npcf-build.c -> open5gs_2.7.6.tar.xz/src/smf/npcf-build.c
Changed
@@ -34,6 +34,7 @@ OpenAPI_subscribed_default_qos_t SubsDefQos; OpenAPI_arp_t Arp; OpenAPI_snssai_t sNssai; + OpenAPI_user_location_t ueLocation; ogs_assert(sess); ogs_assert(sess->sm_context_ref); @@ -50,6 +51,7 @@ memset(&SmPolicyContextData, 0, sizeof(SmPolicyContextData)); memset(&sNssai, 0, sizeof(sNssai)); memset(&SubsSessAmbr, 0, sizeof(SubsSessAmbr)); + memset(&ueLocation, 0, sizeof(ueLocation)); SmPolicyContextData.supi = smf_ue->supi; if (!SmPolicyContextData.supi) { @@ -68,6 +70,15 @@ } /* + * TODO: Currently hard-coded to "00000800"; + * replace with dynamic value if needed in future + */ + SmPolicyContextData.chargingcharacteristics = (char *)"00000800"; + + /* GPSI */ + SmPolicyContextData.gpsi = smf_ue->gpsi; + + /* * Use ogs_sbi_supi_in_vplmn() instead of ogs_sbi_plmn_id_in_vplmn(). * This is because some vendors might not use the full DNN in LBO and * Open5GS cannot derive the home PLMN ID without the full DNN. @@ -139,6 +150,8 @@ goto end; } + SmPolicyContextData.rat_type = OpenAPI_rat_type_NR; + SmPolicyContextData.serving_network = ogs_sbi_build_plmn_id_nid(&sess->serving_plmn_id); if (!SmPolicyContextData.serving_network) { @@ -146,6 +159,28 @@ goto end; } + ueLocation.nr_location = ogs_sbi_build_nr_location( + &sess->nr_tai, &sess->nr_cgi); + if (!ueLocation.nr_location) { + ogs_error("ueLocation.nr_location"); + goto end; + } + ueLocation.nr_location->ue_location_timestamp = + ogs_sbi_gmtime_string(sess->ue_location_timestamp); + if (!ueLocation.nr_location->ue_location_timestamp) { + ogs_error("ueLocation.nr_location->ue_location_timestamp"); + goto end; + } + + SmPolicyContextData.user_location_info = &ueLocation; + + SmPolicyContextData.ue_time_zone = + ogs_sbi_timezone_string(ogs_timezone()); + if (!SmPolicyContextData.ue_time_zone) { + ogs_error("SmPolicyContextData.ue_time_zone"); + goto end; + } + if (sess->ipv4) { SmPolicyContextData.ipv4_address = ogs_ipv4_to_string(sess->ipv4->addr0); @@ -255,14 +290,20 @@ end: if (SmPolicyContextData.notification_uri) ogs_free(SmPolicyContextData.notification_uri); - if (SmPolicyContextData.gpsi) - ogs_free(SmPolicyContextData.gpsi); if (SmPolicyContextData.dnn) ogs_free(SmPolicyContextData.dnn); if (SmPolicyContextData.serving_network) ogs_sbi_free_plmn_id_nid(SmPolicyContextData.serving_network); + if (ueLocation.nr_location) { + if (ueLocation.nr_location->ue_location_timestamp) + ogs_free(ueLocation.nr_location->ue_location_timestamp); + ogs_sbi_free_nr_location(ueLocation.nr_location); + } + if (SmPolicyContextData.ue_time_zone) + ogs_free(SmPolicyContextData.ue_time_zone); + if (sNssai.sd) ogs_free(sNssai.sd);
View file
open5gs_2.7.5.tar.xz/src/smf/npcf-handler.c -> open5gs_2.7.6.tar.xz/src/smf/npcf-handler.c
Changed
@@ -475,8 +475,14 @@ /* Select UPF based on UE Location Information */ smf_sess_select_upf(sess); + /* Check if UPF selection was successful */ + if (!sess->pfcp_node) { + ogs_error("%s:%d No UPF available for session", + smf_ue->supi, sess->psi); + return false; + } + /* Check if selected UPF is associated with SMF */ - ogs_assert(sess->pfcp_node); if (!OGS_FSM_CHECK(&sess->pfcp_node->sm, smf_pfcp_state_associated)) { ogs_error("%s:%d No associated UPF", smf_ue->supi, sess->psi); return false;
View file
open5gs_2.7.5.tar.xz/src/smf/nsmf-handler.c -> open5gs_2.7.6.tar.xz/src/smf/nsmf-handler.c
Changed
@@ -220,6 +220,10 @@ } ogs_free(type); } + + if (smf_ue->gpsi) + ogs_free(smf_ue->gpsi); + smf_ue->gpsi = ogs_strdup(SmContextCreateData->gpsi); } /* Serving PLMN & Home PLMN */
View file
open5gs_2.7.5.tar.xz/src/smf/pfcp-path.c -> open5gs_2.7.6.tar.xz/src/smf/pfcp-path.c
Changed
@@ -59,7 +59,7 @@ return OGS_DIAM_GY_REPORTING_REASON_UNUSED_QUOTA_TIMER; } -static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_assoicate) +static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_associate) { smf_event_t e; @@ -68,7 +68,7 @@ memset(&e, 0, sizeof(e)); e.pfcp_node = node; - if (try_to_assoicate == true) { + if (try_to_associate == true) { node->t_association = ogs_timer_add(ogs_app()->timer_mgr, smf_timer_pfcp_association, node); ogs_assert(node->t_association);
View file
open5gs_2.7.5.tar.xz/src/smf/s5c-build.c -> open5gs_2.7.6.tar.xz/src/smf/s5c-build.c
Changed
@@ -141,7 +141,12 @@ sess->gtp.ue_pco.len && sess->gtp.ue_pco.data) { pco_len = smf_pco_build( pco_buf, sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); - ogs_assert(pco_len > 0); + if (pco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); + goto cleanup; + } rsp->protocol_configuration_options.presence = 1; rsp->protocol_configuration_options.data = pco_buf; rsp->protocol_configuration_options.len = pco_len; @@ -152,7 +157,12 @@ sess->gtp.ue_apco.len && sess->gtp.ue_apco.data) { apco_len = smf_pco_build( apco_buf, sess->gtp.ue_apco.data, sess->gtp.ue_apco.len); - ogs_assert(apco_len > 0); + if (apco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_apco.data, sess->gtp.ue_apco.len); + goto cleanup; + } rsp->additional_protocol_configuration_options.presence = 1; rsp->additional_protocol_configuration_options.data = apco_buf; rsp->additional_protocol_configuration_options.len = apco_len; @@ -165,7 +175,12 @@ 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); + if (epco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_epco.data, sess->gtp.ue_epco.len); + goto cleanup; + } rsp->extended_protocol_configuration_options.presence = 1; rsp->extended_protocol_configuration_options.data = epco_buf; rsp->extended_protocol_configuration_options.len = epco_len; @@ -291,7 +306,12 @@ sess->gtp.ue_pco.len && sess->gtp.ue_pco.data) { pco_len = smf_pco_build( pco_buf, sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); - ogs_assert(pco_len > 0); + if (pco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_pco.data, sess->gtp.ue_pco.len); + goto cleanup; + } rsp->protocol_configuration_options.presence = 1; rsp->protocol_configuration_options.data = pco_buf; rsp->protocol_configuration_options.len = pco_len; @@ -304,7 +324,12 @@ 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); + if (epco_len <= 0) { + ogs_error("smf_pco_build() failed"); + ogs_log_hexdump(OGS_LOG_ERROR, + sess->gtp.ue_epco.data, sess->gtp.ue_epco.len); + goto cleanup; + } rsp->extended_protocol_configuration_options.presence = 1; rsp->extended_protocol_configuration_options.data = epco_buf; rsp->extended_protocol_configuration_options.len = epco_len; @@ -316,6 +341,7 @@ gtp_message.h.type = type; pkbuf = ogs_gtp2_build_msg(>p_message); +cleanup: if (epco_buf) ogs_free(epco_buf);
View file
open5gs_2.7.5.tar.xz/src/smf/s5c-handler.c -> open5gs_2.7.6.tar.xz/src/smf/s5c-handler.c
Changed
@@ -261,10 +261,18 @@ /* Select PGW based on UE Location Information */ smf_sess_select_upf(sess); + if (!sess->pfcp_node) { + ogs_error("%s:%s No UPF available for session", + smf_ue->imsi_bcd, sess->session.name); + return OGS_GTP2_CAUSE_SYSTEM_FAILURE; + } + /* Check if selected PGW is associated with SMF */ - ogs_assert(sess->pfcp_node); - if (!OGS_FSM_CHECK(&sess->pfcp_node->sm, smf_pfcp_state_associated)) + if (!OGS_FSM_CHECK(&sess->pfcp_node->sm, smf_pfcp_state_associated)) { + ogs_error("%s:%s selected UPF is not assocated with SMF", + smf_ue->imsi_bcd, sess->session.name); return OGS_GTP2_CAUSE_REMOTE_PEER_NOT_RESPONDING; + } /* UE IP Address */ paa = req->pdn_address_allocation.data;
View file
open5gs_2.7.5.tar.xz/src/smf/smf-sm.c -> open5gs_2.7.6.tar.xz/src/smf/smf-sm.c
Changed
@@ -80,6 +80,7 @@ ogs_sbi_message_t sbi_message; ogs_sbi_xact_t *sbi_xact = NULL; ogs_pool_id_t sbi_xact_id = OGS_INVALID_POOL_ID; + ogs_sbi_object_t *sbi_object = NULL; ogs_pool_id_t sbi_object_id = OGS_INVALID_POOL_ID; ogs_nas_5gs_message_t nas_message; @@ -710,10 +711,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &sbi_message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &sbi_message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) @@ -927,9 +951,14 @@ ogs_assert(true == ogs_sbi_send_http_status_no_content(stream)); } else if (state == SMF_UECM_STATE_DEREGISTERED_BY_AMF) { /* SMF Deregistration */ - ogs_assert(stream); - ogs_assert(true == ogs_sbi_send_http_status_no_content(stream)); + if (stream) + ogs_assert(true == + ogs_sbi_send_http_status_no_content(stream)); + else + ogs_error("Stream has already been removed"); + SMF_SESS_CLEAR(sess); + } else if (state == SMF_UECM_STATE_DEREGISTERED_BY_N1_N2_RELEASE) { /* SMF Deregistration */ ogs_assert(true == smf_sbi_send_sm_context_status_notify(sess)); @@ -1040,14 +1069,30 @@ /* Here, we should not use ogs_assert(stream) * since 'namf-comm' service has no an associated stream. */ + sbi_object = sbi_xact->sbi_object; + ogs_assert(sbi_object); + + sbi_object_id = sbi_xact->sbi_object_id; + ogs_assert(sbi_object_id >= OGS_MIN_POOL_ID && + sbi_object_id <= OGS_MAX_POOL_ID); + ogs_sbi_xact_remove(sbi_xact); - ogs_error("Cannot receive SBI message"); + sess = smf_sess_find_by_id(sbi_object_id); + if (!sess) { + ogs_error("Session has already been removed"); + break; + } + smf_ue = smf_ue_find_by_id(sess->smf_ue_id); + ogs_assert(smf_ue); + + ogs_error("%s:%d Cannot receive SBI message", + smf_ue->supi, sess->psi); if (stream) { ogs_assert(true == ogs_sbi_server_send_error(stream, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT, NULL, - "Cannot receive SBI message", NULL, NULL)); + "Cannot receive SBI message", smf_ue->supi, NULL)); } break;
View file
open5gs_2.7.5.tar.xz/src/udm/init.c -> open5gs_2.7.6.tar.xz/src/udm/init.c
Changed
@@ -61,7 +61,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -108,7 +108,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/udm/udm-sm.c -> open5gs_2.7.6.tar.xz/src/udm/udm-sm.c
Changed
@@ -288,10 +288,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS) @@ -479,7 +502,7 @@ ogs_fsm_dispatch(&udm_ue->sm, e); if (OGS_FSM_CHECK(&udm_ue->sm, udm_ue_state_exception)) { - ogs_error("%s State machine exception", udm_ue->suci); + ogs_warn("%s State machine exception", udm_ue->suci); udm_ue_remove(udm_ue); } END @@ -597,7 +620,7 @@ ogs_error("Cannot receive SBI message"); if (!stream) { - ogs_error("STREAM has alreadt been removed %d", + ogs_error("STREAM has already been removed %d", sbi_xact->assoc_stream_id); break; }
View file
open5gs_2.7.5.tar.xz/src/udm/ue-sm.c -> open5gs_2.7.6.tar.xz/src/udm/ue-sm.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 by Sukchan Lee <acetcom@gmail.com> + * Copyright (C) 2019-2025 by Sukchan Lee <acetcom@gmail.com> * * This file is part of Open5GS. * @@ -302,8 +302,12 @@ CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA) SWITCH(message->h.resource.component2) CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_DATA) - udm_nudr_dr_handle_subscription_authentication( - udm_ue, stream, message); + if (udm_nudr_dr_handle_subscription_authentication( + udm_ue, stream, message) == false) { + ogs_warn("udm_nudr_dr_handle_subscription_" + "authentication() failed"); + OGS_FSM_TRAN(s, udm_ue_state_exception); + } break; CASE(OGS_SBI_RESOURCE_NAME_CONTEXT_DATA)
View file
open5gs_2.7.5.tar.xz/src/udr/init.c -> open5gs_2.7.6.tar.xz/src/udr/init.c
Changed
@@ -64,7 +64,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -113,7 +113,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/udr/udr-sm.c -> open5gs_2.7.6.tar.xz/src/udr/udr-sm.c
Changed
@@ -225,10 +225,33 @@ CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES) nf_instance = e->h.sbi.data; ogs_assert(nf_instance); - ogs_assert(OGS_FSM_STATE(&nf_instance->sm)); - e->h.sbi.message = &message; - ogs_fsm_dispatch(&nf_instance->sm, e); + /* + * Guard against dispatching to an FSM that may have been finalized + * by an asynchronous shutdown triggered by SIGTERM. + * + * In init.c’s event_termination(), which can be invoked asynchronously + * when the process receives SIGTERM, we iterate over all NF instances: + * ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) + * ogs_sbi_nf_fsm_fini(nf_instance); + * and call ogs_fsm_fini() on each instance’s FSM. That finalizes the FSM + * and its state is reset to zero. + * + * After event_termination(), any incoming SBI response—such as an NRF + * client callback arriving after deregistration—would otherwise be + * dispatched into a dead FSM and trigger an assertion failure. + * + * To avoid this, we check OGS_FSM_STATE(&nf_instance->sm): + * - If non-zero, the FSM is still active and can safely handle the event. + * - If zero, the FSM has already been finalized by event_termination(), + * so we log and drop the event to allow graceful shutdown. + */ + if (OGS_FSM_STATE(&nf_instance->sm)) { + e->h.sbi.message = &message; + ogs_fsm_dispatch(&nf_instance->sm, e); + } else + ogs_error("NF instance FSM has been finalized"); + break; CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS)
View file
open5gs_2.7.5.tar.xz/src/upf/context.c -> open5gs_2.7.6.tar.xz/src/upf/context.c
Changed
@@ -178,7 +178,10 @@ ogs_assert(cp_f_seid); ogs_pool_id_calloc(&upf_sess_pool, &sess); - ogs_assert(sess); + if (!sess) { + ogs_error("Maximum number of Session reached"); + return NULL; + } ogs_pfcp_pool_init(&sess->pfcp);
View file
open5gs_2.7.5.tar.xz/src/upf/context.h -> open5gs_2.7.6.tar.xz/src/upf/context.h
Changed
@@ -105,7 +105,7 @@ ogs_pfcp_sess_t pfcp; - uint64_t upf_n4_seid; /* UPF SEID is dervied from NODE */ + uint64_t upf_n4_seid; /* UPF SEID is derived from NODE */ struct { uint64_t seid; ogs_ip_t ip;
View file
open5gs_2.7.5.tar.xz/src/upf/init.c -> open5gs_2.7.6.tar.xz/src/upf/init.c
Changed
@@ -122,7 +122,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/src/upf/pfcp-path.c -> open5gs_2.7.6.tar.xz/src/upf/pfcp-path.c
Changed
@@ -22,7 +22,7 @@ #include "pfcp-path.h" #include "n4-build.h" -static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_assoicate) +static void pfcp_node_fsm_init(ogs_pfcp_node_t *node, bool try_to_associate) { upf_event_t e; @@ -31,7 +31,7 @@ memset(&e, 0, sizeof(e)); e.pfcp_node = node; - if (try_to_assoicate == true) { + if (try_to_associate == true) { node->t_association = ogs_timer_add(ogs_app()->timer_mgr, upf_timer_association, node); ogs_assert(node->t_association);
View file
open5gs_2.7.5.tar.xz/subprojects/freeDiameter/meson.build -> open5gs_2.7.6.tar.xz/subprojects/freeDiameter/meson.build
Changed
@@ -22,7 +22,6 @@ default_options : 'warning_level=1', 'c_std=gnu89', - 'prefix=/usr', , )
View file
open5gs_2.7.5.tar.xz/tests/af/init.c -> open5gs_2.7.6.tar.xz/tests/af/init.c
Changed
@@ -73,7 +73,7 @@ { ogs_sbi_nf_instance_t *nf_instance = NULL; - /* Sending NF Instance De-registeration to NRF */ + /* Sending NF Instance De-registration to NRF */ ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) ogs_sbi_nf_fsm_fini(nf_instance); @@ -117,7 +117,7 @@ /* * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. * - * The reason is why ogs_timer_mgr_next() can get the corrent value + * The reason is why ogs_timer_mgr_next() can get the current value * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). * * You should not use event-queue before ogs_timer_mgr_expire().
View file
open5gs_2.7.5.tar.xz/tests/app/5gc-init.c -> open5gs_2.7.6.tar.xz/tests/app/5gc-init.c
Changed
@@ -42,7 +42,7 @@ { int i; - threads0 = test_child_create(nf_name, argv_out); + threads0 = test_child_create(nf_name, 0, argv_out); for (i = 1; i < count; i++) { const char *idx_string = NULL;; @@ -62,7 +62,7 @@ argv_outargv_out_idx + 1 = idx_string; argv_outargv_out_idx + 2 = NULL; - threadsi = test_child_create(nf_name, argv_out); + threadsi = test_child_create(nf_name, i, argv_out); } // reset argv_out and remove the added "-k" parameter @@ -90,11 +90,11 @@ } if (ogs_global_conf()->parameter.no_nrf == 0) - nrf_thread = test_child_create("nrf", argv_out); + nrf_thread = test_child_create("nrf", 0, argv_out); if (ogs_global_conf()->parameter.no_scp == 0) - scp_thread = test_child_create("scp", argv_out); + scp_thread = test_child_create("scp", 0, argv_out); if (ogs_global_conf()->parameter.no_sepp == 0) - sepp_thread = test_child_create("sepp", argv_out); + sepp_thread = test_child_create("sepp", 0, argv_out); if (ogs_global_conf()->parameter.no_upf == 0) run_threads("upf", ogs_global_conf()->parameter.upf_count, @@ -139,29 +139,55 @@ int i; for (i = 0; i < OGS_MAX_NF_INSTANCES; i++) { - if (amf_threadsi) + if (amf_threadsi) { ogs_thread_destroy(amf_threadsi); - if (smf_threadsi) + amf_threadsi = NULL; + } + if (smf_threadsi) { ogs_thread_destroy(smf_threadsi); - if (upf_threadsi) + smf_threadsi = NULL; + } + if (upf_threadsi) { ogs_thread_destroy(upf_threadsi); - if (udr_threadsi) + upf_threadsi = NULL; + } + if (udr_threadsi) { ogs_thread_destroy(udr_threadsi); - if (nssf_threadsi) + udr_threadsi = NULL; + } + if (nssf_threadsi) { ogs_thread_destroy(nssf_threadsi); - if (bsf_threadsi) + nssf_threadsi = NULL; + } + if (bsf_threadsi) { ogs_thread_destroy(bsf_threadsi); - if (pcf_threadsi) + bsf_threadsi = NULL; + } + if (pcf_threadsi) { ogs_thread_destroy(pcf_threadsi); - if (udm_threadsi) + pcf_threadsi = NULL; + } + if (udm_threadsi) { ogs_thread_destroy(udm_threadsi); - if (ausf_threadsi) + udm_threadsi = NULL; + } + if (ausf_threadsi) { ogs_thread_destroy(ausf_threadsi); + ausf_threadsi = NULL; + } + } + if (sepp_thread) { + ogs_thread_destroy(sepp_thread); + sepp_thread = NULL; + } + if (scp_thread) { + ogs_thread_destroy(scp_thread); + scp_thread = NULL; + } + if (nrf_thread) { + ogs_thread_destroy(nrf_thread); + nrf_thread = NULL; } - - if (sepp_thread) ogs_thread_destroy(sepp_thread); - if (scp_thread) ogs_thread_destroy(scp_thread); - if (nrf_thread) ogs_thread_destroy(nrf_thread); } void test_5gc_init(void)
View file
open5gs_2.7.5.tar.xz/tests/app/app-init.c -> open5gs_2.7.6.tar.xz/tests/app/app-init.c
Changed
@@ -58,43 +58,43 @@ } if (ogs_global_conf()->parameter.no_nrf == 0) - nrf_thread = test_child_create("nrf", argv_out); + nrf_thread = test_child_create("nrf", 0, argv_out); if (ogs_global_conf()->parameter.no_scp == 0) - scp_thread = test_child_create("scp", argv_out); + scp_thread = test_child_create("scp", 0, argv_out); if (ogs_global_conf()->parameter.no_sepp == 0) - sepp_thread = test_child_create("sepp", argv_out); + sepp_thread = test_child_create("sepp", 0, argv_out); if (ogs_global_conf()->parameter.no_hss == 0) - hss_thread = test_child_create("hss", argv_out); + hss_thread = test_child_create("hss", 0, argv_out); if (ogs_global_conf()->parameter.no_pcrf == 0) - pcrf_thread = test_child_create("pcrf", argv_out); + pcrf_thread = test_child_create("pcrf", 0, argv_out); if (ogs_global_conf()->parameter.no_upf == 0) - upf_thread = test_child_create("upf", argv_out); + upf_thread = test_child_create("upf", 0, argv_out); if (ogs_global_conf()->parameter.no_sgwu == 0) - sgwu_thread = test_child_create("sgwu", argv_out); + sgwu_thread = test_child_create("sgwu", 0, argv_out); if (ogs_global_conf()->parameter.no_smf == 0) - smf_thread = test_child_create("smf", argv_out); + smf_thread = test_child_create("smf", 0, argv_out); if (ogs_global_conf()->parameter.no_sgwc == 0) - sgwc_thread = test_child_create("sgwc", argv_out); + sgwc_thread = test_child_create("sgwc", 0, argv_out); if (ogs_global_conf()->parameter.no_mme == 0) - mme_thread = test_child_create("mme", argv_out); + mme_thread = test_child_create("mme", 0, argv_out); if (ogs_global_conf()->parameter.no_amf == 0) - amf_thread = test_child_create("amf", argv_out); + amf_thread = test_child_create("amf", 0, argv_out); if (ogs_global_conf()->parameter.no_ausf == 0) - ausf_thread = test_child_create("ausf", argv_out); + ausf_thread = test_child_create("ausf", 0, argv_out); if (ogs_global_conf()->parameter.no_udm == 0) - udm_thread = test_child_create("udm", argv_out); + udm_thread = test_child_create("udm", 0, argv_out); if (ogs_global_conf()->parameter.no_pcf == 0) - pcf_thread = test_child_create("pcf", argv_out); + pcf_thread = test_child_create("pcf", 0, argv_out); if (ogs_global_conf()->parameter.no_nssf == 0) - nssf_thread = test_child_create("nssf", argv_out); + nssf_thread = test_child_create("nssf", 0, argv_out); if (ogs_global_conf()->parameter.no_bsf == 0) - bsf_thread = test_child_create("bsf", argv_out); + bsf_thread = test_child_create("bsf", 0, argv_out); if (ogs_global_conf()->parameter.no_udr == 0) - udr_thread = test_child_create("udr", argv_out); + udr_thread = test_child_create("udr", 0, argv_out); /* * Wait for all sockets listening
View file
open5gs_2.7.5.tar.xz/tests/app/epc-init.c -> open5gs_2.7.6.tar.xz/tests/app/epc-init.c
Changed
@@ -48,22 +48,22 @@ } if (ogs_global_conf()->parameter.no_hss == 0) - hss_thread = test_child_create("hss", argv_out); + hss_thread = test_child_create("hss", 0, argv_out); if (ogs_global_conf()->parameter.no_pcrf == 0) - pcrf_thread = test_child_create("pcrf", argv_out); + pcrf_thread = test_child_create("pcrf", 0, argv_out); if (ogs_global_conf()->parameter.no_upf == 0) - upf_thread = test_child_create("upf", argv_out); + upf_thread = test_child_create("upf", 0, argv_out); if (ogs_global_conf()->parameter.no_sgwu == 0) - sgwu_thread = test_child_create("sgwu", argv_out); + sgwu_thread = test_child_create("sgwu", 0, argv_out); if (ogs_global_conf()->parameter.no_smf == 0) - smf_thread = test_child_create("smf", argv_out); + smf_thread = test_child_create("smf", 0, argv_out); if (ogs_global_conf()->parameter.no_sgwc == 0) - sgwc_thread = test_child_create("sgwc", argv_out); + sgwc_thread = test_child_create("sgwc", 0, argv_out); if (ogs_global_conf()->parameter.no_mme == 0) - mme_thread = test_child_create("mme", argv_out); + mme_thread = test_child_create("mme", 0, argv_out); /* * Wait for all sockets listening
View file
open5gs_2.7.5.tar.xz/tests/common/application.c -> open5gs_2.7.6.tar.xz/tests/common/application.c
Changed
@@ -85,7 +85,8 @@ static void child_main(void *data) { - const char **commandLine = data; + thread_data_t *thread_data = data; + const char **commandLine = thread_data->commandLine; ogs_proc_t *current = NULL; FILE *out = NULL; char bufOGS_HUGE_LEN; @@ -93,6 +94,10 @@ current = &processprocess_num++; + // get name and index of NF into the process. + current->nf_name = ogs_strdup(thread_data->nf_name); + current->index = thread_data->index; + if (process_num > MAX_CHILD_PROCESS) { ogs_fatal("Process limit reached"); ogs_assert_if_reached(); @@ -118,13 +123,17 @@ ogs_assert(ret == 0); } -ogs_thread_t *test_child_create(const char *name, const char *const argv) +ogs_thread_t *test_child_create(const char *name, int index, const char *const argv) { ogs_thread_t *child = NULL; + thread_data_t thread_data; + const char *commandLineOGS_ARG_MAX; int i = 0; char commandOGS_MAX_FILEPATH_LEN; + memset(&thread_data, 0, sizeof(thread_data)); + while(argvi && i < 32) { commandLinei = argvi; i++; @@ -137,7 +146,11 @@ name, OGS_DIR_SEPARATOR_S "open5gs-", name); commandLine0 = command; - child = ogs_thread_create(child_main, commandLine); + thread_data.commandLine = commandLine; + thread_data.nf_name = name; + thread_data.index = index; + + child = ogs_thread_create(child_main, &thread_data); ogs_msleep(50); @@ -150,6 +163,26 @@ ogs_proc_t *current = NULL; for (i = 0; i < process_num; i++) { current = &processi; - ogs_proc_terminate(current); + + if (current->stdin_file != 0 && current->child != 0) { + ogs_proc_terminate(current); + } } } + +void test_child_terminate_with_name(char *name, int index) +{ + int i; + ogs_proc_t *current = NULL; + for (i = 0; i < process_num; i++) { + current = &processi; + + if (!strcmp(current->nf_name, name) && + current->index == index && + current->stdin_file != 0 && + current->child != 0) { + ogs_proc_terminate(current); + break; + } + } +} \ No newline at end of file
View file
open5gs_2.7.5.tar.xz/tests/common/application.h -> open5gs_2.7.6.tar.xz/tests/common/application.h
Changed
@@ -28,10 +28,18 @@ extern "C" { #endif +typedef struct { + const char **commandLine; + const char *nf_name; + int index; + pid_t child; +} thread_data_t; + void test_app_run(int argc, const char *const argv, const char *name, void (*init)(const char * const argv)); void test_child_terminate(void); -ogs_thread_t *test_child_create(const char *name, const char *const argv); +void test_child_terminate_with_name(char *name, int index); +ogs_thread_t *test_child_create(const char *name, int index, const char *const argv); #ifdef __cplusplus }
View file
open5gs_2.7.5.tar.xz/tests/handover/5gc-n2-test.c -> open5gs_2.7.6.tar.xz/tests/handover/5gc-n2-test.c
Changed
@@ -2714,6 +2714,361 @@ test_ue_remove(test_ue); } +static void partial_handover_func(abts_case *tc, void *data) +{ + int rv; + ogs_socknode_t *ngap1, *ngap2; + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_pkbuf_t *pkbuf; + ogs_ngap_message_t message; + int i; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ue = NULL; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + uint64_t ran_ue_ngap_id; + uint64_t amf_ue_ngap_id; + + bson_t *doc = NULL; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_ue = test_ue_add_by_suci(&mobile_identity_suci, "0000203190"); + ogs_assert(test_ue); + + test_ue->nr_cgi.cell_id = 0x40001; + + test_ue->nas.registration.tsc = 0; + test_ue->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_ue->nas.registration.follow_on_request = 1; + test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + + /* Two gNB connects to AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + ngap2 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Source gNB */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Target gNB */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_ue); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); + + /* Send Registration request */ + test_ue->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_ue, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_ue->registration_request_param.gmm_capability = 1; + test_ue->registration_request_param.s1_ue_network_capability = 1; + test_ue->registration_request_param.requested_nssai = 1; + test_ue->registration_request_param.last_visited_registered_tai = 1; + test_ue->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_ue, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_ue); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_ue); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_ue, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_ue->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_ue); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_ue, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_ue); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_ue, "internet", 5); + ogs_assert(sess); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL; + sess->ul_nas_transport_param.dnn = 1; + sess->ul_nas_transport_param.s_nssai = 1; + + sess->pdu_session_establishment_param.ssc_mode = 1; + sess->pdu_session_establishment_param.epco = 1;
View file
open5gs_2.7.5.tar.xz/tests/handover/5gc-xn-test.c -> open5gs_2.7.6.tar.xz/tests/handover/5gc-xn-test.c
Changed
@@ -19,7 +19,7 @@ #include "test-common.h" -static void test1_func(abts_case *tc, void *data) +static void test_two_qos_flows(abts_case *tc, void *data) { int rv; ogs_socknode_t *ngap1, *ngap2; @@ -436,11 +436,349 @@ test_ue_remove(test_ue); } +static void test_keep_tunnel(abts_case *tc, void *data) +{ + int rv; + ogs_socknode_t *ngap1, *ngap2; + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_ngap_message_t message; + int i; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ue = NULL; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + bson_t *doc = NULL; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_ue = test_ue_add_by_suci(&mobile_identity_suci, "0000203190"); + ogs_assert(test_ue); + + test_ue->nr_cgi.cell_id = 0x40001; + + test_ue->nas.registration.tsc = 0; + test_ue->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_ue->nas.registration.follow_on_request = 1; + test_ue->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_ue->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_ue->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + + /* Two gNB connects to AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + ngap2 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Source gNB */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Target gNB */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_ue); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_ue, doc)); + + /* Send Registration request */ + test_ue->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_ue, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_ue->registration_request_param.gmm_capability = 1; + test_ue->registration_request_param.s1_ue_network_capability = 1; + test_ue->registration_request_param.requested_nssai = 1; + test_ue->registration_request_param.last_visited_registered_tai = 1; + test_ue->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_ue, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_ue, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_ue); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_ue); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Security mode command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send Security mode complete */ + gmmbuf = testgmm_build_security_mode_complete(test_ue, nasbuf); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive InitialContextSetupRequest + + * Registration accept */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + ABTS_INT_EQUAL(tc, + NGAP_ProcedureCode_id_InitialContextSetup, + test_ue->ngap_procedure_code); + + /* Send UERadioCapabilityInfoIndication */ + sendbuf = testngap_build_ue_radio_capability_info_indication(test_ue); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send InitialContextSetupResponse */ + sendbuf = testngap_build_initial_context_setup_response(test_ue, false); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Send Registration complete */ + gmmbuf = testgmm_build_registration_complete(test_ue); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_ue, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + /* Receive Configuration update command */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_ue, "internet", 5); + ogs_assert(sess); + + sess->ul_nas_transport_param.request_type = + OGS_NAS_5GS_REQUEST_TYPE_INITIAL;
View file
open5gs_2.7.6.tar.xz/tests/transfer/abts-error-main.c
Added
@@ -0,0 +1,66 @@ +/* + * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com> + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#include "test-app.h" + +abts_suite * test_ue_context_transfer_error_case(abts_suite *suite); + +const struct testlist { + abts_suite *(*func)(abts_suite *suite); +} alltests_error = { + {test_ue_context_transfer_error_case}, + {NULL}, +}; + +static void terminate(void) +{ + ogs_msleep(50); + + test_child_terminate(); + app_terminate(); + + test_5gc_final(); + ogs_app_terminate(); +} + +static void initialize(const char *const argv) +{ + int rv; + + rv = ogs_app_initialize(NULL, NULL, argv); + ogs_assert(rv == OGS_OK); + test_5gc_init(); + + rv = app_initialize(argv); + ogs_assert(rv == OGS_OK); +} + +int main(int argc, const char *const argv) +{ + int i; + abts_suite *suite = NULL; + + atexit(terminate); + test_app_run(argc, argv, "transfer-error-case.yaml", initialize); + + for (i = 0; alltests_errori.func; i++) + suite = alltests_errori.func(suite); + + return abts_report(suite); +}
View file
open5gs_2.7.5.tar.xz/tests/transfer/abts-main.c -> open5gs_2.7.6.tar.xz/tests/transfer/abts-main.c
Changed
@@ -63,4 +63,4 @@ suite = alltestsi.func(suite); return abts_report(suite); -} +} \ No newline at end of file
View file
open5gs_2.7.5.tar.xz/tests/transfer/meson.build -> open5gs_2.7.6.tar.xz/tests/transfer/meson.build
Changed
@@ -20,9 +20,20 @@ ue-context-transfer-test.c '''.split()) +testapp_transfer_error_sources = files(''' + abts-error-main.c + ue-context-transfer-error-case-test.c +'''.split()) + testapp_transfer_exe = executable('transfer', sources : testapp_transfer_sources, c_args : testunit_core_cc_flags, dependencies : libtest5gc_dep) +testapp_transfer_error_exe = executable('transfer-error', + sources : testapp_transfer_error_sources, + c_args : testunit_core_cc_flags, + dependencies : libtest5gc_dep) + test('transfer', testapp_transfer_exe, is_parallel : false, suite: '5gc') +test('transfer-error', testapp_transfer_error_exe, is_parallel : false, suite: '5gc') \ No newline at end of file
View file
open5gs_2.7.6.tar.xz/tests/transfer/ue-context-transfer-error-case-test.c
Added
@@ -0,0 +1,681 @@ +/* + * Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com> + * + * This file is part of Open5GS. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + + #include "test-common.h" + + static void test1_func_error(abts_case *tc, void *data) + { + int rv; + ogs_socknode_t *ngap1, *ngap2; + ogs_socknode_t *gtpu1, *gtpu2; + ogs_pkbuf_t *gmmbuf; + ogs_pkbuf_t *gsmbuf; + ogs_pkbuf_t *nasbuf; + ogs_pkbuf_t *sendbuf; + ogs_pkbuf_t *recvbuf; + ogs_pkbuf_t *recvbuf_target; + ogs_ngap_message_t message; + int i; + + uint8_t tmpOGS_HUGE_LEN; + char *_gtp_payload = "34ff0024" + "0000000100000085 010002004500001c 0c0b000040015a7a 0a2d00010a2d0002" + "00000964cd7c291f"; + + #define NUM_OF_TEST_UE_1 1 + + + /* ERROR case simulation, when no SCP in 5G core */ + + /* Test: 1 UE, Old AMF, Target AMF, + * register to Old AMF, PDU session establishment, session release, deregister, + * old AMF is killed (main point of this test) + * send registation request to Target AMF with Old AMF's 5G GUTI, + * UE context transfer can not be finished because old AMF is not found + * new AMF sends Identity Request and registration continues + * PDU session establishment, session release, deregister + */ + + ogs_nas_5gs_mobile_identity_suci_t mobile_identity_suci; + test_ue_t *test_ueNUM_OF_TEST_UE_1; + test_ue_t *test_ue_targetNUM_OF_TEST_UE_1; + test_sess_t *sess = NULL; + test_bearer_t *qos_flow = NULL; + + bson_t *doc = NULL; + + /* First gNB connects to Target AMF */ + ngap2 = testngap_client(2, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap2); + + /* Second gNB connects to Old AMF */ + ngap1 = testngap_client(1, AF_INET); + ABTS_PTR_NOTNULL(tc, ngap1); + + /* Two gNB connects to UPF */ + gtpu1 = test_gtpu_server(1, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu1); + + gtpu2 = test_gtpu_server(2, AF_INET); + ABTS_PTR_NOTNULL(tc, gtpu2); + + /* NG-Setup Reqeust/Response for Target gNB - with Target AMF */ + sendbuf = testngap_build_ng_setup_request(0x4000, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap2, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf = testgnb_ngap_read(ngap2); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_ue, recvbuf); + + /* NG-Setup Reqeust/Response for Source gNB - with Old AMF */ + sendbuf = testngap_build_ng_setup_request(0x4001, 28); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + recvbuf_target = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf_target); + testngap_recv(test_ue, recvbuf_target); + + /* Register to Old AMF */ + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + const char *scheme_output = { + "0000000001", + "0000000002", + "0000000003", + "0000000004", + "0000000005", + }; + + /* Setup Test UE & Session Context */ + memset(&mobile_identity_suci, 0, sizeof(mobile_identity_suci)); + + mobile_identity_suci.h.supi_format = OGS_NAS_5GS_SUPI_FORMAT_IMSI; + mobile_identity_suci.h.type = OGS_NAS_5GS_MOBILE_IDENTITY_SUCI; + mobile_identity_suci.routing_indicator1 = 0; + mobile_identity_suci.routing_indicator2 = 0xf; + mobile_identity_suci.routing_indicator3 = 0xf; + mobile_identity_suci.routing_indicator4 = 0xf; + mobile_identity_suci.protection_scheme_id = OGS_PROTECTION_SCHEME_NULL; + mobile_identity_suci.home_network_pki_value = 0; + + test_uei = test_ue_add_by_suci( + &mobile_identity_suci, scheme_outputi); + ogs_assert(test_uei); + + test_uei->nr_cgi.cell_id = 0x40001; + + test_uei->nas.registration.tsc = 0; + test_uei->nas.registration.ksi = OGS_NAS_KSI_NO_KEY_IS_AVAILABLE; + test_uei->nas.registration.follow_on_request = 1; + test_uei->nas.registration.value = OGS_NAS_5GS_REGISTRATION_TYPE_INITIAL; + + test_uei->k_string = "465b5ce8b199b49faa5f0a2ee238a6bc"; + test_uei->opc_string = "e8ed289deba952e4283b54e88e6183ca"; + } + + for (i = 0; i < NUM_OF_TEST_UE_1; i++) { + if (i > 0) + test_uei->ran_ue_ngap_id = test_uei-1->ran_ue_ngap_id; + else + test_uei->ran_ue_ngap_id = 0; + + /* pdu_id == 5 */ + + /* Send PDU session establishment request */ + sess = test_sess_add_by_dnn_and_psi(test_uei, "internet", 5); + ogs_assert(sess); + + /********** Insert Subscriber in Database */ + doc = test_db_new_simple(test_uei); + ABTS_PTR_NOTNULL(tc, doc); + ABTS_INT_EQUAL(tc, OGS_OK, test_db_insert_ue(test_uei, doc)); + + /* Send Registration request - with SUCI */ + // test_uei->registration_request_param.guti = 1; + gmmbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, gmmbuf); + + test_uei->registration_request_param.gmm_capability = 1; + test_uei->registration_request_param.s1_ue_network_capability = 1; + test_uei->registration_request_param.requested_nssai = 1; + test_uei->registration_request_param.last_visited_registered_tai = 1; + test_uei->registration_request_param.ue_usage_setting = 1; + nasbuf = testgmm_build_registration_request(test_uei, NULL, false, false); + ABTS_PTR_NOTNULL(tc, nasbuf); + + sendbuf = testngap_build_initial_ue_message(test_uei, gmmbuf, + NGAP_RRCEstablishmentCause_mo_Signalling, false, true); + ABTS_PTR_NOTNULL(tc, sendbuf); + + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + + #if 0 + /* Receive Identity request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Identity response */ + gmmbuf = testgmm_build_identity_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv); + #endif + + /* Receive Authentication request */ + recvbuf = testgnb_ngap_read(ngap1); + ABTS_PTR_NOTNULL(tc, recvbuf); + testngap_recv(test_uei, recvbuf); + + /* Send Authentication response */ + gmmbuf = testgmm_build_authentication_response(test_uei); + ABTS_PTR_NOTNULL(tc, gmmbuf); + sendbuf = testngap_build_uplink_nas_transport(test_uei, gmmbuf); + ABTS_PTR_NOTNULL(tc, sendbuf); + rv = testgnb_ngap_send(ngap1, sendbuf); + ABTS_INT_EQUAL(tc, OGS_OK, rv);
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
.