Commit Graph

137 Commits

Author SHA1 Message Date
Pau Espin 74fcd9b9c6 cosmetic: upf: Add missing lines between functions 2024-04-04 23:23:32 +09:00
Sukchan Lee 581d255c53 Revert "[GTP/PFCP]] incorrect dst TEI=0/SEID=0 (#3043)"
This reverts commit a667525041.
2024-03-26 08:04:26 +09:00
Sukchan Lee cf4ad1f248 [PFCP] Session removal while waiting PFCP reply (#3040)
'node_timeout' and some other functions can remove a smf_sess_t
while that session is still waiting for a PFCP reply
and has an active PFCP xact.

In this case, xact->data points to the deleted session
and xact's timeout function (sess_5gc_timeout for example)
eventually refers to this already freed session.

This fix prevents duplicate deletes from occurring by checking to see
if the session context has already been deleted when the timeout occurs.

Additionally, it moves session deletions out of timer callbacks into
state machine by reselect_upf().

Due to the way 'ogs_timer_mgr_expire' calls timer callbacks,
one must not stop or expire timers from within a timer callback.

And now one must not remove sessions from within a timer callback.
2024-03-24 09:50:23 +09:00
Sukchan Lee a667525041 [GTP/PFCP]] incorrect dst TEI=0/SEID=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.

This also happens in PFCP, so to solve this problem, I added teid/seid_presence
to the interface that sends the error message as shown below.

void ogs_gtp2_send_error_message(ogs_gtp_xact_t *xact,
        int teid_presence, uint32_t teid, uint8_t type, uint8_t cause_value);
void ogs_pfcp_send_error_message(
    ogs_pfcp_xact_t *xact, int seid_presence, uint64_t seid, uint8_t type,
    uint8_t cause_value, uint16_t offending_ie_value);
