Commit graph

51 commits

Author SHA1 Message Date
Sukchan Lee
6a479ebae3 [mme] Follow-up #4693: harden DNS-based gateway selection
Some checks failed
Meson Continuous Integration / Build and Test on Ubuntu Latest (push) Has been cancelled
Follow up the DNS-based SGW/PGW selection introduced by #4693 and
harden several fallback, asynchronous completion, cache, resolver,
and compatibility paths found during review and testing.

A DNS failure must never prevent an attach when a statically
configured gateway remains available. Preserve the SGW serving the
UE when a DNS resolution is created and restore it whenever a later
DNS-based SGW selection cannot complete.

This is required because a previous Create Session Request attempt
may already have switched the UE to a DNS-discovered SGW. If that
request times out and the next DNS candidate cannot be resolved, simply
returning from apply_sgw() leaves the UE attached to the failed DNS SGW
and causes subsequent CSR attempts to continue using it instead of the
original fallback SGW.

Restore the pre-DNS SGW when:

* the SGW DNS leg ends in fallback after an earlier SGW switch
* mme_sgw_add() cannot create the selected SGW node
* ogs_gtp_connect() cannot connect the selected SGW
* the deferred Create Session Request cannot be built or committed

The fallback pointer records the SGW currently serving the UE when the
resolution is created rather than assuming it is always statically
configured. Successfully connected SGW nodes are retained for the
process lifetime, so the stored pointer remains valid.

The PGW path does not require the same state restoration. When PGW DNS
selection falls back, mme_dns_sess_pgw_addr() returns NULL and the S11
Create Session Request builder selects the statically configured PGW
again on each attempt.

Harden deferred CSR completion handling.

post_resolved() runs on the MME main thread, which is also responsible
for draining the application event queue. ogs_queue_push() can block
indefinitely when that queue is full, causing a self-deadlock because
the blocked producer is also the only consumer.

Use ogs_queue_trypush() instead. When it returns OGS_RETRY, return the
resolution to PENDING and restart its guard timer. The DNS legs are
already complete, so the guard callback simply attempts to post the
completed result again. Do not retry when the queue has been terminated
during shutdown.

Do not move a resolution to CONSUMED or increment csr_attempts until
the deferred CSR transaction has been successfully built and committed.
The GTP timeout retry path uses CONSUMED as its eligibility condition,
so marking an unsent request as consumed leaves meaningless retry state.

If local CSR creation fails, restore the pre-DNS SGW first and then
remove the resolution. This prevents a subsequent NAS retry from
capturing the failed DNS SGW as its new fallback and prevents a stale
CONSUMED resolution from incorrectly short-circuiting the new request
to SEND_NOW.

Document that OGS_OK from mme_gtp_send_create_session_request() may
mean that the request was deferred for DNS selection and does not
guarantee that a GTP transaction exists when the function returns.

Fix an MME event-loop hang caused by unusable SRV answers.

An SRV record whose target is "." indicates that the service is not
available. mme_dns_candidate_apply_srv() previously left the candidate
unchanged in this case. leg_advance() then repeatedly read the same
cached SRV answer without advancing the candidate cursor, hanging the
MME event loop.

Make mme_dns_candidate_apply_srv() return whether it found a usable
target. Skip the candidate when all SRV targets are empty or ".", while
leaving the candidate unchanged for callers that need to inspect the
failure.

Add unit and DNS integration coverage for this case. Extend the test DNS
server to encode "." as the DNS root label and verify that the MME skips
the unusable SRV candidate and falls back instead of hanging.

Bound the MME DNS cache to prevent expired entries from accumulating
indefinitely across many TAC and APN names.

When inserting a new key at capacity:

* remove expired entries
* if the cache remains full, evict entries closest to expiry
* do not make room when replacing an existing key, which would otherwise
  evict an unrelated entry on every refresh at capacity

Disable the c-ares internal query cache when the installed c-ares
version provides ARES_OPT_QUERY_CACHE. c-ares 1.31 and later enable an
internal cache by default, which can continue answering a query after
the MME's own cache entry has expired and silently override the
operator-configured dns.cache_ttl. Set qcache_max_ttl to zero so the
MME cache remains authoritative.

Retain compatibility with both older distribution versions of c-ares
and newer releases that deprecate the legacy query and reply parsing
APIs. Define CARES_NO_DEPRECATED before including ares.h to suppress
the newer deprecation attributes without raising the minimum supported
c-ares version.

Validate configured resolver addresses before initializing c-ares.

Require each dns.server address to be a bare IPv4 or IPv6 literal.
Reject hostnames, malformed addresses, bracketed addresses, scope
suffixes, and IPv6 link-local addresses, which require interface scope
handling that is not supported by the MME configuration.

Format resolver entries as:

* IPv4: address:port
* IPv6: [address]:port

