Commit Graph

63 Commits

Author SHA1 Message Date
Sukchan Lee
f21bc06054 Merge branch 'main' into home-routed 2025-07-12 08:13:15 +09:00
Sukchan Lee
345800ba94 [SMF] Improve robustness of PCO parsing and building by replacing fatal assertions with error handling (#3969)
Previously, malformed Protocol Configuration Options (PCO) data would trigger
ogs_assert failures in both the generic parser and SMF build routines,
causing the SMF process to abort unconditionally.

This commit replaces those fatal assertions with conditional checks:

In ogs_pco_parse(), switch from ogs_assert(size == data_len) to
ogs_expect(size == data_len), allowing the function to return gracefully.

In SMF's PCO build (smf_pco_build) and all downstream build paths
(including GN, GSM, S5C modules), replace ogs_assert(pco_len > 0)
with explicit if (pco_len <= 0) checks that:

Ensure that malformed or incomplete PCOs no longer crash the process,
but instead are handled cleanly so the network function can continue operating.
2025-07-09 21:28:08 +09:00
Sukchan Lee
d66d6f868a Merge branch 'main' into home-routed 2025-04-06 18:37:36 +09:00
Sukchan Lee
bf1cb6a024 [HSS/DBI] Follow-up on #3829 2025-04-05 18:26:32 +09:00
Farzaneh_sz
51acc388a6 get ifc data from db and insert in cx user data 2025-04-05 18:24:32 +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
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
70c888f4c9 Merge branch 'main' into home-routed 2024-11-07 17:52:48 +09:00
Sukchan Lee
421126682e [SMF] Change the Max Number of PCO from 16 to 32 2024-11-05 16:49:04 +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
cf4bbe83fc [HR] Control Plane between V-SMF/H-SMF (#2194)
Implement Control Message handling between V-SMF and H-SMF
during Home Routed Roaming process

Completed the implementation of control messages exchanged
between V-SMF and H-SMF as part of the Home Routed Roaming process
2024-10-10 17:30:20 +09:00
Jiaxun Yang
9d83eba550 [MME] Implement HSS Selection process
Implement HSS selection process as described in TS 29.272 Section 7.16.
Use hss_map config entry to map between plmn and HSS realm & host.

Closes: https://github.com/open5gs/open5gs/issues/3422
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
2024-08-29 16:39:45 +09:00
Daniel Willmann
28f9de4b41 ogs_fqdn_parse: Write the terminating NULL byte even if the APN is empty
Enter the while loop even if length == 1 (with len being 0) so that the
terminating NULL byte is written to dst.
2024-08-25 09:42:48 +09:00
Daniel Willmann
591f0a2fca ogs_fqdn_parse: Don't fail when parsing the empty APN
The osmocom ttcn3-mme-ogs test uses an APN consisting simply of the NULL
byte. This corresponds to one label of length zero, so simply the APN "".

Since commit 333d3fe1 ogs_fqdn_parse() returning zero is considered an
error in ogs_gtp1_parse_pdp_context().

Fix this by returning a negative value on error in ogs_fqdn_parse() and checking for
that.
2024-08-25 09:42:48 +09:00
Sukchan Lee
d7126f98ac [HR] Added LBO Roaming Allowed in WebUI (#2194)
According to TS29.503, we can choose whether or not to allow LBO roaming
on a per-session basis.

To this end, we have made changes to allow us to set this via the WebUI.
2024-08-05 16:47:47 +09:00
Sukchan Lee
3f23d332bf [TFT] Incrase the number of flows 8->16 (#3343)
TS24.008
10.5.6.12 Traffic Flow Template
Table 10.5.162: Traffic flow template information element

Number of packet filters (octet 3)
The number of packet filters contains the binary coding
for the number of packet filters in the packet filter list.
The number of packet filters field is encoded in bits 4
through 1 of octet 3 where bit 4 is the most significant
and bit 1 is the least significant bit.

For the "delete existing TFT" operation and
for the "no TFT operation", the number of packet filters shall be
coded as 0. For all other operations, the number of packet filters
shall be greater than 0 and less than or equal to 15.

The array of TLV messages is limited to 16.
So, Flow(PDI.SDF_Filter) in PDR is limited to 16.

Therefore, we defined the maximum number of flows as 16.
2024-07-25 23:36:03 +09:00
Sukchan Lee
455f164c60 Revert "[TFT] Incrase the number of flows 8->16 (#3339)"
This reverts commit 919176a9ab.
2024-07-25 23:33:32 +09:00
Sukchan Lee
919176a9ab [TFT] Incrase the number of flows 8->16 (#3339)
TS24.008
10.5.6.12 Traffic Flow Template
Table 10.5.162: Traffic flow template information element

Number of packet filters (octet 3)
The number of packet filters contains the binary coding
for the number of packet filters in the packet filter list.
The number of packet filters field is encoded in bits 4
through 1 of octet 3 where bit 4 is the most significant
and bit 1 is the least significant bit.

For the "delete existing TFT" operation and
for the "no TFT operation", the number of packet filters shall be
coded as 0. For all other operations, the number of packet filters
shall be greater than 0 and less than or equal to 15.

The array of TLV messages is limited to 16.
So, Flow(PDI.SDF_Filter) in PDR is limited to 16.

Therefore, we defined the maximum number of flows as 16.
2024-07-25 23:29:10 +09:00
Sukchan Lee
2a4d8db72e [MME] Prevent the Session stored in DB (#3220)
Fixed to not change the session information stored in the DB
when transferring context from GERAN to EUTRAN.

Note that the Tracking Area Update Procedure differs
from the Attach Procedure in 5.3.2 in the point
at which HSS and ULR/ULA are performed.

3GPP TS 23.401
Ch 5.3.3 Tracking Area Update procedures

<Attach Procedure>
1. Security-mode complete
2. Update Location Request/Answer
3. Create Session Request/Response

<Tracking Area Update Procedure>
1. Security-mode complete
2. Create Session Request/Response
3. Update Location Request/Answer

When TAU creates a Create Session Request message,
there is no session type information in the Subscriber DB
that is received from HSS in the Update Location.

Therefore, TAU does not reflect the Session Type
but creates PDN Type by reflecting the information
in the Request Type as it is.
2024-05-25 15:14:58 +09:00
Sukchan Lee
05deed616c [SEC] fix Assertion 0 < ogs_fadn_parse (#3207) 2024-05-18 21:37:28 +09:00
Sukchan Lee
4599b273fa [MME] Problem keep changing PDN-Type (#3209)
If the UE continuously attempts to Attach while changing PDN Type,
it will cause the wrong IP to be assigned.
(e.g PDU-Type : IPv4v6 -> IPv4 -> IPv4v6)

This is because we use two variables at the same time,
one to read and store the Static IP from the Subscriber DB and
one to store the IP assigned from SMF, called session->paa.

When the UE attaches with PDN-Type set to IPv4v6,
MME saves the allocated IP in session->paa.

However, MME thinks it has been assigned a static IP based on the information
in session->paa, so changing the PDN-Type may result in the wrong IP
being assigned.

To solve this problem, I separated the variable(session->paa) that stores
the allocated IP received from SMF and the variable(session->ue_ip) that stores
the Static IP read from the Subscriber DB.

Therefore, the information read from the Subscriber DB
(session->session_type and session->ue_ip) should not be modified.
2024-05-18 14:01:00 +09:00
Matej Gradišar
e1820e4e54 UE context transfer (#3052)
* [SBI] Handle and store AMF info

* [SBI] Add "target GUAMI" discovery option

* [SBI] Handle UeContextTransfer request and response messages

* [AMF] Handle NF discovery from AMF to AMF

* [AMF] Add UE Context Transfer Request/Response from AMF to AMF

* [SCP] Handle UeContextTransfer

* Follow-up on #3052

* [AMF] force authentication after 'Ue context transfer' for now

* [AMF] force authentication after 'Ue context transfer' for now

---------

Co-authored-by: Sukchan Lee <acetcom@gmail.com>
2024-03-21 07:07:25 +09:00
Pau Espin Pedrol
b31fc343d1 cosmetic: Document spec references for unassigned identity values 2024-03-08 21:51:36 +09:00
Sukchan Lee
41d8934677 [SMF] Added Bi-Directional Flow (#2909)
For bi-directions, the rules are created in the same form as for downlink
as shown below, so to apply them for uplink, we need to swap the rules
according to the interface.

RX : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT>
GX : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT>
PFCP : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT>
RULE : Source <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> Destination <UE_IP> <UE_PORT>
TFT : Local <UE_IP> <UE_PORT> REMOTE <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT>

RX : permit in from <UE_IP> <UE_PORT> to <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT>
GX : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT>
PFCP : permit out from <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT> to <UE_IP> <UE_PORT>
RULE : Source <UE_IP> <UE_PORT> Destination <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT>
TFT : Local <UE_IP> <UE_PORT> REMOTE <P-CSCF_RTP_IP> <P-CSCF_RTP_PORT>
2024-02-17 20:43:15 +01:00
Pau Espin Pedrol
7d60b13d3a lib/proto/conv: Introduce API ogs_ip_to_paa()
The counterpart API ogs_paa_to_ip() was already present, but this was
missing. It will be required in open5gs-mmed in a follow-up patch.
2024-01-06 07:44:14 +09:00
Pau Espin Pedrol
4ab275ad70 Rename and move ogs_gtp2_paa_to_ip() to lib/proto/conv
Both types are defined under lib/proto/type.h, and the conversion
function is used in several different protocols, so let's better move it
to generic lib/proto/conv.h and remove the "gtp2" prefix.
2024-01-06 07:44:14 +09:00
Pau Espin Pedrol
1f8f20da34 lib/proto/types.{c,h}: Constify several parameters 2024-01-03 07:10:09 +09:00
Pau Espin Pedrol
9349743295 lib/proto: Constify params of ogs_id_get_{type,value}() 2023-12-20 20:04:23 +09:00
Pau Espin Pedrol
8c01f3387d constify src param of ogs_fqdn_{build,parse}() 2023-12-13 23:02:50 +09:00
Pau Espin Pedrol
3b6b8ebf4f lib/proto/types.c: Fix trailing whitespace 2023-12-13 23:02:50 +09:00
Sukchan Lee
d0a1bedd22 [AMF] Increase the number of SLICE 512 to 1024 (#2761)(#2765) 2023-12-04 20:46:58 +09:00
Sukchan Lee
e42048e8a5 Reset the number of TA, SLICE, and PLMN supported by AMF/MME(#2761) (#2765)
* update it

* update it

* update it

* update it

* update it

* udpate it

* uupdate it
2023-12-03 23:52:29 +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
Pau Espin Pedrol
e108d6297c HSS: Add support for Operator-Determined-Barring field
* Add "subscriber_status" cmd to open5gs-dbctl to set values for
  "subscriber_status" and "operator_determined_barring" DB fields.
* Add webui View+Edit for those same fields.
* open5gs-hssd now takes those values into account and submits
  Operator-Determined-Barring AVP with DB-retrieved value if
subscriber_status is set to OPERATOR_DETERMINED_BARRING.

For more information, see TS 29.272 section 5.2.2.1.3  and 7.3.30.
2023-10-12 07:17:54 +09:00
Sukchan Lee
63df530bb4 [SBI] Fixed a bug with encoder/decoder of scpPorts
(#2310, #2274)
2023-05-14 07:05:23 +09:00
Sukchan Lee
01d3db4b6e [MME/SMF] Added Extended-PCO in 4G/LTE (#2261) 2023-04-22 00:06:50 +09:00
Sukchan Lee
d469809192 [AMF/MME] PLMN access control
These mechanisms are described in the GSMA roaming guidelines.
Chapters called Access Control.

For 4g: https://www.gsma.com/newsroom/wp-content/uploads//IR.88-v21.0.pdf
For 5g: https://www.gsma.com/newsroom/wp-content/uploads//NG.113-v6.0.pdf
2023-03-25 09:59:20 +09:00
Sukchan Lee
2944fa2549 [AMF/MME] for num_of_XXX variable (uint8_t -> int) 2023-03-19 18:31:45 +09:00
Sukchan Lee
ad9e5b28cf [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
mitmitmitm
11568bbff7 ogs_session_s.framed_routes type change to (char **)
OpenAPI_list_t wasn't optimal as it created a dependency on ogs-sbi.h.
2023-01-26 22:37:58 +09:00
Sukchan Lee
218b31d006 [CORE] Increase SDU buffer to 32k (#2008) 2023-01-24 21:43:20 +09:00
Sukchan Lee
43eb5f3d7f Fixed warning 2023-01-24 19:06:01 +09:00
Sukchan Lee
c6fd4ae6b8 [LOG] remove ogs_expect_or_return()/return_val() 2023-01-24 00:01:36 +09:00
mitmitmitm
f6439b998c [SMF] Handle framed routes, forward them to UPF and PCF 2023-01-23 09:26:26 +09:00
mitmitmitm
337a4e5159 [PFCP] Allow up to 8 framed routes for each IP type 2023-01-23 09:26:26 +09:00
Sukchan Lee
ff261681c0 [PROTO] Increase SDU buffer 8k->16k (#2008) 2023-01-21 12:58:43 +09:00
Sukchan Lee
5128ebc6c6 [SMF] Added User-ID, APP_DNN, S-NSSAI (#1986)
Added User-ID, APP_DNN, S-NSSAI in N4 PFCP Session Establishment Request
2023-01-13 10:28:40 +09:00
Sukchan Lee
79d46be086 Introduced Subscription identifier de-concealing
o Generate the private key as below.
   $ openssl genpkey -algorithm X25519 -out /etc/open5gs/hnet/curve25519-1.key
   $ openssl ecparam -name prime256v1 -genkey -conv_form compressed -out /etc/open5gs/hnet/secp256r1-2.key

 o The private and public keys can be viewed with the command.
   The public key is used when creating the SIM.
   $ openssl pkey -in /etc/open5gs/hnet/curve25519-1.key -text
   $ openssl ec -in /etc/open5gs/hnet/secp256r1-2.key -conv_form compressed -text

In ausf/udm.yaml

 hnet:
    o Home network public key identifier(PKI) value : 1
      Protection scheme identifier : ECIES scheme profile A
    - id: 1
      scheme: 1
      key: /etc/open5gs/hnet/curve25519-1.key

    o Home network public key identifier(PKI) value : 2
      Protection scheme identifier : ECIES scheme profile B
    - id: 2
      scheme: 2
      key: /etc/open5gs/hnet/secp256r1-2.key

    o Home network public key identifier(PKI) value : 3
      Protection scheme identifier : ECIES scheme profile A
    - id: 3
      scheme: 1
      key: /etc/open5gs/hnet/curve25519-1.key

    o Home network public key identifier(PKI) value : 4
      Protection scheme identifier : ECIES scheme profile B
    - id: 4
      scheme: 2
      key: /etc/open5gs/hnet/secp256r1-2.key

Related to #1779
2022-12-24 20:22:45 +09:00
Sukchan Lee
ec4acd4eca remove warning in MacOSX (#1797) 2022-10-25 21:14:53 +09:00