Commit Graph

464 Commits

Author SHA1 Message Date
Sukchan Lee
fd897f35a3 MME: handle EPS Bearer Context Status mismatch when active_flag=0 (#4112)
When the UE sends a Tracking Area Update (TAU) Request with active_flag=0,
the MME previously sent TAU Accept without verifying the EPS Bearer Context
Status (EBCS). This caused stale bearer sessions to remain in the MME even
if the UE had already released them.

According to 3GPP TS 24.301 §5.5.3.2, the MME should release any bearer
not reported in the UE’s EBCS when active_flag=0. This patch introduces
mme_send_delete_session_or_tau_accept(), which compares the UE’s EBCS bitmask
with the MME session list and deletes any missing default bearer session
before sending TAU Accept.

If no mismatch is found, TAU Accept is sent immediately. The Delete Session
response triggers TAU Accept when deletions are required. This ensures that
the TAU Accept message reflects the UE’s current bearer context accurately.

Also includes:
 - Added OGS_GTP_DELETE_SEND_TAU_ACCEPT handling in mme-s11-handler.c
 - Simplified EBCS structure (uint16_t value) for bitmask comparison
 - Updated TAU-related tests with realistic EBI bitmasks (0x20, 0x60)

This change aligns TAU handling with 3GPP 24.301 and prevents bearer
mismatch issues between UE and EPC during TAU.
2025-10-16 21:46:38 +09:00
Sukchan Lee
3978db2fa6 [AMF] Fix crash on malformed NGSetupRequest PLMNIdentity
When the NGSetupRequest contains an invalid GlobalRANNodeID or
BroadcastPLMNItem with a malformed PLMNIdentity, the AMF previously
performed memcpy() without checking the buffer size. This could lead
to invalid memory access and crash.

Fix by validating PLMNIdentity size against sizeof(ogs_plmn_id_t) and
sending NGSetupFailure with CauseProtocol_semantic_error if invalid.

Also add regression tests:
- Build malformed NGSetupRequest with incorrect PLMNIdentity size
- Verify AMF does not crash and returns NGSetupFailure

This resolves the crash reported in issue #4087.
2025-09-23 23:08:42 +09:00
Sukchan Lee
7b75746fe8 [HR] Support Xn/N2 handover for Home-Routed Roaming (Direct Forwarding only) (#2194)
This commit adds Xn and N2 handover procedures to the Home-Routed Roaming code.
Direct forwarding is now fully operational.

Indirect forwarding for N2 handovers is not yet supported.

To preserve the GTP-U header and extension header (even without QER)
along the source gNB -> V-UPF -> target gNB path, future work will create
PDRs without Outer Header Removal IE and FARs without Outer Header Creation IE
and implement the necessary UPF logic.
2025-07-14 22:03:32 +09:00
Sukchan Lee
94cf8ee0e0 [HR] Implement handling of UE-initiated PDU Session Modification (#2194)
This commit consolidates the entire ue-mod feature branch
into a single update on top of the latest home-routed code.
2025-06-30 10:07:06 +09:00
Sukchan Lee
932101b919 Merge branch 'main' into home-routed 2025-06-30 10:02:57 +09:00
Sukchan Lee
db0196cba7 [AMF] Skip unprovisioned sessions to prevent premature error indication (#3951)
In the previous implementation, the AMF would send a Partial-handover error
indication whenever it encountered a session not found in the subscriber DB,
even if valid sessions remained. This resulted in unexpected error responses
during NG handover.

To resolve this, we record the initial SMF transaction count before iterating
through the UE session list. Sessions without a valid SMF context now produce
a warning and are skipped, while continuing to send Handover Notify messages
for provisioned sessions. After processing, we compare the SMF transaction
count to the initial value. If no valid sessions were handled, we send a
Partial-handover error indication.

With this change, unprovisioned sessions no longer trigger a premature error
indication, allowing valid PDU sessions to complete NG handover successfully.
2025-06-27 15:22:08 +09:00
Sukchan Lee
f0005164a2 Merge branch 'main' into home-routed 2025-06-01 16:54:26 +09:00
Sukchan Lee
2daa44adab [SMF] Include N2 ACK for unchanged tunnel on repeated PathSwitchRequest (#3909)
Fix missing N2 signaling when tunnel information is unchanged,
causing AMF crash on repeated PathSwitchRequest

When a second PathSwitchRequest arrives without any tunnel changes,
the handler previously returned HTTP 204 No Content and omitted N2 information.

This led to a fatal assertion in the AMF SM context, since it expected
to receive updated N2 data even when the tunnel remained the same.

This patch modifies ngap_handle_path_switch_request_transfer to build
and send the N2 SM buffer in the “else” branch.

It calls ngap_build_path_switch_request_ack_transfer to construct
the Path Switch Request Acknowledge N2 message and then delivers it
with smf_sbi_send_sm_context_updated_data_n2smbuf.

A new test case is also added to verify that N2 signaling is correctly
transmitted when tunnel parameters have not changed.
2025-06-01 15:46:53 +09:00
Matej Gradišar
799103257b [AMF] Fix UE context transfer when only NRF is client (#3880)
* [AMF] Fix UE context transfer when only NRF is client

If UE context transfer is initiated and the new AMF does not get the
old AMF from NRF or no UE context is retrieved from the old AMF,
we do not want to reject UE registration. Send identity request instead.
Test "transfer-error-case" is added into the commit.

* [tests] Unite tests for UE context transfer

All tests for UE context transfer with different configs are placed
into test folder transfer.

* [tests] Make two binaries for UE context transfer tests

For each test config a different test binary is created.
2025-05-31 20:51:06 +09:00
Sukchan Lee
ae4d8433eb [HR] Implement Network-Initiated PDU Session Modification (Home-Routed Roaming) (#2194)
This commit adds support for processing network-initiated PDU Session
Modification in a home-routed roaming context, following section 4.3.3.3
of the specification.
2025-05-31 15:44:44 +09:00
Sukchan Lee
3e6b7e961d Merge branch 'main' into home-routed 2025-05-10 12:08:47 +09:00
Sukchan Lee
ca61a901d5 Implement PDU Session Release for Home-Routed Roaming and fix N4 step ordering in 4.3.4.2
- Add support for PDU Session Release in 3GPP TS 23.502 section 4.3.4.3
  Note: PCF-initiated release flow for Home-Routed Roaming is not implemented;
- Fix N4 release step ordering in 3GPP TS 23.502 section 4.3.4.2 UE or network requested PDU Session Release for Non-Roaming and Roaming with Local Breakout
2025-05-02 21:28:25 +09:00
Pallavi Das
cd80aa432e Typos Fix 2025-04-19 20:45:25 +09:00
Sukchan Lee
46f74c8019 Merge branch 'main' into home-routed 2025-04-06 18:36:57 +09:00
Bostjan Meglic
fa3edde329 [NAS] add support for 30-seconds unit for GPRS3 timer 2025-03-21 17:52:12 +09:00
Sukchan Lee
63d26667bc [AMF/MME] Fix UE context deletion vulnerability using memento restoration (#3754)
Renamed backup/restore security context functions to save/restore
memento and updated flag to "can_restore_context". Updated AMF and MME
state machines to restore context on failure, preventing malicious
deletion triggered by spoofed NAS messages.
2025-03-21 17:28:47 +09:00
Sukchan Lee
106a9accd4 [AMF/MME] Fix security context restoration and state transition cleanup (#3756)
- Backup sensitive security context fields (e.g. xres, kasme, rand, autn,
  keys, counters) when transitioning from REGISTERED state.
- Set the can_restore_security_context flag in common_register_state()
  based on whether the transition originates from a REGISTERED or
  de-registered state.
- In emm_state_authentication(), restore the security context and revert
  to the REGISTERED state on authentication failure only if restoration
  is allowed; otherwise, transition to an exception state.
- Remove the redundant unconditional state transition in the cleanup block
  to prevent overriding a valid restoration.
2025-03-16 11:57:14 +09:00
Sukchan Lee
70310979c5 [KSI] Update EPC KSI issuance to match 5G Core behavior
Previously, the EPC used the UE-provided KSI directly in the Authentication
Request (except for the special case where the UE sent
OGS_NAS_KSI_NO_KEY_IS_AVAILABLE, which was reset to 0).

This commit changes the EPC to follow the 5G Core approach
for issuing KSI in Attach-Request.

Now, when a Attach Request is received and a new Authentication Vector is
generated, the EPC performs the following steps:

- Extract the KSI value from the UE's request.
- Increment the extracted KSI by 1.
- Use the incremented KSI in the Authentication Request sent to the UE.

This detailed process ensures that the EPC issues the KSI consistently
with 5G Core standards, improving key management and interoperability.
2025-03-10 15:15:47 +09:00
Sukchan Lee
1abc3b6d5f [SMF] Separate EPC-only attach config to avoid NRF register timeout
Previously, sample.yaml was used for both 5GC and EPC attach tests.
Because SMF had SBI configured, it sent a register PUT to NRF even in
EPC-only tests (where nrf/scp was not run), leading to a missing HTTP
response and connection timer expiry.

Now, attach.yaml is used for EPC, preventing the unwanted NRF registration.
2025-03-10 09:53:00 +09:00
Sukchan Lee
8cae6112cc [SEC] Fix crash in eNBDirectInformationTransfer due to missing Inter_SystemInformationTransferType
This commit resolves an issue where the system would crash
when Inter_SystemInformationTransferType was not present.
2025-02-28 14:27:10 +09:00
Sukchan Lee
90afca821b Merge branch 'main' into home-routed 2025-02-09 11:15:55 +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
3f38d66790 Merge branch 'main' into home-routed 2025-01-19 17:11:20 +09:00
Bostjan Meglic
90cd67fcca [AMF,SMF] Prevent mapped HPLMN SST to always be set
In case that mapped HPLMN SST was not set by the UE in the request to
Establish PDU Session, AMF/SMF would assume it is set to 0 (since the
recent change to allow SST value 0).
2025-01-11 20:22:46 +09:00
Bostjan Meglic
c331207233 [all] allow value of 0 for S-NSSAI SST
3GPP TS 23.003: 28.4.2 Format of the S-NSSAI

The SST field may have standardized and non-standardized values. Values
0 to 127 belong to the standardized SST range and they are defined in
3GPP TS 23.501 [119]. Values 128 to 255 belong to the Operator-specific
range.
2025-01-11 20:22:46 +09:00
Sukchan Lee
b0bfd35c63 [SCTP] Support setting local address (#3344)
Added support for binding to local IP addresses in ogs_sctp_client and
ogs_sctp_server, and correct SGsAP configuration

Implemented the ability to bind to one or multiple local IP addresses using
`sctp_bindx()` in both the `ogs_sctp_client()` and `ogs_sctp_server()` APIs.

Users can now specify local addresses in the configuration files under the new
`local_addresses` field, reducing unnecessary complexity and signaling caused
by binding to `ANY_ADDR`.

This update addresses issue https://osmocom.org/issues/6509 by ensuring
correct operation in multi-interface and complex networking setups.

Additionally, corrected the `sgsap` configuration by changing it
from `server` to `client`, and added support for specifying `local_addresses`
for local binding as follows:

```
sgsap:
  client:
    - address: msc.open5gs.org # SCTP server address configured on the MSC/VL
      local_address: 127.0.0.2 # SCTP local IP addresses to be bound in the M
```
2024-12-23 21:16:15 +09:00
Sukchan Lee
b47bad8b84 [HR] Implement GTP-U processing for HR Roaming in User Plane (#2194)
- Added support for the N9 For Roaming interface type:
  - Core interface act as V-UPF.
  - Access interface act as H-UPF.

- Modified V-UPF behavior:
  - V-UPF updates only the TEID and IP Address in the GTP-U header.
  - The content following the Extension Header is passed through directly
    between the UE and H-UPF.

This implementation ensures seamless data flow between the UE, V-UPF, and H-UPF
while maintaining integrity for Home Routed Roaming scenarios.
2024-11-23 17:51:42 +09:00
Sukchan Lee
1fa8e5468e [AMF/MME] Fix handover failing due to GNB/eNBID hash table handling (#3569)
Resolved an issue where Handover was failing when attempting to handover
from GNB-ID/eNB-ID 1 to GNB-ID/eNB-ID 0.

The problem occurred because the hash table managing GNB_ID values would
remove any entry with the default GNB-ID/eNB-ID of 0 before re-adding entries.

Consequently, any GNB/eNB configured with a GNB-ID/eNB-ID of 0
would be inadvertently deleted whenever another GNB was added.

This fix modifies the handling of the hash table to prevent the default
GNB-ID/eNB-ID (0) from being removed unintentionally, allowing handovers
between GNB-ID/eNB-ID 0 and other GNBs/eNBs to proceed without error.
2024-11-14 16:26:49 +09:00
Sukchan Lee
70c888f4c9 Merge branch 'main' into home-routed 2024-11-07 17:52:48 +09:00
Sukchan Lee
ae2a3255a5 [CSFB] Fix Location Update for non-EPS (#3381)
While experimenting with CSFB, it was observed that when the UE returns
to E-UTRAN after a CS call, the UE performs a Tracking Area Update
with a combined Tracking Area/Location Area update and IMSI attach.
Currently, Open5GS's MME simply responds with a TAU Accept message
but does not inform the MSC/VLR.

As a result, no further MT (Mobile Terminated) CS/SMS services are possible
in cases where the MSC/VLR only attempts paging on GERAN.
However, some MSC/VLR implementations with fast fallback may still attempt
paging on E-UTRAN, allowing MT CS/SMS services to function intermittently.

According to 3GPP TS 29.118 Section 5.2.2 Procedures in the MME,
specifically Section 5.2.2.2.1, if the timer Ts6-1 is not running,
the MME shall start the location update for non-EPS services procedure
upon receiving a combined Tracking Area Update Request indicating
combined TA/LA updating with IMSI attach. However, SGs timers are not
implemented in Open5GS, which is a separate issue.

To comply with the specification and ensure that the MSC/VLR is informed
when the UE becomes reachable via SGs, the following changes have been
implemented:

1. Delay UEContextReleaseCommand:

When the active_flag is set to 0, the UEContextReleaseCommand is now delayed
until the MME receives the TAU Complete message from the UE. This ensures
that the UE has acknowledged the new P-TMSI before the network releases
the context, maintaining proper synchronization between the UE and the network.

2. Include Mobile Identity Only When P-TMSI Changes:

The Mobile Identity is now included in the Attach/TAU Accept messages
only when the MSC/VLR updates the P-TMSI. This ensures that the UE receives
the Mobile Identity information solely when there is an actual change
in the P-TMSI, preventing unnecessary or incorrect handling
of TAU Complete messages.

3. Send SGsAP-REALLOCATION-COMPLETE Conditionally:

The SGsAP-REALLOCATION-COMPLETE message is now sent to the MSC/VLR
only upon receiving a Attach/TAU Complete message from the UE.
This confirmation indicates that the UE has successfully updated its P-TMSI,
ensuring that the MSC/VLR is accurately informed of the change.

4. Handle P-TMSI Confirmation:

When the MSC/VLR updates the P-TMSI, Open5GS stores the new P-TMSI
in the next field of the mme_ue structure. Upon receiving the TAU Complete
message from the UE, indicating acknowledgment of the new P-TMSI,
Open5GS confirms the update by transferring the P-TMSI from the next field
to the current field. This ensures that the MME maintains an accurate and
up-to-date record of the P-TMSI as confirmed by the UE.
2024-11-05 16:37:45 +09:00
Sukchan Lee
bc02e48d1a [ePDG] Add Node-Identifier IE support in GTPv2 S2b Create-Session-Request for SMF Diameter S6b Routing (#3507)
Implement support for Node-Identifier IE in GTPv2 S2b Create-Session-Request
to SMF for Diameter S6b integration

This patch adds support for processing the Node-Identifier IE within GTPv2
Create-Session-Request messages sent via the S2b interface to the SMF.
When the ePDG includes the Node-Identifier IE containing both host and realm
of the AAA-Server, the SMF now uses this information to populate
the Destination-Realm and Destination-Host AVPs in the Diameter S6b AAR message.

This enables seamless integration and allows the SMF to route requests directly
to the appropriate AAA-Server, enhancing interoperability in setups
where the host and realm data are required by the Diameter network.
2024-10-31 22:22:25 +09:00
Sukchan Lee
a50c313b81 [SMF] Update QoS Rule Handling (#3513)
1. Set packet filter identifier values to 0 when the UE requests to:
  - Create new QoS rule
  - Modify existing QoS rule and replace all packet filters
  - Modify existing QoS rule and add packet filters - As specified in TS24.501, section 9.11.4.13, Table 9.11.4.13.1.

2. Revise QoS rule modification logic:
  - Instead of replacing packet filters based on their identifiers (EPC approach), update the implementation to delete all existing packet filters within the QoS rule and add new ones.
  - This ensures that when modifying an existing QoS rule to replace all packet filters, the packet filters are correctly reset and updated per 5G Core requirements.
2024-10-17 15:55:34 +09:00
Sukchan Lee
5dc3905c39 [SMF] Fix Packet Filter Identifier handling and limit maximum number (#3505)
- **Correct Packet Filter Identifier Handling:**
  Remove the addition of +1 when searching for the packet filter context using `smf_pf_find_by_identifier()` in the 5G Core SMF. According to 3GPP TS24.008 Section 10.5.6.12 and TS24.501 Section 9.11.4.13, the Packet Filter Identifier should range from 1 to 15 (or 0 to 15) depending on the operation and should be used directly as received from the UE.

- **Adjust Maximum Number of Packet Filter Identifiers:**
  Change the maximum number of Packet Filter Identifiers from **16** to **15** in the SMF to comply with the 3GPP specifications. The standards specify that the number of packet filters shall be greater than 0 and less than or equal to 15 for certain operations.

**Background:**

In the current 5GC implementation, the SMF incorrectly adds +1 to the identifier received from the UE and allows up to 16 identifiers, leading to mismatches and potential communication issues. These discrepancies cause the SMF to fail in correctly locating the packet filter context, resulting in improper QoS rule enforcement.

**Changes Made:**

- **For Packet Filter Identifier Handling:**
  - Updated the SMF code to use the identifier received from the UE directly without modification:
    ```c
    // Corrected code for 5GC:
    pf = smf_pf_find_by_identifier(
            qos_flow, qos_rule[i].pf[j].identifier);
    ```

- **For Maximum Number of Packet Filter Identifiers:**
  - Adjusted the code to enforce a maximum of 15 packet filters as per the specifications.

**Impact:**

- **Compliance:**
  - Ensures that the 5GC implementation of Open5GS adheres to the 3GPP TS24.008 and TS24.501 specifications regarding Packet Filter Identifier handling and limits.

- **Functionality:**
  - Corrects the mapping and management of packet filters between the UE and SMF in 5GC, preventing potential communication issues and misconfigurations.

- **EPC Implementation:**
  - The EPC implementation remains unaffected by these changes. EPC correctly handles the Packet Filter Identifier by decrementing it by 1 before sending it to the UE and adding +1 when searching for the packet filter context.

**Conclusion:**

By making these adjustments, we ensure proper synchronization between the UE and SMF in the 5G Core and maintain compliance with the 3GPP specifications. This fix resolves the mismatches caused by incorrect identifier handling and enforces the correct limit on the number of packet filters, enhancing the reliability and standards compliance of the 5GC implementation without impacting the existing correct behavior in EPC.
2024-10-16 17:24:55 +09:00
Sukchan Lee
063fa42a28 Revert "[SMF] Fix Packet Filter Identifier handling in SMF (#3505)"
This reverts commit f82fc85cc2.
2024-10-16 09:32:16 +09:00
Sukchan Lee
f82fc85cc2 [SMF] Fix Packet Filter Identifier handling in SMF (#3505)
Decrement the Packet Filter Identifier by 1 before sending it to the UE
during GSM message construction. This correction ensures proper synchronization
between the UE and SMF, allowing `smf_pf_find_by_identifier()` to accurately
locate the corresponding `pf` context without adjusting the identifier
during the search.

This fix aligns the 5GC implementation with the EPC behavior,
where the identifier was correctly decremented before transmission to the UE,
preventing mismatches and synchronization issues.
2024-10-15 17:57:11 +09:00
Sukchan Lee
6834bdf819 [HR] SMF selection (#2194)
SMF selection according to 4.3.2.2.3 of TS23.502.

V-SMF makes discovery in the V-NRF according to V-NSSF.

H-SMF makes discovery in the H-NRF according to H-NSSF.
(The AMF goes through the V-NSSF and forwards the message seeking the NRF to the H-NSSF.)
2024-09-16 08:55:52 +09:00
Pau Espin Pedrol
b5d1e8ac61 diameter: split stats and logger modules
Those 2 modules actually share nothing in common, so they can be totally
separated, making it easy to improve diameter stats in follo-up patches.
2024-09-03 22:20:19 +09:00
Matej Gradisar
dab131d375 [AMF] Add UE context transfer and Registration status update states 2024-09-03 22:09:56 +09:00
Matej Gradisar
1a344aeb65 [Tests] Delete unnecessary code 2024-09-03 22:09:56 +09:00
Matej Gradisar
8c293bc710 [AMF] Registation status update and tests 2024-09-03 22:09:56 +09:00
Bostjan Meglic
5cf92c9851 [tests] Upgrade tests for multiple NFs
The test scenario can now deploy multiple AMFs and other NFs.
2024-09-03 22:09:56 +09:00
Sukchan Lee
b35dee9327 [NRF] Fix the subscription valdityTime (#3360 #3361 #3363 #3364)
NF should accept 204 No Content for Update Subscription requests.
According to 3GPP 29.510 NRF specification document in figure 5.2.2.5.6.1
NRF may return 204 or 200 for success update operations.

2a. On success, if the NRF accepts the extension of the lifetime
of the subscription, and it accepts the requested value for the "validityTime"
attribute, a response with status code "204 No Content" shall be returned.

2b. On success, if the NRF accepts the extension of the lifetime
of the subscription, but it assigns a validity time different than
the value suggested by the NF Service Consumer, a "200 OK" response code shall
be returned. The response shall contain the new resource representation
of the "subscription" resource, which includes the new validity time,
as determined by the NRF, after which the subscription becomes invalid.

I changed it so that all NFs can receive both 200 and 204 STATUS.
I also changed the default behavior of NRFs to respond with 204,
which is NO CONTEXT.
2024-08-04 13:32:53 +09:00
Sukchan Lee
c5025ec64c [MEM] valgrind memcheck findings (#3349)
The proposal out of the valgrind memcheck procedure are
a couple of small patches to open5gs within the patches subdirectory.
2024-08-02 17:30:21 +09:00
Sukchan Lee
9828509668 [DIAM] Added sanity routine to avoid crash 2024-07-25 23:55:53 +09:00
Sukchan Lee
8d2d037314 [DIAM] Fix the crash when terminating Diameter
When exiting a diameter interface, the session state data could be NULL.
So we added code to check the session state data
to prevent SIGSEGV occurring.
2024-07-20 10:16:28 +09:00
Sukchan Lee
253de8ee25 [POOL] refactor memory pool in AMF (#3196)
Removed ogs_pool_cycle() from AMF memory pool
and changed it to find by hash id.
2024-06-30 22:03:13 +09:00
Sukchan Lee
6cb518539b [POOL] refactor memory in HTTP server (#3196)
Removed ogs_pool_cycle() from HTTP2 session and stream context
and changed it to find by hash id.
2024-06-30 22:03:13 +09:00
Sukchan Lee
40e146d45a [POOL] change cycle to hash id in xact (#3196)
I created ogs_sbi_xact_find_by_id() with a hash
to replace ogs_sbi_xact_cycle().

Modified to find the xact via xact->id
when making an HTTP request with the SBI client function
and waiting for the HTTP response.
2024-06-30 22:03:13 +09:00
Sukchan Lee
b26f1f310f [POOL] Added hash id to pool (#3196)
Pool library has the following issues with XXX_cycle,
including mme_enb_cycle()/amf_ue_cycle()

```
INIT POOL(SIZE:5)

Alloc Node1
Alloc Node2
Alloc Node3
Alloc Node4
Alloc Node5

Free Node4
Free Node3

PoolCycle(Node4) is NULL (Freed...OK!)
PoolCycle(Node3) is NULL (Freed...OK!)

Alloc Node6
Alloc Node7

PoolCycle(Node4) is Not NULL (Freed...but NOK!)
PoolCycle(Node3) is Not NULL (Freed...but NOK!)
PoolCycle(Node6) is Not NULL (Allocated...OK!)
PoolCycle(Node7) is Not NULL (Allocated...OK!)
```

If we use ogs_poll_alloc() to create and allocate a node,
the correct behavior of calling ogs_pool_free() on this node
and then later calling ogs_pool_cycle() on this node must always return NULL.

However, the behavior of calling ogs_pool_cycle() on this node
in the future may return a “valid” pointer.

To solve the problem, we added hash id to the pool memory and
ogs_pool_find_by_id() function is added.
2024-06-30 22:03:13 +09:00
Sukchan Lee
53a63e1b40 [MME/GTP] Managing multiple GTP xact (#3240)
Consider the following situation.
```
1. SMF->SGW-C->MME: First Update Bearer Request
2. MME->UE:         First Modify EPS bearer context request
3. SMF->SGW-C->MME: Second Update Bearer Request
4. MME->UE:         Second Modify EPS bearer context request
5. UE->MME:         First Modify EPS bearer context accept
6. MME->SGW-C->SMF: First Update Bearer Response
7. UE->MME:         Second Modify EPS bearer context accept
8. MME->SGW-C->SMF: Second Update Bearer Response
```

Until now, only one GTP transaction was managed for one bearer.

Therefore, if the UE does not send an EPS Modify bearer accept to the MME,
and the SMF/SGW-C sends an Update Bearer Request to the MME,
The NEW update bearer request overwrites the OLD that was previously managed.
So we modified it to manage them simultaneously.

However, we don't know if this is the right way to implement it.

So if the SMF/SGW-C sends 5 MMEs of Update Bearer Request and
the UE sends only 3 MMEs of Modify EPS bearer context accept,
we have no way to associate it.

Therefore, it's implemented so that we just process them sequentially and
2 of them are just timeout.
2024-05-31 22:36:41 +09:00