The brackets are required by the c-ares server CSV format. Without
them, a value such as 2001:db8::53:53 is accepted as a different valid
IPv6 address using the default DNS port, causing queries to be sent
silently to the wrong resolver.

Build and validate the server CSV before c-ares initialization so
configuration failures do not require partially initialized channel or
library cleanup. The fixed CSV buffer remains safe because inet_pton()
guarantees that accepted addresses fit the maximum IPv4 or IPv6 literal
length.

Explicitly initialize mme_sess_t::dns_id to OGS_INVALID_POOL_ID instead
of relying on the current value of the pool allocator's zero-filled
memory.

Update the sample configuration and documentation to describe the
current DNS-selection limitations:

* roaming PGW lookup currently builds the APN-FQDN from the serving PLMN
  rather than deriving the home-PLMN APN-OI
* only A records are used for discovered gateways
* SRV weights are ignored
* non-terminal NAPTR records are not followed
* DNS-discovered SGW nodes are retained for the process lifetime
* resolver addresses must be bare IPv4 or IPv6 literals
* link-local IPv6 resolvers are not supported

Add the c-ares development dependency to Debian, Ubuntu, Fedora, Alpine,
CentOS, macOS, and FreeBSD build instructions and container images, and
add the c-ares MIT license notice.

Also link the DNS selection unit tests against libmme directly so they
exercise the same mme-dns-select implementation built for the MME.
2026-07-21 16:44:07 +09:00
Sukchan Lee
2c6c10650d debian: make MongoDB a recommended dependency
Some checks are pending
Meson Continuous Integration / Build and Test on Ubuntu Latest (push) Waiting to run
MongoDB is required by database-backed components such as HSS/PCRF
and PCF/UDR, but it does not need to be installed locally when an
external MongoDB server is used.

Move the MongoDB package relationship from Depends to Recommends for
the affected Debian packages, so the default installation still pulls
MongoDB in while allowing users to opt out with --no-install-recommends.