2024-03-23 10:06:16 +09:00
Sukchan Lee 82398811db [UPF] Report after Session was Deleted (#2936)
The UPF is sending Session Report Request after the Session was Deleted,
when the Gy interface is active.

UPF is sending PFCP session report request after the session has been deleted
when the Gy interface is active. This is because some of the timers related to
the report are not deleted when the session is deleted.

We have fixed it to delete all the timers in the session
when the SESSION is deleted.
2024-02-04 09:32:33 +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
Šimon Lukašík 490a3ecb99
A minor typo fix (#2707)
* minor typo fix

* typo fix: faimly -> family
2023-10-28 22:11:58 +09:00
Sukchan Lee 05ed95d623 [GTPU] Fixed PDCP SN handling (#2584, #2477)
Scenario is handover on S1AP, data forwarding is enabled, and
the Source ENB is forwarding DL PDCP packets to EPC(SGWU)
with PDCP SN included. SGWU is also forwarding these packets
to the Target ENB.

However the PDCP SN is not present in the forwarded packets
from SGWU to Target ENB.

I modified this part, and there was the same problem in 5GC, fixed it as well.

A lot of code in GTP-U has been modified,
so if you have any problems, please let us know right away.
2023-09-10 22:37:42 +09:00
Sukchan Lee 4b0bade80e [TLV] PFCP parser crash from FuzzingLabs (#2523) 2023-08-18 22:19:46 +09:00
gstaa f22fbb45da
[UPF] Fix wrong number of QoS flows metric (#2490) 2023-08-08 22:32:06 +09:00
Robert Dash 04d402dee6 fix tap mode arp table poisoning 2023-07-22 06:41:44 +09:00
Sukchan Lee 178d1ff986 Fixed build failure in osmocom/open5gs 2023-07-18 23:20:43 +09:00
Robert Dash 26141ee2b5 fix boot-looping of UPF with interface in TAP mode 2023-07-01 23:48:46 +09:00
mitmitmitm 928a80ef26 [PFCP] Support PFCP advertise address in F-SEID 2023-05-25 22:46:52 +09:00
Sukchan Lee e567a01ae8 [SGWU/UPF] Fixed crashed by gTPTunnel (#2313)
SGWU/UPF crashes with ogs_pfcp_setup_far_gtpu_node
by a special crafted gTPTunnel.transportLayerAddress
2023-05-14 10:19:37 +09:00
Sukchan Lee 7580d3df16 Follow-up #2551 2023-04-22 07:53:22 +09:00
gstaa 9e0467e534
Merge branch 'main' into gh_upf_metrics_wrong_dnn 2023-04-17 06:47:15 +02:00
Sukchan Lee aed52a9ad8 [GTP-U] Send Error Indication for unknown PDR 2023-04-16 12:30:36 +09:00
Sukchan Lee d2e2a58232 [PFCP] Implement the Restoration Indication 2023-04-16 12:30:36 +09:00
Sukchan Lee 642d9e2e18 [PFCP/GTP] SEID/TEID Randomness (#1303) 2023-04-16 12:30:36 +09:00
Gaber Stare 2e3d287afc [UPF metrics] Use APN/DNN to expose dnn label
SMF started to provide APN/DNN in PFCP Establishment.
APN/DNN is used to provide dnn label of metric fivegs_upffunction_upf_qosflows.
2023-04-14 05:14:23 +00:00
Sukchan Lee 32019df0f0 Fixed MacOSX compile error 2023-04-04 21:53:39 +09:00
Sukchan Lee b9a3157467
[PFCP] SGWU/UPF Restoration (#2223)
TS23.007 17.4.1
19A PFCP based restart procedures

After a PFCP entity has restarted, it shall immediately update all local Recovery Time Stamps and shall clear all remote
Recovery Time Stamps. When peer PFCP entities information is available, i.e. when the PFCP Association is still alive,
the restarted PFCP entity shall send its updated Recovery Time Stamps in a Heartbeat Request message to the peer
PFCP entities before initiating any PFCP session signalling.
2023-04-04 21:22:03 +09:00
Sukchan Lee 939b311b2d [UPF] Remove Metrics in Data Plane (#2210) 2023-04-01 11:48:24 +09:00
Gaber Stare 6f593432a4 [AMF metrics] Initial histogram support
Version of histogram support without ogs_metrics_spec_new_ex().
Buckets are now, just like labels, passed to ogs_metrics_spec_new() as a pointer.
2023-03-24 23:03:49 +09:00
Sukchan Lee ff4eab2e51 [SMF] Fixed crash during UPF-HA process (#2115) 2023-03-06 21:04:43 +09:00
mitmitmitm 1d8324af9f [PFCP] Support pfcp advertise address 2023-02-24 20:53:28 +09:00
mitmitmitm 22be888dae Don't left-shift by negative amount, which is UB according to C17 2023-02-20 21:00:16 +09:00
Sukchan Lee 82e9016164 [AMF/SMF] Fixed a crash (#2030, #2074, #2085) 2023-02-20 20:49:48 +09:00
Sukchan Lee b108ae0aff [PFCP] buffer overflow in ALPINE (#1911, #2009)
A buffer overflow occurred in ALPINE
because the size of the pfcp message structure increased by

    ogs_pfcp_tlv_framed_route_t framed_route[8];
    ogs_pfcp_tlv_framed_ipv6_route_t framed_ipv6_route[8];
2023-01-24 19:03:00 +09:00
Sukchan Lee c6fd4ae6b8 [LOG] remove ogs_expect_or_return()/return_val() 2023-01-24 00:01:36 +09:00
Sukchan Lee 54331d77ee [UPF] URR time threshold log to info (#1997) 2023-01-23 15:58:55 +09:00
mitmitmitm 990abbab2c [UPF] Handle framed routes 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 a712d865cd [METRICS] Re-order init/final (#1985, #2001) 2023-01-20 21:16:45 +09:00
Sukchan Lee 8553c77733 [METRICS] Fixed a core dump in SMF/UPF/PCF (#1985) 2023-01-07 21:17:14 +09:00
Sukchan Lee 1be6176e8d Follow-up on #1940 - Fixed compile error 2022-12-07 20:41:18 +09:00
Sukchan Lee fbd9ada101 Follow-up on #1940 2022-12-06 22:59:06 +09:00
Gaber Stare 40b4c9d1c9 [UPF] Add metrics support
Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in
UPF by using hash.

The metrics are named respecting the rule:
<generation>_<measurement_object_class>_<measurement_family_name>_<metric_name_as_in_TS_128_552>

5qi is not available in UPF.
To present 5qi to the user, MN will have to maintain a table qfi->5qi
for each QoS flow (will have to get information from SMF).
So UPF has to expose qfi. qfi itself is not useful. When used, UPF will
have to expose additional label to define the session (e.g. source
interface).

Label dnn is set to value of APN/DNN received in Establishment.
Since SMF does not add APN/DNN to Establishment, the label is empty.
When APN/DNN will be set by SMF, it should be added to sess in UPF
and used in metrics on Modification and Deletion.

Both datavolumeqosleveln3upf are exposed in bytes.
MN is providing the transformation to kbits.

fivegs_upffunction_upf_qosflows should expose the number of QFIs used in
sessions, but exposes number of QER rules, which is currently equal to
QFIs.
The label snsssai is not provided since the slice is not available on UPF.

Exposed metrics example:
Standard counters:
fivegs_ep_n3_gtp_indatapktn3upf 28637
fivegs_ep_n3_gtp_outdatapktn3upf 14729
fivegs_upffunction_sm_n4sessionestabreq 4
fivegs_upffunction_sm_n4sessionestabfail{cause="66"} 1
fivegs_upffunction_sm_n4sessionestabfail{cause="71"} 68
fivegs_upffunction_sm_n4sessionestabfail{cause="68"} 4
fivegs_upffunction_sm_n4sessionestabfail{cause="72"} 15
fivegs_upffunction_sm_n4sessionestabfail{cause="75"} 3
fivegs_upffunction_sm_n4sessionestabfail{cause="65"} 4
fivegs_upffunction_sm_n4sessionreport 0
fivegs_upffunction_sm_n4sessionreportsucc 0
fivegs_ep_n3_gtp_indatavolumeqosleveln3upf{qfi="1"} 39792997
fivegs_ep_n3_gtp_outdatavolumeqosleveln3upf{qfi="1"} 737548
Nonstandard gauge (added for controlling purposes -
same metric as existing metric on AMF and SMF):
fivegs_upffunction_upf_sessionnbr 1
Standard gauge:
fivegs_upffunction_upf_qosflows{dnn=""} 1
2022-12-06 22:57:24 +09:00
Lester 0fe904d593 free replybuf after sent replay message 2022-12-05 12:05:39 +09:00
Sukchan Lee f85ff227c8 Continue to fix alpine stack overflow (#1911) 2022-11-27 00:11:34 +09:00
Sukchan Lee d82f338246 Fixed alpine stack overflow (#1911) 2022-11-27 00:03:56 +09:00
Sukchan Lee 5ccb5f0f99 SCP(Model D) is now the default setting. 2022-10-22 11:26:04 +09:00
Spencer Sevilla be2af54682 ogs_info swaps CP and UP SEIDs 2022-10-05 17:41:42 +09:00
Sukchan Lee 71a1516b03 [Security] Fixed a crash for port scanning (#1767) 2022-10-01 13:28:41 +09:00
Sukchan Lee 1acb7f72b4 [UPF] test code for unspecified address (#1776) 2022-10-01 13:23:15 +09:00
Sukchan Lee 4b26dd2a5c Follow-on up #1793 2022-10-01 13:07:54 +09:00
Dibas Das f72a1edc6e Fix UL and DL URR Usage Report 2022-10-01 13:07:04 +09:00
Spencer Sevilla e704ac108e add addr/port to pfcp assoc/de-assoc logs (#40)
pfcp association log adds addr/port
2022-09-25 18:58:53 +09:00
Sukchan Lee 31fcedc12e Follow-up on #1770 2022-09-25 16:42:46 +09:00