Projects
osmocom:master
open5gs
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
commit_1d153d8b783153f718d779beafb4b2cc62b1e147.txt
Added
View file
commit_2b8db5d488c17b6d5f6f7e8435f55ff253573a6c.txt
Deleted
View file
open5gs_2.4.10.11.2b8db.dsc -> open5gs_2.4.10.28.1d153.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-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg Architecture: any -Version: 2.4.10.11.2b8db +Version: 2.4.10.28.1d153 Maintainer: Harald Welte <laforge@gnumonks.org> Uploaders: Sukchan Lee <acetcom@gmail.com> Homepage: https://open5gs.org @@ -30,8 +30,8 @@ open5gs-udr deb net optional arch=any open5gs-upf deb net optional arch=any Checksums-Sha1: - 65cedff93037656c5ccb60dba5dc35a6e6c0942b 11464136 open5gs_2.4.10.11.2b8db.tar.xz + 2ef6ec3a1ad72c77c37949e4ef9c73a98d3aeeb5 11467052 open5gs_2.4.10.28.1d153.tar.xz Checksums-Sha256: - 9d77c46758441cdcb076bc39a124f61dbea3591ff81c11de621590ec01563316 11464136 open5gs_2.4.10.11.2b8db.tar.xz + 2ada5b44513e318d412b496dc94f6fee2171f437da450a4094b9ea49a4d30888 11467052 open5gs_2.4.10.28.1d153.tar.xz Files: - 22522ab264377ffa1a941aa327fb6fef 11464136 open5gs_2.4.10.11.2b8db.tar.xz + c3b45b65356041b0fc5c84345816c8d4 11467052 open5gs_2.4.10.28.1d153.tar.xz
View file
open5gs_2.4.10.11.2b8db.tar.xz/.tarball-version -> open5gs_2.4.10.28.1d153.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -2.4.10.11-2b8db +2.4.10.28-1d153
View file
open5gs_2.4.10.11.2b8db.tar.xz/README.md -> open5gs_2.4.10.28.1d153.tar.xz/README.md
Changed
@@ -27,4 +27,4 @@ ## License - Open5GS Open Source files are made available under the terms of the GNU Affero General Public License (GNU AGPL v3.0(https://www.gnu.org/licenses/agpl-3.0.html)). -- Commercial licenses(https://open5gs.org/open5gs/support/) are also available from NextEPC, Inc.(https://nextepc.com) +- Commercial licenses(https://open5gs.org/open5gs/support/) are also available from NeoPlane(https://neoplane.io/)
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/310014.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/310014.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/csfb.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/csfb.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/non3gpp.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/non3gpp.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/open5gs/amf.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/open5gs/amf.yaml.in
Changed
@@ -178,6 +178,13 @@ # sinit_max_attempts : 4 # sinit_max_init_timeo : 8000 # +# <Metrics Server> +# +# o Metrics Server(http://<any address>:9090) +# metrics: +# addr: 0.0.0.0 +# port: 9090 +# # <GUAMI> # # o Multiple GUAMI @@ -263,6 +270,9 @@ port: 7777 ngap: - addr: 127.0.0.5 + metrics: + addr: 127.0.0.5 + port: 9090 guami: - plmn_id: mcc: 999 @@ -391,17 +401,3 @@ # handover: # duration: 500 time: - -# -# metrics: -# -# <Metrics Server> -# -# o Metrics Server(http://<any address>:9090) -# metrics: -# addr: 0.0.0.0 -# port: 9090 -# -metrics: - addr: 127.0.0.5 - port: 9090
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/open5gs/hss.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/open5gs/hss.yaml.in
Changed
@@ -41,6 +41,7 @@ # prefer_ipv4: true # parameter: +# use_mongodb_change_stream: true # # max:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/open5gs/mme.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/open5gs/mme.yaml.in
Changed
@@ -175,6 +175,12 @@ # mnc: 02 # lac: 43693 # +# <Metrics Server> +# +# o Metrics Server(http://<any address>:9090) +# metrics: +# addr: 0.0.0.0 +# port: 9090 # # <GUMMEI> # @@ -248,6 +254,9 @@ - addr: 127.0.0.2 gtpc: - addr: 127.0.0.2 + metrics: + addr: 127.0.0.2 + port: 9090 gummei: plmn_id: mcc: 999 @@ -421,17 +430,3 @@ # handover: # duration: 500 time: - -# -# metrics: -# -# <Metrics Server> -# -# o Metrics Server(http://<any address>:9090) -# metrics: -# addr: 0.0.0.0 -# port: 9090 -# -metrics: - addr: 127.0.0.2 - port: 9090
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/open5gs/smf.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/open5gs/smf.yaml.in
Changed
@@ -16,7 +16,7 @@ # # o Set OGS_LOG_TRACE to all domain level # level: trace -# domain: core,pfcp,fd,pfcp,gtp,smf,event,tlv,mem,sock +# domain: core,fd,pfcp,gtp,smf,event,tlv,mem,sock # logger: file: @localstatedir@/log/open5gs/smf.log @@ -179,6 +179,13 @@ # option: # so_bindtodevice: vrf-blue # +# <Metrics Server> +# +# o Metrics Server(http://<any address>:9090) +# metrics: +# addr: 0.0.0.0 +# port: 9090 +# # <Subnet for UE Pool> # # o IPv4 Pool @@ -423,6 +430,9 @@ gtpu: - addr: 127.0.0.4 - addr: ::1 + metrics: + addr: 127.0.0.4 + port: 9090 subnet: - addr: 10.45.0.1/16 - addr: 2001:db8:cafe::1/48 @@ -599,17 +609,3 @@ # handover: # duration: 500 time: - -# -# metrics: -# -# <Metrics Server> -# -# o Metrics Server(http://<any address>:9090) -# metrics: -# addr: 0.0.0.0 -# port: 9090 -# -metrics: - addr: 127.0.0.4 - port: 9090
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/sample.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/sample.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/slice.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/slice.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/srslte.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/srslte.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/volte.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/volte.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/configs/vonr.yaml.in -> open5gs_2.4.10.28.1d153.tar.xz/configs/vonr.yaml.in
Changed
@@ -19,6 +19,7 @@ # no_sgwu: true # no_pcrf: true # no_hss: true +# use_mongodb_change_stream: true mme: freeDiameter:
View file
open5gs_2.4.10.11.2b8db.tar.xz/debian/changelog -> open5gs_2.4.10.28.1d153.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -open5gs (2.4.10.11.2b8db) unstable; urgency=medium +open5gs (2.4.10.28.1d153) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom master feed - -- Osmocom OBS scripts <info@osmocom.org> Fri, 23 Sep 2022 11:52:58 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Tue, 27 Sep 2022 12:54:40 +0000 open5gs (2.4.10) unstable; urgency=medium
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_config.yml -> open5gs_2.4.10.28.1d153.tar.xz/docs/_config.yml
Changed
@@ -22,7 +22,7 @@ url: "https://open5gs.org" # the base hostname & protocol for your site, e.g. http://example.com author: "Sukchan Lee" github_username: open5gs -google_analytics: UA-139225646-2 +google_analytics: G-12MQZTB3JH # Build settings markdown: kramdown
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_docs/guide/01-quickstart.md -> open5gs_2.4.10.28.1d153.tar.xz/docs/_docs/guide/01-quickstart.md
Changed
@@ -430,6 +430,21 @@ $ sudo ip6tables -t nat -A POSTROUTING -s 2001:db8:cafe::/48 ! -o ogstun -j MASQUERADE ``` +Optionally, you may consider the settings below for security purposes. + +```bash +### Prevent UE's from connecting to the host on which UPF is running +$ sudo iptables -I INPUT -s 10.45.0.0/16 -j DROP +$ sudo ip6tables -I INPUT -s 2001:db8:cafe::/48 -j DROP + +### If your core network runs over multiple hosts, you probably want to block +### UE originating traffic from accessing other network functions. +### Replace x.x.x.x/y with the VNFs IP/subnet +$ sudo iptables -I FORWARD -s 10.45.0.0/16 -d x.x.x.x/y -j DROP +``` + +**Note:** The above assumes you do not have any existing rules in the filter and nat tables. If a program such as docker has already set up rules, you may need to add the Open5GS related rules differently. +{: .notice--danger} ## 5. Turn on your eNB/gNB and UE ---
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_docs/guide/02-building-open5gs-from-sources.md -> open5gs_2.4.10.28.1d153.tar.xz/docs/_docs/guide/02-building-open5gs-from-sources.md
Changed
@@ -468,6 +468,19 @@ $ sudo ip6tables -t nat -A POSTROUTING -s 2001:db8:cafe::/48 ! -o ogstun -j MASQUERADE ``` +Optionally, you may consider the settings below for security purposes. + +```bash +### Prevent UE's from connecting to the host on which UPF is running +$ sudo iptables -I INPUT -s 10.45.0.0/16 -j DROP +$ sudo ip6tables -I INPUT -s 2001:db8:cafe::/48 -j DROP + +### If your core network runs over multiple hosts, you probably want to block +### UE originating traffic from accessing other network functions. +### Replace x.x.x.x/y with the VNFs IP/subnet +$ sudo iptables -I FORWARD -s 10.45.0.0/16 -d x.x.x.x/y -j DROP +``` + **Note:** The above assumes you do not have any existing rules in the filter and nat tables. If a program such as docker has already set up rules, you may need to add the Open5GS related rules differently. {: .notice--danger}
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_docs/platform/05-macosx-apple-silicon.md -> open5gs_2.4.10.28.1d153.tar.xz/docs/_docs/platform/05-macosx-apple-silicon.md
Changed
@@ -69,6 +69,7 @@ $ sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255 $ sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255 $ sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255 +$ sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255 ``` Enable IP forwarding & Masquerading
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_docs/platform/06-macosx-intel.md -> open5gs_2.4.10.28.1d153.tar.xz/docs/_docs/platform/06-macosx-intel.md
Changed
@@ -69,6 +69,7 @@ $ sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255 $ sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255 $ sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255 +$ sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255 ``` Enable IP forwarding & Masquerading
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_docs/platform/07-freebsd.md -> open5gs_2.4.10.28.1d153.tar.xz/docs/_docs/platform/07-freebsd.md
Changed
@@ -89,6 +89,7 @@ $ sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255 $ sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255 $ sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255 +$ sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255 ``` Enable IP forwarding
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_includes/google-analytics.html -> open5gs_2.4.10.28.1d153.tar.xz/docs/_includes/google-analytics.html
Changed
@@ -1,10 +1,12 @@ -<script> - (function(i,s,o,g,r,a,m){i'GoogleAnalyticsObject'=r;ir=ir||function(){ - (ir.q=ir.q||).push(arguments)},ir.l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)0;a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); +{% if jekyll.environment == "production" %} + <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script> + <script> + window.dataLayer = window.dataLayer || ; - ga('create', '{{ site.google_analytics }}', 'auto'); - ga('send', 'pageview'); - -</script> + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', '{{ site.google_analytics }}'); + </script> +{% endif %}
View file
open5gs_2.4.10.11.2b8db.tar.xz/docs/_pages/support.md -> open5gs_2.4.10.28.1d153.tar.xz/docs/_pages/support.md
Changed
@@ -4,23 +4,26 @@ permalink: /support/ --- -###### Updated Sep, 2020 +###### Updated Sep, 2022 ### Open5GS Licensing Open5GS is licensed under a dual licensing model designed to meet the development and distribution needs of both commercial and open source projects. -### For Commercial Projects +The commercial Open5GS license gives you the full rights to create and distribute software on your own terms without any open source license obligations. With the commercial license you also have access to the official NeoPlane Support and close strategic relationship with NeoPlane(https://neoplane.io) to make sure your development goals are met. -Commercial distributors that develop and distribute commercially licensed Open5GS software and do not wish their software under version 3 of the GNU Affero General Public License (the “AGPL-3.0”) must enter into a commercial license agreement with NextEPC, Inc.(https://nextepc.com) +Open5GS is also available under AGPL-3.0 open source licenses. The Open5GS open source licensing is ideal for use cases such as open source projects with open source distribution, student/academic purposes, hobby projects, internal research projects without external distribution, or other projects where all AGPL-3.0 obligations can be met. -Please contact sales@nextepc.com(mailto:sales@nextepc.com) for more informations. +If your legal department has policies regarding use of software licensed under the AGPL, you may prefer to have a commercial license. Contact Sukchan Lee \<sales@neoplane.io\>(mailto:sales@neoplane.io) for more information on commercial licenses. + +### Our Partners -### For Open Source Projects +We work with leading partners in mobile communications to offer our customers complete solutions. -For developers of Free Open Source Software ("FOSS") applications under the AGPL-3.0 that want to combine and distribute those FOSS applications with Open5GS software, Open5GS open source software licensed under the AGPL-3.0 is the best option. +**NextEPC(https://nextepc.com/)**: Established in U.S. in 2019, NextEPC Inc. provides the latest wireless telecommunications technologies and outstanding support to wireless solution providers and vendors around the world. Their solutions include scalable and versatile 4G/5G core network systems. They also offer professional development and customization services for Enterprise users. + +Please contact sales@nextepc.com(mailto:sales@nextepc.com) for more informations. -sysmocom(https://sysmocom.de/) is providing commercial services around Open5GS - open source software including support, development, consulting, training and system integration. +**sysmocom(https://sysmocom.de/)**: Sysmocom was founded in Berlin, Germany by two veterans of the Free / Open Source Software (FOSS) community. They is providing commercial services around Open5GS open source software including support, development, consulting, training and system integration. Please contact Harald Welte \<sales@sysmocom.de\>(mailto:sales@sysmocom.de) for any related inquiries.
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/app/ogs-context.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/app/ogs-context.c
Changed
@@ -350,6 +350,10 @@ } else if (!strcmp(parameter_key, "no_pfcp_rr_select")) { self.parameter.no_pfcp_rr_select = ogs_yaml_iter_bool(¶meter_iter); + } else if (!strcmp(parameter_key, + "use_mongodb_change_stream")) { + self.use_mongodb_change_stream = + ogs_yaml_iter_bool(¶meter_iter); } else ogs_warn("unknown key `%s`", parameter_key); }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/app/ogs-context.h -> open5gs_2.4.10.28.1d153.tar.xz/lib/app/ogs-context.h
Changed
@@ -35,6 +35,8 @@ void *document; const char *db_uri; + int use_mongodb_change_stream; + struct { const char *file; const char *level;
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/core/ogs-time.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/core/ogs-time.c
Changed
@@ -125,7 +125,7 @@ rc = ogs_gettimeofday(&tv); ogs_assert(rc == 0); - return tv.tv_sec * OGS_USEC_PER_SEC + tv.tv_usec; + return ogs_time_from_sec(tv.tv_sec) + tv.tv_usec; } /* The following code is stolen from APR library */ @@ -188,13 +188,13 @@ rc = ogs_gettimeofday(&tv); ogs_assert(rc == 0); - return ogs_time_to_ntp32(tv.tv_sec * OGS_USEC_PER_SEC + tv.tv_usec); + return ogs_time_to_ntp32(ogs_time_from_sec(tv.tv_sec) + tv.tv_usec); } ogs_time_t ogs_time_from_ntp32(uint32_t ntp_timestamp) { if (ntp_timestamp < OGS_1970_1900_SEC_DIFF) return 0; - return (ntp_timestamp - OGS_1970_1900_SEC_DIFF) * OGS_USEC_PER_SEC; + return ogs_time_from_sec(ntp_timestamp - OGS_1970_1900_SEC_DIFF); } uint32_t ogs_time_to_ntp32(ogs_time_t time) { @@ -242,7 +242,7 @@ #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return ((ts.tv_sec * 1000000UL) + (ts.tv_nsec / 1000UL)); + return ogs_time_from_sec(ts.tv_sec) + ts.tv_nsec / 1000UL; #elif defined(__APPLE__) static mach_timebase_info_data_t info = {0}; static double ratio = 0.0; @@ -268,7 +268,7 @@ struct timeval tv; ogs_gettimeofday(&tv); - return (tv.tv_sec * 1000000UL) + tv.tv_usec; + return ogs_time_from_sec(tv.tv_sec) + tv.tv_usec; #endif }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/core/ogs-tlv.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/core/ogs-tlv.c
Changed
@@ -461,7 +461,11 @@ ogs_assert(pos); } - ogs_assert(length == (pos - blk)); + if (length != (pos - blk)) { + ogs_fatal("ogs_tlv_parse_block() failedLEN:%d,MODE:%d", length, mode); + ogs_log_hexdump(OGS_LOG_FATAL, data, length); + ogs_assert_if_reached(); + } return root; }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/core/ogs-uuid.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/core/ogs-uuid.c
Changed
@@ -80,7 +80,7 @@ /* ### fix this call to be more portable? */ ogs_gettimeofday(&tv); - *uuid_time = tv.tv_sec * OGS_USEC_PER_SEC + tv.tv_usec; + *uuid_time = ogs_time_from_sec(tv.tv_sec) + tv.tv_usec; /* Offset between UUID formatted times and Unix formatted times. UUID UTC base time is October 15, 1582.
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/dbi/meson.build -> open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/meson.build
Changed
@@ -19,11 +19,14 @@ ogs-dbi.h ogs-mongoc.h + timer.h ogs-mongoc.c subscription.c session.c ims.c + path.c + timer.c '''.split()) libmongoc_dep = dependency('libmongoc-1.0') @@ -35,10 +38,10 @@ version : libogslib_version, c_args : '-DOGS_DBI_COMPILATION', include_directories : libdbi_inc, libinc, - dependencies : libcrypt_dep, libmongoc_dep, + dependencies : libcrypt_dep, libapp_dep, libmongoc_dep, install : true) libdbi_dep = declare_dependency( link_with : libdbi, include_directories : libdbi_inc, libinc, - dependencies : libcrypt_dep, libmongoc_dep) + dependencies : libcrypt_dep, libapp_dep, libmongoc_dep)
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/dbi/ogs-dbi.h -> open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/ogs-dbi.h
Changed
@@ -21,6 +21,7 @@ #define OGS_DBI_H #include "crypt/ogs-crypt.h" +#include "app/ogs-app.h" #define OGS_DBI_INSIDE @@ -28,6 +29,8 @@ #include "dbi/subscription.h" #include "dbi/session.h" #include "dbi/ims.h" +#include "dbi/path.h" +#include "dbi/timer.h" #undef OGS_DBI_INSIDE
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/dbi/ogs-mongoc.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/ogs-mongoc.c
Changed
@@ -182,5 +182,62 @@ mongoc_collection_destroy(self.collection.subscriber); } + if (self.stream) { + mongoc_change_stream_destroy(self.stream); + } + ogs_mongoc_final(); } + +int ogs_dbi_collection_watch_init(void) +{ + bson_t empty = BSON_INITIALIZER; + const bson_t *err_doc; + bson_error_t error; + bson_t *options = BCON_NEW("fullDocument", "updateLookup"); + + ogs_mongoc()->stream = mongoc_collection_watch(self.collection.subscriber, + &empty, options); + + if (mongoc_change_stream_error_document(ogs_mongoc()->stream, &error, + &err_doc)) { + if (!bson_empty (err_doc)) { + ogs_error("Change Stream Error. Enable replica sets to " + "enable database updates to be sent to MME."); + } else { + ogs_error("Client Error: %s\n", error.message); + } + return OGS_ERROR; + } else { + ogs_info("Change Streams are Enabled."); + } + + return OGS_OK; +} + +int ogs_dbi_poll_change_stream(void) +{ + int rv; + + const bson_t *document; + const bson_t *err_document; + bson_error_t error; + + while (mongoc_change_stream_next(ogs_mongoc()->stream, &document)) { + rv = ogs_dbi_process_change_stream(document); + if (rv != OGS_OK) return rv; + } + + if (mongoc_change_stream_error_document(ogs_mongoc()->stream, &error, + &err_document)) { + if (!bson_empty (err_document)) { + ogs_debug("Server Error: %s\n", + bson_as_relaxed_extended_json(err_document, NULL)); + } else { + ogs_debug("Client Error: %s\n", error.message); + } + return OGS_ERROR; + } + + return OGS_OK; +}
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/dbi/ogs-mongoc.h -> open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/ogs-mongoc.h
Changed
@@ -37,6 +37,8 @@ void *client; void *database; + mongoc_change_stream_t *stream; + char *masked_db_uri; struct { @@ -51,6 +53,9 @@ int ogs_dbi_init(const char *db_uri); void ogs_dbi_final(void); +int ogs_dbi_collection_watch_init(void); +int ogs_dbi_poll_change_stream(void); + #ifdef __cplusplus } #endif
View file
open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/path.c
Added
@@ -0,0 +1,41 @@ +/* + * 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 "ogs-dbi.h" + +int ogs_dbi_process_change_stream(const bson_t *document) +{ + int rv; + + ogs_event_t *e = NULL; + + e = ogs_event_new(OGS_EVENT_DBI_MESSAGE); + ogs_assert(e); + e->dbi.document = bson_copy(document); + rv = ogs_queue_push(ogs_app()->queue, e); + if (rv != OGS_OK) { + ogs_error("ogs_queue_push() failed:%d", (int)rv); + bson_destroy((bson_t*)e->dbi.document); + ogs_event_free(e); + } else { + ogs_pollset_notify(ogs_app()->pollset); + } + + return OGS_OK; +}
View file
open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/path.h
Added
@@ -0,0 +1,33 @@ +/* + * 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/>. + */ + +#ifndef OGS_DBI_PATH_H +#define OGS_DBI_PATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +int ogs_dbi_process_change_stream(const bson_t *document); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_DBI_PATH_H */
View file
open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/timer.c
Added
@@ -0,0 +1,41 @@ +/* + * 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 "ogs-dbi.h" + +static void timer_send_event(int timer_id, void *data) +{ + int rv; + ogs_event_t *e = NULL; + + e = ogs_event_new(OGS_EVENT_DBI_POLL_TIMER); + ogs_assert(e); + e->timer_id = timer_id; + + rv = ogs_queue_push(ogs_app()->queue, e); + if (rv != OGS_OK) { + ogs_error("ogs_queue_push() failed:%d", (int)rv); + ogs_event_free(e); + } +} + +void ogs_timer_dbi_poll_change_stream(void *data) +{ + timer_send_event(OGS_TIMER_DBI_POLL_CHANGE_STREAM, data); +}
View file
open5gs_2.4.10.28.1d153.tar.xz/lib/dbi/timer.h
Added
@@ -0,0 +1,33 @@ +/* + * 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/>. + */ + +#ifndef OGS_DBI_TIMER_H +#define OGS_DBI_TIMER_H + +#ifdef __cplusplus +extern "C" { +#endif + +void ogs_timer_dbi_poll_change_stream(void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* OGS_DBI_TIMER_H */
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/metrics/context.h -> open5gs_2.4.10.28.1d153.tar.xz/lib/metrics/context.h
Changed
@@ -39,7 +39,7 @@ void ogs_metrics_context_close(ogs_metrics_context_t *ctx); void ogs_metrics_context_final(void); ogs_metrics_context_t *ogs_metrics_self(void); -int ogs_metrics_context_parse_config(void); +int ogs_metrics_context_parse_config(const char *local); typedef struct ogs_metrics_spec_s ogs_metrics_spec_t; ogs_metrics_spec_t *ogs_metrics_spec_new(
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/metrics/prometheus/context.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/metrics/prometheus/context.c
Changed
@@ -104,7 +104,7 @@ return &self; } -int ogs_metrics_context_parse_config(void) +int ogs_metrics_context_parse_config(const char *local) { int family = AF_UNSPEC; const char *hostname = NULL; @@ -121,17 +121,26 @@ while (ogs_yaml_iter_next(&root_iter)) { const char *root_key = ogs_yaml_iter_key(&root_iter); ogs_assert(root_key); - if (!strcmp(root_key, "metrics")) { + if (local && !strcmp(root_key, local)) { ogs_yaml_iter_t local_iter; ogs_yaml_iter_recurse(&root_iter, &local_iter); while (ogs_yaml_iter_next(&local_iter)) { const char *local_key = ogs_yaml_iter_key(&local_iter); - if (!strcmp(local_key, "addr")) { - if ((v = ogs_yaml_iter_value(&local_iter))) - hostname = v; - } else if (!strcmp(local_key, "port")) { - if ((v = ogs_yaml_iter_value(&local_iter))) - port = atoi(v); + ogs_assert(local_key); + if (!strcmp(local_key, "metrics")) { + ogs_yaml_iter_t metrics_iter; + ogs_yaml_iter_recurse(&local_iter, &metrics_iter); + while (ogs_yaml_iter_next(&metrics_iter)) { + const char *metrics_key = ogs_yaml_iter_key(&metrics_iter); + ogs_assert(metrics_key); + if (!strcmp(metrics_key, "addr")) { + if ((v = ogs_yaml_iter_value(&metrics_iter))) + hostname = v; + } else if (!strcmp(metrics_key, "port")) { + if ((v = ogs_yaml_iter_value(&metrics_iter))) + port = atoi(v); + } + } } } }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/metrics/void/context.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/metrics/void/context.c
Changed
@@ -50,7 +50,7 @@ return &self; } -int ogs_metrics_context_parse_config(void) +int ogs_metrics_context_parse_config(const char *local) { return OGS_OK; }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/proto/event.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/proto/event.c
Changed
@@ -65,6 +65,11 @@ case OGS_EVENT_SBI_TIMER: return OGS_EVENT_NAME_SBI_TIMER; + case OGS_EVENT_DBI_POLL_TIMER: + return "OGS_EVENT_DBI_POLL_TIMER"; + case OGS_EVENT_DBI_MESSAGE: + return "OGS_EVENT_DBI_MESSAGE"; + default: break; }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/proto/event.h -> open5gs_2.4.10.28.1d153.tar.xz/lib/proto/event.h
Changed
@@ -39,6 +39,9 @@ OGS_EVENT_SBI_CLIENT, OGS_EVENT_SBI_TIMER, + OGS_EVENT_DBI_POLL_TIMER, + OGS_EVENT_DBI_MESSAGE, + OGS_MAX_NUM_OF_PROTO_EVENT, } ogs_event_e; @@ -47,6 +50,8 @@ typedef struct ogs_sbi_response_s ogs_sbi_response_t; typedef struct ogs_sbi_message_s ogs_sbi_message_t; +typedef struct _bson_t bson_t; + typedef struct ogs_event_s { int id; int timer_id; @@ -59,6 +64,10 @@ ogs_sbi_message_t *message; } sbi; + + struct { + const bson_t *document; + } dbi; } ogs_event_t; void *ogs_event_size(int id, size_t size);
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/proto/timer.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/proto/timer.c
Changed
@@ -47,6 +47,8 @@ return OGS_TIMER_NAME_SUBSCRIPTION_VALIDITY; case OGS_TIMER_SBI_CLIENT_WAIT: return OGS_TIMER_NAME_SBI_CLIENT_WAIT; + case OGS_TIMER_DBI_POLL_CHANGE_STREAM: + return "OGS_TIMER_DBI_POLL_CHANGE_STREAM"; default: break; }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/proto/timer.h -> open5gs_2.4.10.28.1d153.tar.xz/lib/proto/timer.h
Changed
@@ -46,6 +46,8 @@ OGS_TIMER_SUBSCRIPTION_VALIDITY, OGS_TIMER_SBI_CLIENT_WAIT, + OGS_TIMER_DBI_POLL_CHANGE_STREAM, + OGS_MAX_NUM_OF_PROTO_TIMER, } ogs_timer_e;
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/sbi/client.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/sbi/client.c
Changed
@@ -44,6 +44,7 @@ char *memory; size_t size; + bool memory_overflow; char *location; @@ -533,6 +534,8 @@ res = resource->data.result; if (res == CURLE_OK) { + ogs_log_level_e level = OGS_LOG_DEBUG; + response = ogs_sbi_response_new(); ogs_assert(response); @@ -546,7 +549,17 @@ response->h.uri = ogs_strdup(url); ogs_assert(response->h.uri); - ogs_debug("%d:%s %s", + if (content_type) + ogs_sbi_header_set(response->http.headers, + OGS_SBI_CONTENT_TYPE, content_type); + if (conn->location) + ogs_sbi_header_set(response->http.headers, + OGS_SBI_LOCATION, conn->location); + + if (conn->memory_overflow == true) + level = OGS_LOG_ERROR; + + ogs_log_message(level, 0, "%d:%s %s", response->status, response->h.method, response->h.uri); if (conn->memory) { @@ -557,16 +570,17 @@ ogs_assert(response->http.content_length); } - ogs_debug("RECEIVED%d", (int)response->http.content_length); + ogs_log_message(level, 0, "RECEIVED%d", + (int)response->http.content_length); if (response->http.content_length && response->http.content) - ogs_debug("%s", response->http.content); + ogs_log_message(level, 0, "%s", response->http.content); + + if (conn->memory_overflow == true) { + ogs_sbi_response_free(response); + connection_remove(conn); + break; + } - if (content_type) - ogs_sbi_header_set(response->http.headers, - OGS_SBI_CONTENT_TYPE, content_type); - if (conn->location) - ogs_sbi_header_set(response->http.headers, - OGS_SBI_LOCATION, conn->location); } else ogs_warn("%d %s", res, conn->error); @@ -727,8 +741,12 @@ realsize = size * nmemb; ptr = ogs_realloc(conn->memory, conn->size + realsize + 1); if(!ptr) { - ogs_fatal("not enough memory (realloc returned NULL)"); - ogs_assert_if_reached(); + conn->memory_overflow = true; + + ogs_error("Overflow : conn->size%d, realsize%d", + (int)conn->size, (int)realsize); + ogs_log_hexdump(OGS_LOG_ERROR, contents, realsize); + return 0; }
View file
open5gs_2.4.10.11.2b8db.tar.xz/lib/sbi/nghttp2-server.c -> open5gs_2.4.10.28.1d153.tar.xz/lib/sbi/nghttp2-server.c
Changed
@@ -82,6 +82,7 @@ int32_t stream_id; ogs_sbi_request_t *request; + bool memory_overflow; ogs_sbi_session_t *session; } ogs_sbi_stream_t; @@ -791,12 +792,23 @@ case NGHTTP2_DATA: /* HEADERS or DATA frame with +END_STREAM flag */ if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) { + ogs_log_level_e level = OGS_LOG_DEBUG; - ogs_debug("%s %s", request->h.method, request->h.uri); + if (stream->memory_overflow == true) + level = OGS_LOG_ERROR; + + ogs_log_message(level, 0, + "%s %s", request->h.method, request->h.uri); if (request->http.content_length && request->http.content) { - ogs_debug("RECEIVED: %d", (int)request->http.content_length); - ogs_debug("%s", request->http.content); + ogs_log_message(level, 0, + "RECEIVED: %d", (int)request->http.content_length); + ogs_log_message(level, 0, "%s", request->http.content); + } + + if (stream->memory_overflow == true) { + ogs_error("DROP Overflow"); + break; } if (server->cb(request, stream) != OGS_OK) { @@ -967,23 +979,30 @@ ogs_assert(len); if (request->http.content == NULL) { - request->http.content_length = len; - request->http.content = - (char*)ogs_malloc(request->http.content_length + 1); - ogs_assert(request->http.content); + ogs_assert(request->http.content_length == 0); + ogs_assert(offset == 0); + + request->http.content = (char*)ogs_malloc(len + 1); } else { - offset = request->http.content_length; - if ((request->http.content_length + len) > OGS_HUGE_LEN) { - ogs_error("Overflow : Content-Length%d, len%d", - (int)request->http.content_length, (int)len); - ogs_assert_if_reached(); - } - request->http.content_length += len; - request->http.content = (char *)ogs_realloc( - request->http.content, request->http.content_length + 1); - ogs_assert(request->http.content); + ogs_assert(request->http.content_length != 0); + + request->http.content = (char*)ogs_realloc( + request->http.content, request->http.content_length + len + 1); } + if (!request->http.content) { + stream->memory_overflow = true; + + ogs_error("Overflow : Content-Length%d, len%d", + (int)request->http.content_length, (int)len); + ogs_log_hexdump(OGS_LOG_ERROR, data, len); + + return 0; + } + + offset = request->http.content_length; + request->http.content_length += len; + memcpy(request->http.content + offset, data, len); request->http.contentrequest->http.content_length = '\0';
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/amf/context.c -> open5gs_2.4.10.28.1d153.tar.xz/src/amf/context.c
Changed
@@ -825,6 +825,8 @@ /* handle config in sbi library */ } else if (!strcmp(amf_key, "discovery")) { /* handle config in sbi library */ + } else if (!strcmp(amf_key, "metrics")) { + /* handle config in metrics library */ } else ogs_warn("unknown key `%s`", amf_key); }
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/amf/init.c -> open5gs_2.4.10.28.1d153.tar.xz/src/amf/init.c
Changed
@@ -37,7 +37,7 @@ rv = ogs_sbi_context_parse_config("amf", "nrf", "scp"); if (rv != OGS_OK) return rv; - rv = ogs_metrics_context_parse_config(); + rv = ogs_metrics_context_parse_config("amf"); if (rv != OGS_OK) return rv; rv = amf_context_parse_config();
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/hss/hss-context.c -> open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-context.c
Changed
@@ -19,6 +19,9 @@ #include "ogs-dbi.h" #include "hss-context.h" +#include "hss-event.h" +#include "hss-s6a-path.h" + typedef struct hss_impi_s hss_impi_t; @@ -680,7 +683,7 @@ { hss_impi_t *impi = NULL; hss_impu_t *impu = NULL; - + ogs_assert(user_name); ogs_assert(public_identity); @@ -1171,3 +1174,134 @@ return user_data; } + +int hss_db_poll_change_stream(void) +{ + int rv; + + ogs_thread_mutex_lock(&self.db_lock); + + rv = ogs_dbi_poll_change_stream(); + + ogs_thread_mutex_unlock(&self.db_lock); + + return rv; +} + +int hss_handle_change_event(const bson_t *document) +{ + bson_iter_t iter, child1_iter, child2_iter, child3_iter; + + char *utf8 = NULL; + uint32_t length = 0; + + bool send_clr_flag = false; + bool send_idr_flag = false; + uint32_t subdatamask = 0; + + char *imsi_bcd; + + char *as_json = bson_as_relaxed_extended_json(document, NULL); + ogs_debug("Got document: %s\n", as_json); + if (!bson_iter_init_find(&iter, document, "fullDocument")) { + ogs_error("No 'imsi' field in this document."); + return OGS_ERROR; + } else { + bson_iter_recurse(&iter, &child1_iter); + while (bson_iter_next(&child1_iter)) { + const char *key = bson_iter_key(&child1_iter); + if (!strcmp(key, "imsi") && + BSON_ITER_HOLDS_UTF8(&child1_iter)) { + utf8 = (char *)bson_iter_utf8(&child1_iter, &length); + imsi_bcd = ogs_strndup(utf8, + ogs_min(length, OGS_MAX_IMSI_BCD_LEN) + 1); + ogs_assert(imsi_bcd); + } + } + } + + if (!imsi_bcd) { + ogs_error("No 'imsi' field in this document."); + return OGS_ERROR; + } + + if (bson_iter_init_find(&iter, document, "updateDescription")) { + bson_iter_recurse(&iter, &child1_iter); + while (bson_iter_next(&child1_iter)) { + const char *key = bson_iter_key(&child1_iter); + if (!strcmp(key, "updatedFields") && + BSON_ITER_HOLDS_DOCUMENT(&child1_iter)) { + bson_iter_recurse(&child1_iter, &child2_iter); + while (bson_iter_next(&child2_iter)) { + const char *child2_key = bson_iter_key(&child2_iter); + if (!strcmp(child2_key, + "request_cancel_location") && + BSON_ITER_HOLDS_BOOL(&child2_iter)) { + send_clr_flag = (char *)bson_iter_bool(&child2_iter); + } else if (!strncmp(child2_key, "msisdn", + strlen("msisdn"))) { + int msisdn_count = 0; + bson_iter_recurse(&child2_iter, &child3_iter); + while (bson_iter_next(&child3_iter)) { + if (BSON_ITER_HOLDS_UTF8(&child3_iter)) { + msisdn_count++; + } + } + if (msisdn_count) { + send_idr_flag = true; + subdatamask = (subdatamask | + OGS_HSS_SUBDATA_MSISDN); + } else { + send_clr_flag = true; + } + } else if (!strncmp(child2_key, + "access_restriction_data", + strlen("access_restriction_data"))) { + send_idr_flag = true; + subdatamask = (subdatamask | OGS_HSS_SUBDATA_ARD); + } else if (!strncmp(child2_key, + "subscriber_status", + strlen("subscriber_status"))) { + send_idr_flag = true; + subdatamask = (subdatamask | + OGS_HSS_SUBDATA_SUB_STATUS); + } else if (!strncmp(child2_key, + "network_access_mode", + strlen("network_access_mode"))) { + send_idr_flag = true; + subdatamask = (subdatamask | OGS_HSS_SUBDATA_NAM); + } else if (!strncmp(child2_key, "ambr", strlen("ambr"))) { + send_idr_flag = true; + subdatamask = (subdatamask | OGS_HSS_SUBDATA_UEAMBR); + } else if (!strncmp(child2_key, + "subscribed_rau_tau_timer", + strlen("subscribed_rau_tau_timer"))) { + send_idr_flag = true; + subdatamask = (subdatamask | + OGS_HSS_SUBDATA_RAU_TAU_TIMER); + } else if (!strncmp(child2_key, "slice", strlen("slice"))) { + send_idr_flag = true; + subdatamask = (subdatamask | OGS_HSS_SUBDATA_SLICE); + } + } + } + } + } else { + ogs_debug("No 'updateDescription' field in this document"); + } + + bson_free (as_json); + + 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); + } else if (send_idr_flag) { + ogs_info("%s Subscription-Data Changed", imsi_bcd); + hss_s6a_send_idr(imsi_bcd, 0, subdatamask); + } + + ogs_free(imsi_bcd); + + return OGS_OK; +}
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/hss/hss-context.h -> open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-context.h
Changed
@@ -92,6 +92,9 @@ char *user_name, char *visited_network_identifier, ogs_ims_data_t *ims_data); +int hss_db_poll_change_stream(void); +int hss_handle_change_event(const bson_t *document); + #ifdef __cplusplus }
View file
open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-event.c
Added
@@ -0,0 +1,27 @@ +/* + * 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 "hss-event.h" +#include "ogs-app.h" + +void hss_event_term(void) +{ + ogs_queue_term(ogs_app()->queue); + ogs_pollset_notify(ogs_app()->pollset); +}
View file
open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-event.h
Added
@@ -0,0 +1,35 @@ +/* + * 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/>. + */ + +#ifndef HSS_EVENT_H +#define HSS_EVENT_H + +#include "ogs-core.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void hss_event_term(void); + +#ifdef __cplusplus +} +#endif + +#endif /* HSS_EVENT_H */
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/hss/hss-fd-path.h -> open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-fd-path.h
Changed
@@ -39,4 +39,3 @@ #endif #endif /* HSS_FD_PATH_H */ -
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/hss/hss-init.c -> open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-init.c
Changed
@@ -19,6 +19,11 @@ #include "hss-context.h" #include "hss-fd-path.h" +#include "hss-sm.h" + + +static ogs_thread_t *thread; +static void hss_main(void *data); static int initialized = 0; @@ -41,6 +46,9 @@ rv = hss_fd_init(); if (rv != OGS_OK) return OGS_ERROR; + thread = ogs_thread_create(hss_main, NULL); + if (!thread) return OGS_ERROR; + initialized = 1; return OGS_OK; @@ -50,6 +58,9 @@ { if (!initialized) return; + hss_event_term(); + ogs_thread_destroy(thread); + hss_fd_final(); ogs_dbi_final(); @@ -57,3 +68,49 @@ return; } + +static void hss_main(void *data) +{ + ogs_fsm_t hss_sm; + int rv; + + ogs_fsm_init(&hss_sm, hss_state_initial, hss_state_final, 0); + + for ( ;; ) { + ogs_pollset_poll(ogs_app()->pollset, + ogs_timer_mgr_next(ogs_app()->timer_mgr)); + + /* + * After ogs_pollset_poll(), ogs_timer_mgr_expire() must be called. + * + * The reason is why ogs_timer_mgr_next() can get the corrent value + * when ogs_timer_stop() is called internally in ogs_timer_mgr_expire(). + * + * You should not use event-queue before ogs_timer_mgr_expire(). + * In this case, ogs_timer_mgr_expire() does not work + * because 'if rv == OGS_DONE' statement is exiting and + * not calling ogs_timer_mgr_expire(). + */ + ogs_timer_mgr_expire(ogs_app()->timer_mgr); + + for ( ;; ) { + ogs_event_t *e = NULL; + + rv = ogs_queue_trypop(ogs_app()->queue, (void**)&e); + ogs_assert(rv != OGS_ERROR); + + if (rv == OGS_DONE) + goto done; + + if (rv == OGS_RETRY) + break; + + ogs_assert(e); + ogs_fsm_dispatch(&hss_sm, e); + ogs_event_free(e); + } + } +done: + + ogs_fsm_fini(&hss_sm, 0); +}
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/hss/hss-s6a-path.c -> open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-s6a-path.c
Changed
@@ -719,7 +719,7 @@ ret = fd_msg_avp_add(apn_configuration_profile, MSG_BRW_LAST_CHILD, apn_configuration); ogs_assert(ret == 0); - + } ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, apn_configuration_profile); @@ -825,7 +825,7 @@ ogs_assert(mme_host); ogs_assert(mme_realm); - /* If UE is not purged at MME, determine if the MME sending the ULR + /* If UE is not purged at MME, determine if the MME sending the ULR * is different from the one that was last used. if so, send CLR. */ if (subscription_data.mme_host != NULL && @@ -1269,6 +1269,7 @@ ogs_assert(pthread_mutex_lock(&ogs_diam_logger_self()->stats_lock) == 0); ogs_diam_logger_self()->stats.nb_sent++; ogs_assert(pthread_mutex_unlock(&ogs_diam_logger_self()->stats_lock) == 0); + } /* HSS received Cancel Location Answer from MME */ @@ -1286,7 +1287,7 @@ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); ogs_expect_or_return(ret == 0); ogs_expect_or_return(new == 0); - + ret = fd_sess_state_retrieve(hss_s6a_reg, session, &sess_data); ogs_expect_or_return(ret == 0); ogs_expect_or_return(sess_data); @@ -1326,8 +1327,8 @@ if (subscription_data.purge_flag) { ogs_error(" %s UE Purged at MME. Cannot send IDR.", imsi_bcd); - return OGS_ERROR; - } + return OGS_ERROR; + } /* Create the random value to store with the session */ sess_data = ogs_calloc(1, sizeof(*sess_data)); @@ -1405,7 +1406,7 @@ ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); ogs_assert(ret == 0); } - + /* Set the Subscription Data */ ret = fd_msg_avp_new(ogs_diam_s6a_subscription_data, 0, &avp); ogs_assert(ret == 0); @@ -1415,11 +1416,11 @@ if (ret != OGS_OK) { ogs_error(" %s Could not build Subscription-Data.", imsi_bcd); - return OGS_ERROR; + return OGS_ERROR; } } ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp); - ogs_assert(ret == 0); + ogs_assert(ret == 0); /* Set Vendor-Specific-Application-Id AVP */ ret = ogs_diam_message_vendor_specific_appid_set( @@ -1464,7 +1465,7 @@ ret = fd_msg_sess_get(fd_g_config->cnf_dict, *msg, &session, &new); ogs_expect_or_return(ret == 0); ogs_expect_or_return(new == 0); - + ret = fd_sess_state_retrieve(hss_s6a_reg, session, &sess_data); ogs_expect_or_return(ret == 0); ogs_expect_or_return(sess_data); @@ -1527,7 +1528,7 @@ void hss_s6a_final(void) { int ret; - + ret = fd_sess_handler_destroy(&hss_s6a_reg, NULL); ogs_assert(ret == OGS_OK);
View file
open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-sm.c
Added
@@ -0,0 +1,100 @@ +/* + * Copyright (C) 2019-2022 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 "hss-sm.h" +#include "hss-context.h" +#include "hss-event.h" + +#define DB_POLLING_TIME ogs_time_from_msec(100) + +static ogs_timer_t *t_db_polling = NULL; + +void hss_state_initial(ogs_fsm_t *s, ogs_event_t *e) +{ + hss_sm_debug(e); + + ogs_assert(s); + + if (ogs_app()->use_mongodb_change_stream) { + ogs_dbi_collection_watch_init(); + + t_db_polling = ogs_timer_add(ogs_app()->timer_mgr, + ogs_timer_dbi_poll_change_stream, 0); + ogs_assert(t_db_polling); + ogs_timer_start(t_db_polling, DB_POLLING_TIME); + + OGS_FSM_TRAN(s, &hss_state_operational); + } +} + +void hss_state_final(ogs_fsm_t *s, ogs_event_t *e) +{ + hss_sm_debug(e); + + if (t_db_polling) + ogs_timer_delete(t_db_polling); + + ogs_assert(s); +} + +void hss_state_operational(ogs_fsm_t *s, ogs_event_t *e) +{ + hss_sm_debug(e); + + ogs_assert(s); + + switch (e->id) { + case OGS_FSM_ENTRY_SIG: + break; + + case OGS_FSM_EXIT_SIG: + if (t_db_polling) { + ogs_timer_stop(t_db_polling); + } + break; + + case OGS_EVENT_DBI_POLL_TIMER: + ogs_assert(e); + + switch(e->timer_id) { + case OGS_TIMER_DBI_POLL_CHANGE_STREAM: + hss_db_poll_change_stream(); + ogs_timer_start(t_db_polling, DB_POLLING_TIME); + break; + + default: + ogs_error("Unknown timer%s:%d", + ogs_timer_get_name(e->timer_id), e->timer_id); + } + break; + + case OGS_EVENT_DBI_MESSAGE: + ogs_assert(e); + + ogs_assert(e->dbi.document); + hss_handle_change_event(e->dbi.document); + + bson_destroy((bson_t*)e->dbi.document); + break; + + default: + ogs_error("No handler for event %s", ogs_event_get_name(e)); + break; + } +}
View file
open5gs_2.4.10.28.1d153.tar.xz/src/hss/hss-sm.h
Added
@@ -0,0 +1,42 @@ +/* + * Copyright (C) 2019-2022 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/>. + */ + +#ifndef HSS_SM_H +#define HSS_SM_H + +#include "hss-event.h" +#include "ogs-proto.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void hss_state_initial(ogs_fsm_t *s, ogs_event_t *e); +void hss_state_final(ogs_fsm_t *s, ogs_event_t *e); +void hss_state_operational(ogs_fsm_t *s, ogs_event_t *e); +void hss_state_exception(ogs_fsm_t *s, ogs_event_t *e); + +#define hss_sm_debug(__pe) \ + ogs_debug("%s(): %s", __func__, ogs_event_get_name(__pe)) + +#ifdef __cplusplus +} +#endif + +#endif /* HSS_SM_H */
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/hss/meson.build -> open5gs_2.4.10.28.1d153.tar.xz/src/hss/meson.build
Changed
@@ -19,9 +19,13 @@ hss-context.h hss-fd-path.h hss-s6a-path.h + hss-event.h + hss-sm.h hss-init.c hss-context.c + hss-event.c + hss-sm.c hss-s6a-path.c hss-cx-path.c
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/mme/mme-context.c -> open5gs_2.4.10.28.1d153.tar.xz/src/mme/mme-context.c
Changed
@@ -1277,6 +1277,8 @@ YAML_SEQUENCE_NODE); } else if (!strcmp(mme_key, "mme_name")) { self.mme_name = ogs_yaml_iter_value(&mme_iter); + } else if (!strcmp(mme_key, "metrics")) { + /* handle config in metrics library */ } else ogs_warn("unknown key `%s`", mme_key); }
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/mme/mme-init.c -> open5gs_2.4.10.28.1d153.tar.xz/src/mme/mme-init.c
Changed
@@ -49,7 +49,7 @@ rv = ogs_gtp_context_parse_config("mme", "sgwc"); if (rv != OGS_OK) return rv; - rv = ogs_metrics_context_parse_config(); + rv = ogs_metrics_context_parse_config("mme"); if (rv != OGS_OK) return rv; rv = mme_context_parse_config();
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/mme/mme-s11-handler.c -> open5gs_2.4.10.28.1d153.tar.xz/src/mme/mme-s11-handler.c
Changed
@@ -220,7 +220,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed Bearer-CAUSE:%d", cause_value); + ogs_error("GTP Bearer Cause VALUE:%d", cause_value); if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) { ogs_error("%s Attach reject", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, @@ -240,7 +240,7 @@ OGS_GTP2_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE && cause_value != OGS_GTP2_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) { ogs_error("%s Attach reject", mme_ue->imsi_bcd); ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue, @@ -467,7 +467,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; } @@ -548,7 +548,7 @@ cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) - ogs_error("GTP Failed CAUSE:%d - Ignored", cause_value); + ogs_error("GTP Cause Value:%d - Ignored", cause_value); } /******************** @@ -1143,7 +1143,7 @@ cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) - ogs_error("GTP Failed CAUSE:%d, ACTION:%d", cause_value, action); + ogs_error("GTP Cause Value:%d, ACTION:%d", cause_value, action); } /******************** @@ -1455,7 +1455,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; } @@ -1571,7 +1571,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); mme_send_delete_session_or_mme_ue_context_release(mme_ue); return; } @@ -1639,7 +1639,7 @@ ogs_assert(cause); cause_value = cause->value; - ogs_warn("GTP Failed CAUSE:%d - Ignored", cause_value); + ogs_warn("GTP Cause Value:%d - Ignored", cause_value); } else { ogs_error("No Cause"); }
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/mme/mme-s6a-handler.c -> open5gs_2.4.10.28.1d153.tar.xz/src/mme/mme-s6a-handler.c
Changed
@@ -102,13 +102,27 @@ break; } - mme_ue->sessioni.name = ogs_strdup(slice_data->sessioni.name); - ogs_assert(mme_ue->sessioni.name); + if (slice_data->sessioni.name) { + mme_ue->sessioni.name = ogs_strdup(slice_data->sessioni.name); + ogs_assert(mme_ue->sessioni.name); + } mme_ue->sessioni.context_identifier = slice_data->sessioni.context_identifier; - mme_ue->sessioni.session_type = slice_data->sessioni.session_type; + if (slice_data->sessioni.session_type == OGS_PDU_SESSION_TYPE_IPV4 || + slice_data->sessioni.session_type == OGS_PDU_SESSION_TYPE_IPV6 || + slice_data->sessioni.session_type == + OGS_PDU_SESSION_TYPE_IPV4V6) { + mme_ue->sessioni.session_type = + slice_data->sessioni.session_type; + } else { + ogs_error("Invalid PDN_TYPE%d", + slice_data->sessioni.session_type); + if (mme_ue->sessioni.name) + ogs_free(mme_ue->sessioni.name); + break; + } memcpy(&mme_ue->sessioni.paa, &slice_data->sessioni.paa, sizeof(mme_ue->sessioni.paa)); @@ -127,6 +141,11 @@ slice_data->sessioni.charging_characteristics_presence; } + if (i == 0) { + ogs_error("No Session"); + return OGS_NAS_EMM_CAUSE_SEVERE_NETWORK_FAILURE; + } + mme_ue->num_of_session = i; mme_ue->context_identifier = slice_data->context_identifier;
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/sgwc/pfcp-sm.c -> open5gs_2.4.10.28.1d153.tar.xz/src/sgwc/pfcp-sm.c
Changed
@@ -169,12 +169,16 @@ switch (e->id) { case OGS_FSM_ENTRY_SIG: - ogs_info("PFCP associated"); + ogs_info("PFCP associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_start(node->t_no_heartbeat, ogs_app()->time.message.pfcp.no_heartbeat_duration); break; case OGS_FSM_EXIT_SIG: - ogs_info("PFCP de-associated"); + ogs_info("PFCP de-associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_stop(node->t_no_heartbeat); break; case SGWC_EVT_SXA_MESSAGE: @@ -206,12 +210,16 @@ &message->pfcp_heartbeat_response)); break; case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE: - ogs_warn("PFCPREQ has already been associated"); + ogs_warn("PFCPREQ has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_cp_handle_association_setup_request(node, xact, &message->pfcp_association_setup_request); break; case OGS_PFCP_ASSOCIATION_SETUP_RESPONSE_TYPE: - ogs_warn("PFCPRSP has already been associated"); + ogs_warn("PFCPRSP has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_cp_handle_association_setup_response(node, xact, &message->pfcp_association_setup_response); break;
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/sgwc/s11-handler.c -> open5gs_2.4.10.28.1d153.tar.xz/src/sgwc/s11-handler.c
Changed
@@ -766,7 +766,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); ogs_assert(OGS_OK == sgwc_pfcp_send_bearer_modification_request( bearer, NULL, NULL, @@ -919,7 +919,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed Bearer-CAUSE:%d", cause_value); + ogs_error("GTP Bearer Cause VALUE:%d", cause_value); ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0, OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value); return; @@ -929,7 +929,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0, OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value); return; @@ -1022,7 +1022,7 @@ cause_value = cause->value; if (cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { } else { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); } } else { ogs_error("No Cause"); @@ -1062,13 +1062,13 @@ if (cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { } else { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); } } else { ogs_error("No Cause"); } } else { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); } } else { ogs_error("No Cause"); @@ -1172,7 +1172,7 @@ cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) - ogs_warn("GTP Failed CAUSE:%d - PFCP_CAUSE%d", + ogs_warn("GTP Cause Value:%d - PFCP_CAUSE%d", cause_value, pfcp_cause_from_gtp(cause_value)); } else { ogs_error("No Cause");
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/sgwc/s5c-handler.c -> open5gs_2.4.10.28.1d153.tar.xz/src/sgwc/s5c-handler.c
Changed
@@ -79,9 +79,6 @@ ogs_gtp_xact_t *s11_xact = NULL; ogs_gtp_node_t *pgw = NULL; - ogs_assert(sess); - sgwc_ue = sess->sgwc_ue; - ogs_assert(sgwc_ue); ogs_assert(gtpbuf); ogs_assert(message); rsp = &message->create_session_response; @@ -99,10 +96,32 @@ rv = ogs_gtp_xact_commit(s5c_xact); ogs_expect(rv == OGS_OK); + /************************ + * Check Session Context + * + * - Session could be deleted before a message is received from SMF. + ************************/ + cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED; + + if (!sess) { + ogs_error("No Context in TEID"); + cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND; + } else { + sgwc_ue = sess->sgwc_ue; + ogs_assert(sgwc_ue); + } + + if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { + ogs_gtp_send_error_message( + s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, + OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value); + return; + } + /***************************************** * Check Mandatory/Conditional IE Missing *****************************************/ - cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED; + ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED); if (rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.presence == 0) { ogs_error("No GTP TEID"); @@ -150,7 +169,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed Bearer-CAUSE:%d", cause_value); + ogs_error("GTP Bearer Cause VALUE:%d", cause_value); ogs_gtp_send_error_message( s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value); @@ -167,7 +186,7 @@ OGS_GTP2_CAUSE_NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE && cause_value != OGS_GTP2_CAUSE_NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); ogs_gtp_send_error_message( s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value); @@ -280,9 +299,6 @@ ogs_gtp_xact_t *s11_xact = NULL; ogs_gtp2_modify_bearer_response_t *rsp = NULL; - ogs_assert(sess); - sgwc_ue = sess->sgwc_ue; - ogs_assert(sgwc_ue); ogs_assert(message); rsp = &message->modify_bearer_response; ogs_assert(rsp); @@ -300,10 +316,37 @@ rv = ogs_gtp_xact_commit(s5c_xact); ogs_expect(rv == OGS_OK); + /************************ + * Check Session Context + * + * - Session could be deleted before a message is received from SMF. + ************************/ + cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED; + + if (!sess) { + ogs_error("No Context in TEID"); + cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND; + } else { + sgwc_ue = sess->sgwc_ue; + ogs_assert(sgwc_ue); + } + + if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { + if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST) + ogs_gtp_send_error_message( + s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, + OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value); + else + ogs_gtp_send_error_message( + s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, + OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value); + return; + } + /***************************************** * Check Mandatory/Conditional IE Missing *****************************************/ - cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED; + ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED); if (rsp->cause.presence == 0) { ogs_error("No Cause"); @@ -331,7 +374,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST) ogs_gtp_send_error_message( s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, @@ -385,9 +428,6 @@ ogs_gtp_xact_t *s11_xact = NULL; ogs_gtp2_delete_session_response_t *rsp = NULL; - ogs_assert(sess); - sgwc_ue = sess->sgwc_ue; - ogs_assert(sgwc_ue); ogs_assert(message); rsp = &message->delete_session_response; ogs_assert(rsp); @@ -404,10 +444,32 @@ rv = ogs_gtp_xact_commit(s5c_xact); ogs_expect(rv == OGS_OK); + /************************ + * Check Session Context + * + * - Session could be deleted before a message is received from SMF. + ************************/ + cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED; + + if (!sess) { + ogs_error("No Context in TEID"); + cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND; + } else { + sgwc_ue = sess->sgwc_ue; + ogs_assert(sgwc_ue); + } + + if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { + ogs_gtp_send_error_message( + s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, + OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value); + return; + } + /***************************************** * Check Mandatory/Conditional IE Missing *****************************************/ - cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED; + ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED); if (rsp->cause.presence == 0) { ogs_error("No Cause"); @@ -430,7 +492,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); ogs_gtp_send_error_message( s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0, OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value); @@ -835,9 +897,6 @@ sgwc_ue_t *sgwc_ue = NULL; - ogs_assert(sess); - sgwc_ue = sess->sgwc_ue; - ogs_assert(sgwc_ue); ogs_assert(message); ind = &message->bearer_resource_failure_indication; ogs_assert(ind); @@ -851,6 +910,19 @@ s11_xact = s5c_xact->assoc_xact; ogs_assert(s11_xact); + /************************ + * Check Session Context + * + * - Session could be deleted before a message is received from SMF. + ************************/ + if (!sess) { + ogs_error("No Context in TEID"); + cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND; + } else { + sgwc_ue = sess->sgwc_ue; + ogs_assert(sgwc_ue); + } + /******************** * Check Cause Value ********************/
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/sgwc/sxa-handler.c -> open5gs_2.4.10.28.1d153.tar.xz/src/sgwc/sxa-handler.c
Changed
@@ -1325,12 +1325,21 @@ ogs_debug("Session Report Request"); - ogs_assert(sess); ogs_assert(pfcp_xact); ogs_assert(pfcp_req); cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED; + /************************ + * Check Session Context + * + * - Session could be deleted before a message is received from SMF. + ************************/ + if (!sess) { + ogs_error("No Context"); + cause_value = OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND; + } + if (pfcp_req->report_type.presence == 0) { ogs_error("No Report Type"); cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/sgwu/pfcp-sm.c -> open5gs_2.4.10.28.1d153.tar.xz/src/sgwu/pfcp-sm.c
Changed
@@ -165,12 +165,16 @@ switch (e->id) { case OGS_FSM_ENTRY_SIG: - ogs_info("PFCP associated"); + ogs_info("PFCP associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_start(node->t_no_heartbeat, ogs_app()->time.message.pfcp.no_heartbeat_duration); break; case OGS_FSM_EXIT_SIG: - ogs_info("PFCP de-associated"); + ogs_info("PFCP de-associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_stop(node->t_no_heartbeat); break; case SGWU_EVT_SXA_MESSAGE: @@ -194,12 +198,16 @@ &message->pfcp_heartbeat_response)); break; case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE: - ogs_warn("PFCPREQ has already been associated"); + ogs_warn("PFCPREQ has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_up_handle_association_setup_request(node, xact, &message->pfcp_association_setup_request); break; case OGS_PFCP_ASSOCIATION_SETUP_RESPONSE_TYPE: - ogs_warn("PFCPRSP has already been associated"); + ogs_warn("PFCPRSP has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_up_handle_association_setup_response(node, xact, &message->pfcp_association_setup_response); break;
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/smf/context.c -> open5gs_2.4.10.28.1d153.tar.xz/src/smf/context.c
Changed
@@ -835,6 +835,8 @@ /* handle config in sbi library */ } else if (!strcmp(smf_key, "discovery")) { /* handle config in sbi library */ + } else if (!strcmp(smf_key, "metrics")) { + /* handle config in metrics library */ } else ogs_warn("unknown key `%s`", smf_key); }
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/smf/init.c -> open5gs_2.4.10.28.1d153.tar.xz/src/smf/init.c
Changed
@@ -55,7 +55,7 @@ rv = ogs_sbi_context_parse_config("smf", "nrf", "scp"); if (rv != OGS_OK) return rv; - rv = ogs_metrics_context_parse_config(); + rv = ogs_metrics_context_parse_config("smf"); if (rv != OGS_OK) return rv; rv = smf_context_parse_config();
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/smf/n4-handler.c -> open5gs_2.4.10.28.1d153.tar.xz/src/smf/n4-handler.c
Changed
@@ -1063,7 +1063,7 @@ return OGS_PFCP_CAUSE_MANDATORY_IE_MISSING; } if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) { - ogs_warn("PFCP Cause%d : Not Accepted", rsp->cause.u8); + ogs_warn("PFCP Cause %d : Not Accepted", rsp->cause.u8); return rsp->cause.u8; }
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/smf/pfcp-sm.c -> open5gs_2.4.10.28.1d153.tar.xz/src/smf/pfcp-sm.c
Changed
@@ -171,12 +171,16 @@ switch (e->h.id) { case OGS_FSM_ENTRY_SIG: - ogs_info("PFCP associated"); + ogs_info("PFCP associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_start(node->t_no_heartbeat, ogs_app()->time.message.pfcp.no_heartbeat_duration); break; case OGS_FSM_EXIT_SIG: - ogs_info("PFCP de-associated"); + ogs_info("PFCP de-associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_stop(node->t_no_heartbeat); break; case SMF_EVT_N4_MESSAGE: @@ -210,12 +214,16 @@ &message->pfcp_heartbeat_response)); break; case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE: - ogs_warn("PFCPREQ has already been associated"); + ogs_warn("PFCPREQ has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_cp_handle_association_setup_request(node, xact, &message->pfcp_association_setup_request); break; case OGS_PFCP_ASSOCIATION_SETUP_RESPONSE_TYPE: - ogs_warn("PFCPRSP has already been associated"); + ogs_warn("PFCPRSP has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_cp_handle_association_setup_response(node, xact, &message->pfcp_association_setup_response); break;
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/smf/s5c-handler.c -> open5gs_2.4.10.28.1d153.tar.xz/src/smf/s5c-handler.c
Changed
@@ -708,7 +708,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed Bearer-CAUSE:%d", cause_value); + ogs_error("GTP Bearer Cause VALUE:%d", cause_value); ogs_assert(OGS_OK == smf_epc_pfcp_send_one_bearer_modification_request( bearer, NULL, OGS_PFCP_MODIFY_REMOVE, @@ -721,7 +721,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); ogs_assert(OGS_OK == smf_epc_pfcp_send_one_bearer_modification_request( bearer, NULL, OGS_PFCP_MODIFY_REMOVE, @@ -837,7 +837,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed Bearer-CAUSE:%d", cause_value); + ogs_error("GTP Bearer Cause VALUE:%d", cause_value); return; } @@ -845,7 +845,7 @@ ogs_assert(cause); cause_value = cause->value; if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); return; } @@ -925,7 +925,7 @@ cause_value = cause->value; if (cause->value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { } else { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); } } else { ogs_error("No Cause"); @@ -965,13 +965,13 @@ if (cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED) { } else { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); } } else { ogs_error("No Cause"); } } else { - ogs_error("GTP Failed CAUSE:%d", cause_value); + ogs_error("GTP Cause Value:%d", cause_value); } } else { ogs_error("No Cause");
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/upf/context.c -> open5gs_2.4.10.28.1d153.tar.xz/src/upf/context.c
Changed
@@ -547,7 +547,8 @@ if (!urr_acc->t_validity_time) urr_acc->t_validity_time = ogs_timer_add(ogs_app()->timer_mgr, upf_sess_urr_acc_timers_cb, urr); - ogs_timer_start(urr_acc->t_validity_time, urr->quota_validity_time * OGS_USEC_PER_SEC); + ogs_timer_start(urr_acc->t_validity_time, + ogs_time_from_sec(urr->quota_validity_time)); } static void upf_sess_urr_acc_time_quota_setup(upf_sess_t *sess, ogs_pfcp_urr_t *urr) { @@ -558,7 +559,7 @@ if (!urr_acc->t_time_quota) urr_acc->t_time_quota = ogs_timer_add(ogs_app()->timer_mgr, upf_sess_urr_acc_timers_cb, urr); - ogs_timer_start(urr_acc->t_time_quota, urr->time_quota * OGS_USEC_PER_SEC); + ogs_timer_start(urr_acc->t_time_quota, ogs_time_from_sec(urr->time_quota)); } static void upf_sess_urr_acc_time_threshold_setup(upf_sess_t *sess, ogs_pfcp_urr_t *urr) { @@ -569,7 +570,8 @@ if (!urr_acc->t_time_threshold) urr_acc->t_time_threshold = ogs_timer_add(ogs_app()->timer_mgr, upf_sess_urr_acc_timers_cb, urr); - ogs_timer_start(urr_acc->t_time_threshold, urr->time_threshold * OGS_USEC_PER_SEC); + ogs_timer_start(urr_acc->t_time_threshold, + ogs_time_from_sec(urr->time_threshold)); } void upf_sess_urr_acc_timers_setup(upf_sess_t *sess, ogs_pfcp_urr_t *urr)
View file
open5gs_2.4.10.11.2b8db.tar.xz/src/upf/pfcp-sm.c -> open5gs_2.4.10.28.1d153.tar.xz/src/upf/pfcp-sm.c
Changed
@@ -170,12 +170,16 @@ switch (e->id) { case OGS_FSM_ENTRY_SIG: - ogs_info("PFCP associated"); + ogs_info("PFCP associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_start(node->t_no_heartbeat, ogs_app()->time.message.pfcp.no_heartbeat_duration); break; case OGS_FSM_EXIT_SIG: - ogs_info("PFCP de-associated"); + ogs_info("PFCP de-associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_timer_stop(node->t_no_heartbeat); break; case UPF_EVT_N4_MESSAGE: @@ -199,12 +203,16 @@ &message->pfcp_heartbeat_response)); break; case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE: - ogs_warn("PFCPREQ has already been associated"); + ogs_warn("PFCPREQ has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_up_handle_association_setup_request(node, xact, &message->pfcp_association_setup_request); break; case OGS_PFCP_ASSOCIATION_SETUP_RESPONSE_TYPE: - ogs_warn("PFCPRSP has already been associated"); + ogs_warn("PFCPRSP has already been associated %s:%d", + OGS_ADDR(&node->addr, buf), + OGS_PORT(&node->addr)); ogs_pfcp_up_handle_association_setup_response(node, xact, &message->pfcp_association_setup_response); break;
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
.