Update the documentation to clarify which components use MongoDB and
explain that the MongoDB installation step can be skipped when using an
external database.
2026-06-17 22:42:10 +09:00
Sukchan Lee
d9a3132400 Tested on FreeBSD-14.1-STABLE (#3350)
- Upgraded libraries to 4.5 to address compile error issues with CXX11 support
- Change the default version of FreeBSD Vagrant to 14.1-STABLE
- FreeBSD Platform documentation also changed to 14.x version
2024-08-03 21:45:52 +09:00
Sukchan Lee
e92293e0af
[SEPP] Initial Update for 5G Roaming (#2739)
[SEPP] Initial Update for 5G Roaming
2023-11-19 19:34:51 +09:00
Sukchan Lee
d3a10ed0ca [WebUI] Update NodeJS installation Guide 2023-09-03 20:03:47 +09:00
Jan Romann
cffd60b356 mac: fix mongodb config path for Apple Silicon 2023-07-07 22:02:23 +09:00
Sukchan Lee
ad86e8f49b [Docs] fixed CURL generates 16 ERROR
Refer to https://github.com/curl/curl/issues/3750
2023-05-28 17:12:56 +09:00
Sukchan Lee
982ac61894 Prometheus metrics set to default 2022-11-21 22:06:29 +09:00
Sukchan Lee
0859dd4453 Follow-up on #1865 2022-11-12 09:37:43 +09:00
Sukchan Lee
5ccb5f0f99 SCP(Model D) is now the default setting. 2022-10-22 11:26:04 +09:00
Sukchan Lee
3ad74923c1 Update document 2022-09-24 21:58:18 +09:00
Sukchan Lee
1c9a48bfb1 [Doc] Update CentOS Stream 8 (#1450) 2022-04-01 22:33:49 +09:00
Sukchan Lee
77f66e1f0e Migrating to CentOS Stream 8 in Vagrant (#1450) 2022-04-01 22:28:32 +09:00
Julian Lemmerich
f75e51ca46
changed default ipv6 prefix to 2001:db8:cafe:: (#1321)
to be compliant with RFC3849
2022-01-14 11:50:27 +09:00
Sukchan Lee
b6de06ee01 fix the test program bug 2022-01-04 17:27:28 +09:00
Sukchan Lee
49d9ed03c7 [MME] fix the crash (#1263)
- Change memory pool using talloc library
- Apply ASN1 with r16.7.0
2021-12-28 17:38:11 +09:00
Sukchan Lee
5d460b0577 [UPF] Tested all platforms on open5gs (#1022) 2021-05-29 23:08:22 +09:00
Sukchan Lee
8dab1852cc Merge branch 'tap' of https://github.com/anarkiwi/open5gs into pull1022 2021-05-29 18:06:43 +09:00
Sukchan Lee
fe89f7cd11 [5GC] Added BSF(Binding Support Function) 2021-05-29 15:56:12 +09:00
Josh Bailey
caa73e1f5e Support TAP interfaces, with ARP/ND. 2021-05-28 05:59:03 +00:00
Sukchan Lee
002e3c7ae9 [Alpine] Add Dockerfile and Document 2021-04-30 22:13:04 +09:00
Sukchan Lee
ebb48ede53 Freeze usrsctp version to 0.9.5.0 2021-03-21 20:06:24 +09:00
Sukchan Lee
37e0a714f9 Fixes UE IPv6 BUG (#808) 2021-03-15 10:01:55 +09:00
Sukchan Lee
569f98f92c webui: Follow-up on Pull Request #838
- Update document
- Fix the install script
- Remove last commit to maintain login session
2021-03-12 09:20:58 +09:00
Sukchan Lee
9af4268bab arch: DB schema Changes (#796)
- New function : NSSF
- New feature : SMF selection
2021-03-08 21:25:09 +09:00
Sukchan Lee
852756f902 test: Porting FreeBSD 2021-02-08 14:25:40 -05:00
Sukchan Lee
b19b3e9dd1 Add missing files 2021-02-06 00:15:25 -05:00
Sukchan Lee
7901a1164f mac: Support Apple M1 chips
See https://open5gs.org/open5gs/docs/platform/05-macosx-apple-silicon/
2021-02-06 00:13:48 -05:00
Sukchan Lee
198abc6e8b Add PCF(Policy Control Function) 2020-12-11 14:03:20 -05:00
Sukchan Lee
1c997c4069 Update docuemt for MacOSX 2020-11-28 22:38:46 -05:00
Sukchan Lee
3be76db08a Update document 2020-11-26 21:52:54 -05:00
Sukchan Lee
0742c6208c Add missing work after supporting HTTP/2 2020-11-26 21:47:53 -05:00
Sukchan Lee
2c2b6dfcaf Use HTTP/2 instead of HTTP/1.1 in 5G Core SBI 2020-11-26 21:44:37 -05:00
Sukchan Lee
19a3680c60 change the directory location for vagrant #684 2020-11-24 00:28:42 -05:00
Dan Gora
520d9cd2c3
Centos devel (#684)
* Remove invalid link in debian docker file.

Remove self-referential link from debian docker setup.

Fixes bug introduced in commit 8c4a50785

* Add Vagrantfile to create CentOS 8 system for deploying open5GS.

This Vagrantfile is identical to the base CentOS 8 box from Vagrant
Cloud, but was modified to increase the amount of virtual memory to
1GB from 512MB.

* Update installation instructions for CentOS 8.

Update the installation instructions for CentOS 8 to describe
step-by-step the commands necessary to install the necessary
prerequesites for building and running Open5GS, installing and building
the source code, and running the base tests to confirm that Open5GS
was built correctly.
2020-11-24 00:23:56 -05:00
Sukchan Lee
1f1a741e53 FreeBSD is no longer supported. 2020-11-12 14:35:05 -05:00
Sukchan Lee
b71e56c305 Fix errata [#536] 2020-09-01 00:46:39 -04:00
Sukchan Lee
18c483950c Change Number of UEs usage [#533]
- Set the number of UEs in units of AMF/MME instead of gNB/eNB.
- See default value as shown below
    Number of UEs per AMF/MME : 4,096
    Number of gNB/eNB per AMF/MME : 32
2020-08-25 23:05:01 -04:00
Sukchan Lee
db488bc4dd Update Document for v2.0.0 2020-08-22 12:44:11 -04:00
Sukchan Lee
1fd3f48860 Squashed commit of the following:
Fix the wrong format in nf-instance GET method
2020-05-18 23:07:41 -04:00
Sukchan Lee
d0673e3066 Added NRF 2020-05-18 17:00:37 -04:00
Sukchan Lee
88981a570d Update Document 2020-04-10 22:12:04 -04:00
Sukchan Lee
23251fa6e3 Update Document 2020-04-10 21:42:43 -04:00
Spencer Sevilla
24e9def813
change 45.45.0.1 -> 10.45.0.1 (#369) 2020-02-17 10:41:16 +09:00
Sukchan Lee
8749c2d666 For usrsctp, MacOSX needs options c_std=c99 2019-12-08 11:46:11 +09:00
Sukchan Lee
290cdfac42 Fix the document errata 2019-10-27 19:57:18 +09:00
Sukchan Lee
142763c280 Rename Project to Open5GS
- Change BuildTool to Meson
 - Many BUGS Fixed
2019-10-27 17:41:14 +09:00
Sukchan Lee
cb447af93a Fix MongoDB installation guide for MacOSX 2019-10-03 00:50:53 -07:00
Sukchan Lee
91b48cde7a Document Update 2019-08-25 20:50:01 +09:00
Sukchan Lee
a03df8d656 Document update for MacOSX 2019-06-01 19:53:57 +09:00