Commit graph

262 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
Paul Mataruso
e661610578 docs: update hardware list and community documentation
- Add Sercom SCE5164 to the tested hardware list
- Add a community tutorial for SEPP-based 5G roaming using
  Open5GS, Docker, and PacketRusher
2026-06-29 09:13:39 +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
21ef6bd350 merge main branch 2026-06-10 09:07:45 +09:00
patrickmcgraw
2fc6516e3c Add Baicells Aurora 243 to hardware list
Have run on the Aurora 243 using Open5gs for 5G SA core services for a few weeks now.
2026-02-01 06:54:46 +09:00
Sukchan Lee
642f827f0c Follow-up on #4213 2025-12-23 15:09:13 +09:00
Jasmine Fan
8ab551ede8
fix typo and wrong addresses in tutorial (#4213) 2025-12-23 14:58:51 +09:00
José Manuel
66f7b466c4
[AMF] API to add or remove PLMNs Dynamically (#4186)
* AMF dynamic PLMNs via APIREST

* add new feature now we can register ues when plmn is deleted

* add documentation for use the API AMF-OAM

* update tutorial 08

* fix memory not freed

fix memory not freed

fix memory not freed

* improve releases ues of plmn
2025-12-03 21:32:59 +09:00
Sukchan Lee
39618c7a67 docs: Update expired OBS signing key URL in quickstart guide
The previous key downloaded from `download.opensuse.org` was expired
(EXPKEYSIG FE7F42F276CEE0E6), causing `apt update` to fail when following
the Debian quickstart instructions.

This patch replaces the deprecated key URLs with valid signing key
download locations from build.opensuse.org and obs.osmocom.org.

Issues: #4175
2025-11-30 22:06:04 +09:00
Sukchan Lee
a55dabf63c [DOCS] Follow-up on #4100 2025-10-02 21:07:26 +09:00
Juraj Elias
b9496b0c4d
Doc info api (#4100)
* Create 07-infoAPI-UE-gNB-session-data.md

draft of JSON info API doc

* Update docs.md

link to JSON info API doc
2025-10-02 06:12:20 +09:00
hug0lin
fc42f3039c
Open5GS connected UEs, APN/DNN, IP addresses (#4044)
Added additional fields: snssai, qos flow, pdu, and UE state. For 5G (for LTE, the pdu state is currently unknown).

curl -s http://127.0.0.4:9090/connected-ues |jq .
 {
    "supi": "imsi-999700000083810",                 // 5G RAT
    "pdu": [
      {
        "psi": 1,
        "dnn": "internet",
        "ipv4": "10.45.0.2",
        "snssai": {
          "sst": 1,
          "sd": "ffffff"
        },
        "qos_flows": [
          {
            "qfi": 1,
            "5qi": 9
          }
        ],
        "pdu_state": "inactive"
      }
    ],
    "ue_activity": "idle"
  },
{
    "supi": "001010000056492",            // LTE RAT
    "pdu": [
      {
        "ebi": 5,
        "apn": "internet",
        "ipv4": "10.45.0.3",
        "qos_flows": [
          {
            "ebi": 5,
            "qci": 9
          }
        ],
        "pdu_state": "unknown"
      }
    ],
    "ue_activity": "unknown"
  },

Added other outputs related to the connected gNBs/eNBs to AMF and MME, so we should have the basic tools for the 4G/5G core operation.

curl -s http://127.0.0.4:9090/connected-ues |jq .
curl -s http://127.0.0.5:9090/connected-gnbs | jq .
curl -s http://127.0.0.2:9090/connected-enb |jq .

curl -s http://127.0.0.5:9090/connected-gnbs |jq .
[
  {
    "gnb_id": 100,
    "plmn": "99970",
    "network": {
      "amf_name": "efire-amf0",
      "ngap_port": 38412
    },
    "ng": {
      "setup_success": true,
      "sctp": {
        "peer": "[192.168.168.100]:60110",
        "max_out_streams": 2,
        "next_ostream_id": 1
      }
    },
    "supported_ta_list": [
      {
        "tac": "000001",
        "bplmns": [
          {
            "plmn": "99970",
            "snssai": [
              {
                "sst": 1,
                "sd": "ffffff"
              }
            ]
          },
          {
            "plmn": "99971",
            "snssai": [
              {
                "sst": 2,
                "sd": "000000"
              }
            ]
          }
        ]
      },
      {
        "tac": "000051",
        "bplmns": [
          {
            "plmn": "00101",
            "snssai": [
              {
                "sst": 2,
                "sd": "123456"
              }
            ]
          }
        ]
      },
    ],
    "num_connected_ues": 0
  }
]

curl -s http://127.0.0.2:9090/connected-enbs |jq .
[
  {
    "enb_id": 264040,
    "plmn": "99970",
    "network": {
      "mme_name": "efire-mme0"
    },
    "s1": {
      "setup_success": true,
      "sctp": {
        "peer": "[192.168.168.254]:36412",
        "max_out_streams": 10,
        "next_ostream_id": 1
      }
    },
    "supported_ta_list": [
      {
        "tac": "000001",
        "plmn": "99970"
      }
    ],
    "num_connected_ues": 1
  }
]

curl -s http://127.0.0.4:9090/connected-ues |jq .
[
  {
    "supi": "imsi-999700000083810",
    "pdu": [
      {
        "psi": 1,
        "dnn": "internet",
        "ipv4": "10.45.0.2",
        "snssai": {
          "sst": 1,
          "sd": "ffffff"
        },
        "qos_flows": [
          {
            "qfi": 1,
            "5qi": 9
          }
        ],
        "pdu_state": "inactive"
      }
    ],
    "ue_activity": "idle"
  },
  {
    "supi": "imsi-999700000021635",
    "pdu": [
      {
        "psi": 1,
        "dnn": "ims",
        "ipv4": "10.45.0.124",
        "ipv6": "2001:db8:cafe:79::7a",
        "snssai": {
          "sst": 1,
          "sd": "ffffff"
        },
        "qos_flows": [
          {
            "qfi": 1,
            "5qi": 5
          }
        ],
        "pdu_state": "active"
      }
    ],
    "ue_activity": "active"
  }
]
2025-09-13 10:02:01 +09:00
hug0lin
da27d6eab9 Update 01-genodebs.md 2025-08-19 16:07:20 +09:00
Sukchan Lee
ad80da3060 Merge branch 'r2.7.6' 2025-07-28 22:51:13 +09:00
Sukchan Lee
38ab9de5c4 [DOC] Open5GS works with eNBs 2025-07-28 22:50:20 +09:00
Sukchan Lee
c917760a47 [HR] Update documentation to include Home Routed Roaming feature (#2194)
This update adds a comprehensive description of the Home Routed Roaming
functionality, enhances the architecture section and message
flow diagrams to illustrate the new routing process, and provides
clear configuration examples and command‑line snippets to assist
users with setup.
2025-07-19 08:00:48 +09:00
ethonshield
7b40d5a3f1 Add tutorial doc on how to configure Open5GS with 5G-Sharp-Orchestrator 2025-04-29 22:46:14 +09:00
Pallavi Das
cd80aa432e Typos Fix 2025-04-19 20:45:25 +09:00
Sukchan Lee
e16a8fc42e Release v2.7.3 2025-03-23 11:56:01 +09:00
Sukchan Lee
6c67863971 [SEC] Fix crash when max_num_of_ostreams < 2 2025-02-28 16:44:17 +09:00
Sukchan Lee
07cb42110e [DBI] Improve YAML policy config by adding SUPI range filtering
Previously, policies were configured via YAML files without MongoDB.
This update enhances the YAML approach by adding the 'supi_range' key to
filter policies based on UE SUPI ranges. When both 'supi_range' and
'plmn_id' are provided, both conditions must be met.

Note that PLMN-ID filtering will be deprecated in a future release.
2025-02-05 21:56:15 +09:00
Sukchan Lee
81f69b436c [DOCS] Update installation guide (#3681)
to conditionally install `libidn-dev` or `libidn11-dev`,
depending on availability, and clarify common dependencies for Debian/Ubuntu.
2025-01-22 17:53:36 +09:00
Sukchan Lee
df11b05a1e Replaced deprecated libidn11-dev with libidn-dev across the project.
This update improves compatibility with newer distributions by modifying
dependency declarations in control files, Dockerfiles, and documentation.
2025-01-19 12:21:51 +09:00
nick
1c2098bf71 fix indentation issue in srsenb.yaml and rename srslte.yaml to srsenb.yaml in guide02 docs 2024-11-19 08:43:16 +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
a9b1b116b3 [SBI] Generate URI via HTTP.location as is (#3058)
A friend in the community was trying to connect an SMF made by another
manufacturer with an SBI interface and found a big problem with Open5GS.

All of the code in the part that generates the Resource URI
from HTTP.location is invalid.

For example, suppose we create a Resource URI with SMContext as below.
{apiRoot}/nsmf-pdusession/<apiVersion>/sm-contexts/{smContextRef}

In this case, Open5GS extracted the {smContextRef} part of the HTTP.location
and appended it to the beginning
{apiRoot}/nsmf-pdusession/<apiVersion>/sm-contexts/.

This implementation may not work properly if the apiRoot changes.
Consider a different port number as shown below.

<HTTP.location>
127.0.0.4:9999/nsmf-pdusession/v1/sm-contexts/1

The SMF may send an apiRoot to the AMF with a changed port number,
in which case the AMF must honor it.

Therefore, instead of extracting only the smContextRef from HTTP.location,
we modified it to use the whole thing to create a Resource URI.

We modified all NFs that use HTTP.location in the same way, not just SMFs.
2024-04-18 21:24:07 +09:00
Oliver Smith
4ab22dc98e docs: quickstart: add configure logging section
Add a section that explains how to fix duplicate timestamps in
journalctl.
2024-04-18 21:08:35 +09:00
Oliver Smith
8abd35580b configs, docs: adjust to logger config change 2024-04-18 21:08:35 +09:00
Sukchan Lee
8484a5af60 [GTP] Incorrect destination TEID=0 (#3043)
If eg. PCRF or AAA diameter link is not yet ready (eg. PCRF crashed),
and a client sends a CreateSessionRequest announcing its ow F-TEID,
then open5gs-smfd answers with Create Session Response Cause=
"Remote peer not responding", but it is not setting the received F-TEID
in the header of the response, instead it sends with TEI=0.

As a result, the peer cannot match the CreateSessionResponse,
and needs to rely on its own timeout timer to figure out
that specific request failed.

To address this issue, I modified the GTP Response message to check
the Sender F-TEID and send it accordingly, setting the destination TEID
to the value of the Sender F-TEID.

I've made this modification only for SMF, but MME and SGW-C have not done so;
if you need to, you can work from the examples in SMF.

Similarly, the same situation can happen with PFCP. If anyone needs to do this
in the future, I think you can work on it this way.
2024-04-06 16:39:32 +09:00
Sukchan Lee
390a9dd637 [MME] incorrect behavior of the SGsAP
1. According to ETSI TS 129 118 4.1, if the Network Access Mode (NAM) is set
   to "Packet only," no SGs association should be established.

2. If the NAM is set to "Packet and Circuit," and the SGs association is
   rejected by the CS core, this rejection should only impact
   the SGs association itself and not result in a UE attach rejection
   for a UE with a valid HSS account.
2024-03-24 20:31:56 +09:00
Sukchan Lee
152b4400f8 Fixed docs for changing WebUI port 3000 => 9999 2024-03-02 16:57:45 +09:00
Sukchan Lee
843c4950ac [ASN1C] Fixed asn1c library on 32bit (#2934)
APER encoding fails when using the asn_uint642INTEGER function on a 32-bit machine as shown below.

```C
   asn_uint642INTEGER(AMF_UE_NGAP_ID, 0xffffffff);
   ...
   aper_encode_to_buffer(...)
```

INTEGER APER encode/decode functions seem to be operating internally with long variables instead of intmax_t.
That is probably the reason of the failure.

@v0-e fixed this issues in the mouse07410/asn1c pull request.
https://github.com/mouse07410/asn1c/pull/176
https://github.com/mouse07410/asn1c/pull/177
2024-02-12 14:00:06 +09:00
Sukchan Lee
97e1b1bd30 [PFCP] Fixed incorrect TLV names (#2887)
Fixed standards documentation that described incorrect TLV names.
2024-01-19 23:40:20 +09:00
herlesupreeth
48323bd299 Update VoLTE tutorials 2024-01-10 21:49:48 +09:00
Sergey Yarin
0b93bd2ca9 Update 01-genodebs.md
Add a Nokia pico BTS to the list of tested hardware
2023-12-29 17:55:18 +09:00
Sukchan Lee
5d26416cd5 [DOCS] 5G Roaming with Mutual TLS by @infinitydon 2023-12-28 06:58:03 +09:00
Sukchan Lee
177e561ba8
[WebUI] Fix launch problem in docker (#2767) (#2769) 2023-12-04 22:16:10 +09:00
joereith
a4f8baa1f0
Update 03-VoLTE-dockerized.md (#2763)
* Update 03-VoLTE-dockerized.md

adding "-" in docker-compose commands and added filename t the docker-compose command

* Adding up command to docker-compose

Need to bring docker images up to run the Open5Gs system.
2023-11-30 06:41:46 +09:00
Sukchan Lee
2d8ea152df Update feature list 2023-11-20 21:56:27 +09:00
Sukchan Lee
d2f2fa0402 Update document 2023-11-19 19:50:28 +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
46333a22b5 [DOCS] Update roaming 2023-10-02 19:06:49 +09:00
Sukchan Lee
f6c4eb29e2 [Docs] Update roaming document 2023-10-02 18:51:54 +09:00
Sukchan Lee
d3a10ed0ca [WebUI] Update NodeJS installation Guide 2023-09-03 20:03:47 +09:00
Sukchan Lee
e01f46eb6c
Use x1000 multiplier for Kbps, Mbps, ... etc. (#2515)
NAS, GTP, PFCP, SBI, all except S1AP/NGAP use x1000 multiplier for Kbps, Mbps, Gbps ... etc.

From now on in WebUI all units also use a multiplier of x1000.
2023-08-13 18:19:45 +09:00
Sukchan Lee
03c0043e51 Update Roaming Document 2023-08-07 16:12:07 +09:00
Sukchan Lee
0da3d08297 Update document 2023-08-06 23:49:57 +09:00
Sukchan Lee
4ba815a04b Added Roaming Document 2023-08-06 23:38:16 +09:00
bem4444
528fc5d5ba
Update VoLTE Dockerized Tutorial (#2484) 2023-08-03 06:24:35 +09:00
Jan Romann
cffd60b356 mac: fix mongodb config path for Apple Silicon 2023-07-07 22:02:23 +09:00