Commit Graph

1642 Commits

Author SHA1 Message Date
Matej Gradisar 227dc1a90d [SMF] return a subnet with available IP addresses
Enables to use multiple UE subnets with the same DNN and family
2023-09-19 21:06:00 +09:00
Matej Gradisar d454e2428f [SMF] Check config file for overlapping UE subnets 2023-09-19 21:06:00 +09:00
Sukchan Lee 8a3dbd44ae [MME] Protection code for No IMSI (#2613, #2614) 2023-09-16 22:27:21 +09:00
Sukchan Lee aa746794e7 [GTPU] Fixed Stack-Buffer-Overflow in GTPU (#2609) 2023-09-15 07:17:04 +09:00
Sukchan Lee bfe8ae659e Fixed MacOSX compile error (Follow-up on #2581) 2023-09-14 07:04:27 +09:00
Sukchan Lee bd74c259ec [AMF/MME] Fix crash during snow-3g encrypt (#2581)
There was a memory problem in the encryption using snow_3g_f8,
so AMF/MME crashed.

To solve this problem, we used the snow-3g encryption library
created as below.

https://github.com/rcatolino/libressl-snow3g

However, it seems that this library cannot be used to create
integrity hash like snow_3g_f8.

So, we decided to keep both snow-3g libraries for the time being.

1. lib/crypt/snow3g* : for INTEGRITY (NIA1, EIA1)
2. lib/crypt/openssl/snow3g* : for ENCRYPTION (NEA1, EEA1)
2023-09-13 23:22:46 +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 2fbc445d32 [PFCP] Fixed Possible heap buffer overflow (#2585)
After examining the call stack and reading the source code, I found that
in /lib/core/ogs-pool.h line 152: (pool)->array[i] = i+1;
then in lib/pfcp/context.c line 78: pdr_random_to_index[ogs_pfcp_pdr_teid_pool.array[i]] = i;
ogs_pfcp_pdr_teid_pool.array[i] may exceed the size of pdr_random_to_index, leading to a heap-buffer-overflow.
2023-09-06 07:14:51 +09:00
Sukchan Lee 7a3d551752 [TLV] Oops! Fixed my mistake on pull #2549 2023-08-26 16:35:27 +09:00
Sukchan Lee 5c726684b3 [TLV] GTP parser crashg from FuzzingLabs
See below for details
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61780#c1
2023-08-26 16:30:29 +09:00
Sukchan Lee 654fe4010c [GTP] gtp_message_fuzz: Abrt in ogs_abort
See below for details.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=59414
2023-08-24 22:19:42 +09:00
Sukchan Lee 7f088730ed [SBI] nghttp2 SETTING ACK should be sent (#2385)
Whether or not to send a Setting ACK is determined by the nghttp2 library.
Therefore, when nghttp2 informs us that it want to send an SETTING frame
with ACK by nghttp2_session_want_write(), we need to call session_send()
directly to send it.
2023-08-20 21:08:20 +09:00
Sukchan Lee 4b0bade80e [TLV] PFCP parser crash from FuzzingLabs (#2523) 2023-08-18 22:19:46 +09:00
Sukchan Lee fc4072590e [SMF] Added SMF registrations (#2514, #2524) 2023-08-18 20:21:08 +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 d33d67b2af [AMF/MME] Defaults 9 minutes for T3412/T3512 2023-08-13 11:16:06 +09:00
Sukchan Lee 35356e9d9b Fixed SIGPIPE problem (#2411, #2312) 2023-07-26 22:51:26 +09:00
Sukchan Lee b116f077a5
UPF HA - release/establish new PDU session in CM_IDLE (#2471)
See also #2396, #2418
2023-07-25 22:38:38 +09:00
Sukchan Lee b08b2adc6c [AMF/MME] Remove code that doesn't work (#2013)
Based on the standard document below, when the UE is in the IDLE state,
we checked the implicit timer and tried to send a message to the UE,
but it doesn't work properly.

So, first of all, I deleted the related code.

- TS 24.301 Ch 5.3.7
If ISR is not activated, the network behaviour upon expiry of
the mobile reachable timer is network dependent, but typically
the network stops sending paging messages to the UE on the
first expiry, and may take other appropriate actions

- TS 24.501 Ch 5.3.7
The network behaviour upon expiry of the mobile reachable timer is network dependent,
but typically the network stops sending paging messages to the UE on the first expiry,
and may take other appropriate actions.
2023-07-23 14:54:06 +09:00
Sukchan Lee 8535ceab8c [HSS] Modify where to check mongodb version (#2425) 2023-07-15 23:52:13 +09:00
Pau Espin 84ed735204 mme: Introduce initial Gn iface (GTPv1C) support
This interface allows supporting several inter-RAT mobility features
towards pre-rel8-SGSNs (SGSNs without S3/S4 GTPV2C interface).

Related specs:
- 3GPP TS 23.401:
-- "5.6 Network Assisted Cell Change"
-- "5.15 RAN Information Management (RIM) procedures"
--  "Annex D"
- 3GPP TS 23.060 (general GERAN<->GERAN mobility)
- 3GPP TS 29.060
2023-07-15 23:44:57 +09:00
Pau Espin a7898cb26c gtp1: Add missing RAN INFORMATION RELAY msg
The RAN INFORMATION RELAY message has no associated response, and hence
it should not start T3-RESPONSE timer to retrigger retransmissions.

 TS 29.060 11.1:
 "The Error Indication, Version Not Supported, RAN Information Relay,
 Supported Extension Headers Notification and the SGSN Context Acknowledge
 messages shall be considered as Responses for the purpose of this clause"

 TS 29.060 7.5.14.1:
 "For handling of protocol errors the RAN Information Relay message is treated as a
 Response message."
2023-07-14 07:50:27 +09:00
Pau Espin fa5d9003d7 gtp: xact: Fix unneeded conditionals
The xarg->org is set to a specific value above in the same function, so
no need to check for its value.
2023-07-13 22:25:18 +09:00
Bostjan Meglic 9e20617a8f [PFCP] Fix calculation of AMBR
When converting bitrates from bits per second to kilobits per second,
if the conversion results in fractions, the resulting value should be
rounded upwards
2023-06-03 09:19:52 +09:00
Bostjan Meglic 22cca3eb48 [NAS] Improve algorithm for conversion of bitrate to NAS
The improved algorithm better handles some odd bitrates.
With the current version, the bitrates 63 Kbps and 65 Kbps would get
converted into 48 Kbps (unit 16 Kbps x 3) and 64 Kbps (unit 64 Kbps x
1).
Especially in the first case, the conversion error is quite signicant.

Current version tries to find the biggest 'unit', while the 'value' is
still above 0.
With the updated version, the algorithm tries to find the 'unit' low
enough, that the resulting 'value' can still fit into the 16-bit space
without overflow.
2023-06-03 09:19:52 +09:00
Bostjan Meglic bbc397013b [SBI,NAS] Fix conversion of bitrate between OpenAPI/NAS and internal representation
From the OpenAPI document,TS29571_CommonData.yaml : BitRate
String representing a bit rate; the prefixes follow the standard symbols from The International
System of Units, and represent x1000 multipliers, with the exception that prefix "K" is
used to represent the standard symbol "k".
2023-06-03 09:19:52 +09:00
Sukchan Lee f969309f11 [CORE] Rollback ogs_pool_init/final (#2339)
ogs_pool_init() shall be used in the initialization routine.
Otherwise, memory will be fragment since this function uses system malloc()

Compared with ogs_pool_init()

ogs_pool_create() could be called while the process is running,
so this function should use ogs_malloc() instead of system malloc()
2023-05-28 22:50:28 +09:00
Sukchan Lee 31f95ce2e0 [SBI] Fixed Invalid S-NSSAI format (#2337) 2023-05-28 21:53:52 +09:00
mitmitmitm 928a80ef26 [PFCP] Support PFCP advertise address in F-SEID 2023-05-25 22:46:52 +09:00
mitmitmitm cd485944cb [PFCP] Fix IPv4 PFCP advertise addresses 2023-05-25 22:46:52 +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 7ce1137a10 [SMF] Disable Network Service request while ACTIVATING
Disable Network triggered service request
while UE triggered service request

(#2294)
2023-05-08 22:33:50 +09:00
Bostjan Meglic e55a87ec7d [APP] Fix number of items of memory pool for subscriptions to NRF
The subscriptions to NRF should be tied to the number of NF's and number
of services per NF that we support, instead of number of UE's.

This decreases memory usage of each NF slightly, depending on the
configuration.
2023-04-24 21:48:11 +09:00
Sukchan Lee 01d3db4b6e [MME/SMF] Added Extended-PCO in 4G/LTE (#2261) 2023-04-22 00:06:50 +09:00
Sukchan Lee de7e0d3b45 [SBI] Fixed an issue with FQDN/TLS (#2252) 2023-04-21 22:37:07 +09: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
Abdelmuhaimen Seaudi 69831c43f5 add support for sigscale ocs
added several changes to correctly work with sigscal ocs offline charging
2023-04-12 22:31:01 +02: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 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 28d5659aa5 Follow-up on #2178 2023-03-24 23:04:32 +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 424f382265 [AMF/MME] Support TAI Range 2023-03-19 18:31:45 +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 6b17bffdfd [SBI] Modified Exception handler on error (#2169) 2023-03-15 20:41:22 +09:00
Sukchan Lee dd2c85b1b0 [SBI] Conforms standard in Subscription API(#2152)
POST requests to {apiRoot}/nnrf-nfm/v1/subscriptions return
a HTTP Location header in 201 respose
in the form {apiRoot}/nnrf-nfm/v1/subscriptions/{subscriptionID}
2023-03-12 23:00:14 +09:00
Sukchan Lee ad9e5b28cf [SBI] Added Handler for Subscription PATCH (#2152) 2023-03-12 22:06:19 +09:00
Sukchan Lee 69c080c8f2 [NAS/GTP/PFCP] Upgrade IE to Release-17
As raised in #2147, AMF fails to decode S1 UE Network Capability.

So I reviewed all IE in NAS, GTP and PFCP and fixed it for Release-17.
2023-03-11 18:42:30 +09:00
Sukchan Lee 66b2f6120e Release v2.6.1 2023-03-08 23:59:33 +09:00
Sukchan Lee cedec3a7b9 Added log message for troubleshooting #2117 2023-03-06 21:19:42 +09:00
Sukchan Lee e41afff7ac Added N32 Interface to implement SEPP 2023-03-05 22:55:36 +09:00
Sukchan Lee a8790713d7 [Release-17] Upgrade PFCP to v17.7.1 2023-03-05 22:33:01 +09:00
Sukchan Lee 3b8a1386e4 [Release-17] Upgrade GTPv1/v2 to v17.4.0/v17.7.0 2023-03-05 12:37:14 +09:00
Sukchan Lee fd9c211005 [PFCP/GTP] Fixed security bug (#2127,#2128,#2129) 2023-03-05 08:35:30 +09:00
Sukchan Lee 62b6b42e88 [Release-17] Upgrade NAS to v17.8.0 2023-03-04 23:47:40 +09:00
Sukchan Lee 4d44b1843e [Release-17] Upgrade SBI to v17.x.0 2023-03-01 19:56:49 +09:00
Sukchan Lee 969c116e77 [SBI] Crash occurs when ENUM in the MAP (#2103) 2023-03-01 17:50:25 +09:00
Sukchan Lee ce668c556c [SBI] Fixed openapitools MAP generation (#2103)
MAP was generated incorrectly because {{#items}}..{{#items}} was
missing.

Because of this, If scpInfo has scpPort, NRF crashes.
2023-02-26 10:01:08 +09:00
mitmitmitm 1d8324af9f [PFCP] Support pfcp advertise address 2023-02-24 20:53:28 +09:00
Sukchan Lee 10477ecdc9 [Release-17] Upgrade S1AP/NGAP to v17.3.9 2023-02-21 21:48:06 +09:00
Sukchan Lee 82e9016164 [AMF/SMF] Fixed a crash (#2030, #2074, #2085) 2023-02-20 20:49:48 +09:00
Sukchan Lee 0df402bd49 [SBI] Move HNET PKI conf inside UDM 2023-02-18 12:41:08 +09:00
Sukchan Lee 05fbaf6958 [SBI] HTTP2-TLS verification - ConfFile Changed
You should add the following configuration if you would not use TLS.

sbi:
    server:
      no_tls: true
    client:
      no_tls: true
2023-02-18 10:58:29 +09:00
Sukchan Lee b80db453e8 [GTP/PFCP] Follow-up on #2073 2023-02-17 06:55:22 +09:00
Spencer Sevilla d30fcbb848
[pfcp] response_timeout should not call ogs_pfcp_xact_delete (#2072)
* [pfcp] response_timeout should never call ogs_pfcp_xact_delete (#50)

* also remove ogs_pfcp_xact_delete since never called

* also had to catch one more ogs_pfcp_sendto()

---------

Co-authored-by: Spencer Sevilla <spencer@MacBook-Air.local>
2023-02-17 06:50:50 +09:00
Sukchan Lee 512cc2d01b Further Follow-up on #2063 2023-02-16 22:16:20 +09:00
Sukchan Lee e20faeb1ef Follow-up on #2069 2023-02-14 23:07:23 -10:00
Bostjan Meglic dfcd3431c3 [SBI] Fix possible crash when handling PatchItems in NFProfile PATCH req 2023-02-14 23:01:56 -10:00
Bostjan Meglic cef5b38087 [SBI] Do not treat removed streams as errors when sending responses
This is in line with the implementation with microhttpd server
(mhd-server.c).
2023-02-14 10:12:26 -10:00
Sukchan Lee 888e58a94e [AMF] Network Deregister (#2056, #2014, #2021)
Fixed a crash on explicit network-initiated deregister
with SUBSCRIPTION_WITHDRAWN
2023-02-10 23:09:39 +09:00
Bostjan Meglic 474b2d4134 [SBI,NF] Don't treat SBI connection errors as asserts 2023-02-07 22:49:11 +09:00
Sukchan Lee b7905725ac [SBI] HTTP/2 user-agent header (#2048)
Open5GS now checks User-AGENT only in SCP.
2023-02-05 09:50:44 +09:00
Bostjan Meglic 5f9b941d25 Remove not valid UTF-8 characters
These UTF-8 characters are causing issues with static code analysis
tools.

Error: encoding error in ./lib/crypt/zuc.c
'utf-8' codec can't decode byte 0x97 in position 3948: invalid start byte
Python3 requires input character data to be perfectly encoded;
it also requires perfectly correct system encoding settings.
Unfortunately, your data and/or system settings are not.
2023-01-31 00:22:16 +09:00
Sukchan Lee 131ecb4a44 [CORE] Add defense code to ogs_pkbuf_copy (#2032)
Added a defense code to prevent NF crash when ogs_pkbuf_copy() size is 0.
2023-01-29 16:45:42 +09:00
Sukchan Lee b7386284a7 [NRF] Fixed a crash during NRF discovery (#2034)
Other NF instances are obtained through NRF
or created directly through configuration files.

Other NFs created by the config file should not be passed
through NRF discovery or anything like that.

Since self-created NF Instances do not have an ID,
they are implemented to exclude them from NRF Discovery.
2023-01-29 11:22:45 +09:00
Sukchan Lee f50591a8f7 Added Service-MAP to Requester-Features (#2027)
ALWAYS Added Service-MAP to Requester-Features in Discovery Option
2023-01-29 01:35:47 +09:00
mitmitmitm 739cb599d1 [UDR] Read framed routes from DB send them in sm-data
The framed routes are stored in mongo as

 {
     "imsi" : "$IMSI",
     ...,
     "slice" :
     [{
         ...,
         "session" :
             ...,
             "ipv4_framed_routes" : ["10.45.33.0/24", "10.45.35.0/24"],
         }],
     }],
 },
2023-01-26 22:37:58 +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 3715b9ece3 [CORE] OGS_MAX_SDU_LEN->OGS_HUGE_LEN Stack (#2008)
Changed all OGS_MAX_SDU_LEN in the stack to OGS_HUGE_LEN.
2023-01-25 22:24:51 +09:00
Sukchan Lee 596a2f1b5e [SBI] Fixed crash if no BW Unit(Xbps) (#2000) 2023-01-24 21:55:06 +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 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 11aac6a164 [CORE] Rollback ogs_pkbuf_copy() from (#2012)
In the previous #2012 working, I've added ogs_pkbuf_free() for original
buffer. But, this rasied double free. So, I've rollback it,
2023-01-24 00:17:10 +09:00
Sukchan Lee c6fd4ae6b8 [LOG] remove ogs_expect_or_return()/return_val() 2023-01-24 00:01:36 +09:00
Sukchan Lee 689574a2d9 [AMF/MME] Fixed crash when no NG/S1 context(#2012) 2023-01-23 10:37:22 +09:00
Sukchan Lee a8f83989f4 Follow-up on #2009 2023-01-23 09:29:00 +09:00
mitmitmitm f6439b998c [SMF] Handle framed routes, forward them to UPF and PCF 2023-01-23 09:26:26 +09:00
mitmitmitm 990abbab2c [UPF] Handle framed routes 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 0e0085c69f [UPF] Fixed bug when 2 PDRs with same TEID (#2003) 2023-01-18 23:31:54 +09:00
Sukchan Lee 01a7b3c9b8 Follow-up on #1991 2023-01-14 09:20:52 +09:00
jmasterfunk84 3fd7ecc9a2
[MME] Add Purge-UE Capability (#1991)
* [MME] Add Purge-UE Capability

* Add OGS_GTP_..._PURGE_AND_REMOVE to split CLR case
2023-01-14 09:13:48 +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
Bostjan Meglic ddfd7b9373 [pfcp] Fix code style 2023-01-09 21:47:30 +09:00
Sukchan Lee 7f9afa0213 [AMF] More Follow-up on #1987 2023-01-08 20:02:18 +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
mitmitmitm 0ebe07c83d [mongo] Use "ping" command instead of "serverStatus"
"serverStatus" on the "admin" database may fail due to insufficient privileges.
2022-12-21 23:15:34 +09:00
Gaber Stare b56c33479e Add NF load to NRF Heartbeat
The current load percentage of the NF Service Consumer is provided
in the payload body of the PATCH request when periodically
contacting the NRF (heart-beat).

AMF: ratio between currently connected ran_ue and maximum number of them
SMF: ratio between current PDU sessions and maximum available
PCF: ratio between current AM+SM policy associations and maximum available
     or ratio between currently connected UEs and maximum number of them
     (the load which is higher)
AUSF, UDM: ratio between currently connected UE and maximum number of them
BSF: ratio between current sessions and maximum available
NSSF: ratio between currently used NSIs and maximum number of them

NRF currently doesn't determine that the NF Profile has changed.
2022-12-14 22:53:56 +09:00
Lester bd080f5095 free socket fd
call ogs_sock_destroy to free sock when fail to get socket fd
2022-12-09 16:10:44 +09:00
Gaber Stare 0c2a3b0f39 [PCF] Add metrics support
Expose metrics with labels according to ETSI TS 128 552 V16.13.0 in
PCF by using hash.

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

Since slice itself is not unique, the plmnid label is exposed in
addition to snssai.

AM policy:
fivegs_pcffunction_pa_policyamassoreq and
fivegs_pcffunction_pa_policyamassosucc do not expose snssai label
since it is not available at the time of exposure.
plmnid is defined during AM policy processing, so not to lose the
difference to ...succ, the basic metric
fivegs_pcffunction_pa_policyamassoreq is preserved.

SM policy:
snssai is defined during SM policy processing, so not to lose the
difference to ...succ, the basic metric
fivegs_pcffunction_pa_policysmassoreq is preserved.

Those 2 basic metrics retain their position but are exposed with empty
labels.
Metrics with labels are called later, when the label values are known.

Exposed metrics example:
-standard counters:
fivegs_pcffunction_pa_policyamassoreq{plmnid=""} 3
fivegs_pcffunction_pa_policyamassoreq{plmnid="99970"} 3
fivegs_pcffunction_pa_policyamassosucc{plmnid="99970"} 3
fivegs_pcffunction_pa_policysmassoreq{plmnid="",snssai=""} 3
fivegs_pcffunction_pa_policysmassoreq{plmnid="99970",snssai="1000009"} 3
fivegs_pcffunction_pa_policysmassosucc{plmnid="99970",snssai="1000009"} 3

-nonstandard gauge (added for controlling purposes -
same metric as existing metric on AMF and SMF):
fivegs_pcffunction_pa_sessionnbr{plmnid="99970",snssai="1000009"} 0
2022-12-06 22:57:24 +09:00
Sukchan Lee a5fd315e11 [SBI] Case-Insensitive inside MIME message (#1939) 2022-12-05 21:30:24 +09:00
Sukchan Lee 0861a045ef [UPF] Fixed an infinte loop when ext_len is 0 2022-11-30 16:40:57 +09:00
Sukchan Lee 944adaabbf [AMF/MME] Added Timer Configuration (#1905) 2022-11-29 23:22:16 +09:00
mitmitmitm 3870216a6b [AMF] Add support for SDM subscription and authentication deletion 2022-11-29 23:10:49 +09:00
mitmitmitm dbd0e654c8 OpenAPI: Add functions OpenAPI_list_clear and OpenAPI_list_insert_prev 2022-11-29 23:10:49 +09:00
Sukchan Lee d82f338246 Fixed alpine stack overflow (#1911) 2022-11-27 00:03:56 +09:00
Sukchan Lee 8ce18b3828 [AMF/MME] Refactor SM to prevent crash (#1912) 2022-11-26 21:38:46 +09:00
mitmitmitm a951d683d2 OpenAPI: AnyType for ChangeItem's newValue and origValue properties 2022-11-24 17:30:38 +09:00
mitmitmitm b85ad61e2b OpenAPI: Generate patch_item.[ch] from OpenAPI specifications 2022-11-24 17:30:38 +09:00
mitmitmitm 36734cac7c OpenAPI: Move any_type.[ch] from custom/ into sbi/openapi/model/
This makes it possible to have object values of type "any_type" in OpenAPI
specifications.
2022-11-24 17:30:38 +09:00
Sukchan Lee 982ac61894 Prometheus metrics set to default 2022-11-21 22:06:29 +09:00
Sukchan Lee 57f1f2c21a Fixed crash after 48 hours of running (#1893) 2022-11-18 23:28:35 +09:00
Sukchan Lee d39bafc6d6 [SBI] Introduced HTTP2-TLS based on #1865
Verfication is not implemented.
2022-11-12 10:47:18 +09:00
Sukchan Lee 0859dd4453 Follow-up on #1865 2022-11-12 09:37:43 +09:00
Flander Bojan 4ba90fbd3b Fix TLS error handling 2022-11-12 09:30:31 +09:00
Flander Bojan 141c345b75 Add TLS support 2022-11-12 09:30:31 +09:00
Sukchan Lee fa35b06963 Follow-up on #1876 2022-11-04 14:58:47 +09:00
Bostjan Meglic 00a86c5a73 [SBI] Do not send empty arrays when registering to NRF
OpenAPI dictates that certain arrays should have at least one item,
otherwise they should not be present.
This includes lists for IPv4/v6 addresses, TAI/TAC lists, ...

Add a check if there is at least 1 item, before creating an array.
Also move variable declarations to inner blocks, to prevent some
accidental usage out of wanted scope.
2022-11-04 14:58:33 +09:00
Sukchan Lee cca53fb8e8 SCP had a serioud memory problem and fixed it 2022-10-30 13:35:25 +09:00
Sukchan Lee ec4acd4eca remove warning in MacOSX (#1797) 2022-10-25 21:14:53 +09:00
Sukchan Lee 5ccb5f0f99 SCP(Model D) is now the default setting. 2022-10-22 11:26:04 +09:00
jmasterfunk84 8fb85db310 [DBI] Disable Change Streams with mongo Version
Support for change stream is only available in mongoc >=1.9.0
- Disabled related functions in dbi.
Support for bson to json used in debug statement only in libbson >=1.7.0
- Simple debug message in lower versions
2022-10-13 17:33:35 +09:00
Sukchan Lee 704fe72d11 Updated SBI module
- Introduced NF_INSTANCE_ID/NF_INSTANCE_TYPE
- Skip SCP in configuration validation
2022-10-08 11:48:12 +09:00
Bostjan Meglic a99a76d916 [AMF,UDM] Add support to subscribe to SDM changes
AMF subscribes to UDM for each registered UE.

At the moment, UDM does not send callback to AMF when any of the UE's
properties in the database changes.
At the moment, AMF does properly parse the ModificationNotification, but
does not do anything useful.
2022-10-06 21:20:10 +09:00
safaorhann e9aaceee98 fix dropped_dl_traffic_threshold ie. 2022-10-06 10:40:08 +09:00
Sukchan Lee dc6ca962bb Follow-up on #1797 2022-10-06 10:10:31 +09:00
Sukchan Lee 6d27fbb8cc Follow-up on #1797 2022-10-05 14:50:52 +09:00
jmasterfunk84 15680003b5
[MME] Cancel Location while Idle (#1797)
* Cancel Location while Idle Fix

* Forgot about SGSAP on MME Change.

Added "action" to sgsap_send_detach..

* Make handle_clr uniform with other handlers

* Added Robustness for Any Detach Type

* Memory wasn't freed upon CLR for unknown IMSIs

* Moving MME Detach to new PR
2022-10-05 11:06:01 +09:00
Sukchan Lee 7c8722d9d4 [SBI] Client Request timeout
TS29.500
Ch 6.11 Detection and handling of late arriving requests

In Open5GS, this part was hard-corded.

HTTP2 Client sends a request and waits for 10 seconds.
If no response is received from the HTTP2 Server,
HTTP2 Client performs the exception handling.

In this commit, HTTP2 client sends Header with setting Max-Rsp-Time to 10 seconds.
However, HTTP2 server has not yet been implemented to process this value.
The server is still processing using hard-corded values (10 seconds).
2022-10-03 11:43:34 +09:00
Sukchan Lee c537166d37 Follow-on up #1794 2022-10-02 19:41:52 +09:00
jmasterfunk84 1f2a8678ed
[MME] Support for Insert Subscriber Data (#1794)
* [MME] Support for Insert Subscriber Data

* Supported AVPs in IDR will overwrite existing subscription information
* Provide error on partial APN updates
* IDR and ULA use same function to process AVPs
* Move subdatamask values into s6a, so both HSS and MME can use them
* Updates are not actioned at this time.  A Re-attach is required for
  most changes to take effect

* Memory issue on IDR exceptions

* Remove of handling MSIDSN change until DSR is used
2022-10-02 19:36:24 +09:00
Sukchan Lee 71a1516b03 [Security] Fixed a crash for port scanning (#1767) 2022-10-01 13:28:41 +09:00
Bostjan Meglic 2d4fbf92eb [config,metrics] Move metrics configuration section under respective NF section
Without this change, using metrics with core setup configurations
(configs/vonr.yaml for example) would not be possible. Having one
metrics section for whole config file causes every NF to start metrics
server on same port causing an abort.
2022-09-25 19:17:49 +09:00
Sukchan Lee 31fcedc12e Follow-up on #1770 2022-09-25 16:42:46 +09:00
Spencer Sevilla 0759c2da5a [core] fix timer overflow on 32bit systems (#16)
must cast ts.tv_sec to 64bits before we multiply it to prevent 32bit math and overflow
2022-09-25 16:41:50 +09:00
Sukchan Lee 724fa56843 Fixed HTTP2 crashes for random JSON data (#1769) 2022-09-25 15:06:37 +09:00
Sukchan Lee c2f6a020a7 [TLV] Added more debug information (#1767) 2022-09-25 09:17:23 +09:00
Sukchan Lee a0d643e17f Follow-up on #1758 2022-09-23 21:25:58 +09:00
jmasterfunk84 7f5476b111
[HSS] Enable Change Streams (#1758)
* [HSS] Enable Change Streams
* Enable Events and Timers in HSS
* Integrate change streams in dbi
* mongodb should be configured with replica sets enabled to use feature
* Change streams are optional in HSS
* Timer will poll change stream for changes in the database
* As changes are detected, event is created to perform the correct
  action

* Changes made as suggested
2022-09-23 21:24:50 +09:00
Sukchan Lee 2b8db5d488 Follow-up on #1757 2022-09-23 20:42:04 +09:00
Gaber Stare d3d4e5ce60 [AMF] Add amfInfoList to NFProfile
The actual configured GUAMIs and TAIs are used to form NF profile.
Comparing to SMF the "info" section is not introduced into amf.yaml!
Each amf_id (region, set) produces a separate Info in the InfoList.
Guami list consists of all GUAMIs of particular Info.
taiList consists of all TAIs for all PLMNs of particular Info.

Examle:

amf.yaml:
    guami:
      - plmn_id:
          mcc: 999
          mnc: 70
        amf_id:
          region: 2
          set: 2
          pointer: 4
      - plmn_id:
          mcc: 001
          mnc: 01
        amf_id:
          region: 2
          set: 1
      - plmn_id:
          mcc: 001
          mnc: 02
        amf_id:
          region: 2
          set: 2
    tai:
      - plmn_id:
          mcc: 001
          mnc: 01
        tac: [1, 2, 3]
    tai:
      - plmn_id:
          mcc: 002
          mnc: 02
        tac: 4
      - plmn_id:
          mcc: 001
          mnc: 02
        tac: 10
    tai:
      - plmn_id:
          mcc: 004
          mnc: 04
        tac: [6, 7]
      - plmn_id:
          mcc: 005
          mnc: 05
        tac: 8
      - plmn_id:
          mcc: 999
          mnc: 70
        tac: [9, 10]

"amfInfoList":  {
        "1":    {
                "amfSetId":     "002",
                "amfRegionId":  "02",
                "guamiList":    [{
                                "plmnId":       {
                                        "mcc":  "999",
                                        "mnc":  "70"
                                },
                                "amfId":        "020084"
                        }, {
                                "plmnId":       {
                                        "mcc":  "001",
                                        "mnc":  "02"
                                },
                                "amfId":        "020080"
                        }],
                "taiList":      [{
                                "plmnId":       {
                                        "mcc":  "001",
                                        "mnc":  "02"
                                },
                                "tac":  "00000a"
                        }, {
                                "plmnId":       {
                                        "mcc":  "999",
                                        "mnc":  "70"
                                },
                                "tac":  "000009"
                        }, {
                                "plmnId":       {
                                        "mcc":  "999",
                                        "mnc":  "70"
                                },
                                "tac":  "00000a"
                        }]
        },
        "2":    {
                "amfSetId":     "001",
                "amfRegionId":  "02",
                "guamiList":    [{
                                "plmnId":       {
                                        "mcc":  "001",
                                        "mnc":  "01"
                                },
                                "amfId":        "020040"
                        }],
                "taiList":      [{
                                "plmnId":       {
                                        "mcc":  "001",
                                        "mnc":  "01"
                                },
                                "tac":  "000001"
                        }, {
                                "plmnId":       {
                                        "mcc":  "001",
                                        "mnc":  "01"
                                },
                                "tac":  "000002"
                        }, {
                                "plmnId":       {
                                        "mcc":  "001",
                                        "mnc":  "01"
                                },
                                "tac":  "000003"
                        }]
        }
}
2022-09-23 20:37:47 +09:00
Sukchan Lee ce7d631064 [GTP/PFCP] TLV length more acceptable (#1780)
Acceptable even if the TLV length is smaller than expected
2022-09-23 13:13:34 +09:00
Sukchan Lee 5520cb65a5 Follow-up on #1744 2022-09-13 17:03:18 +09:00
jmasterfunk84 775520d7a8
Introduce Cancel Location and Insert Subscriber Data features to HSS. (#1744)
* Introduce Cancel Location and Insert Subscriber Data features to HSS.
* HSS database will keep track of last known MME and Update Time
* Purged UE flag is established in HSS for future PUR handling
* HSS Thread will connect to database and watch change stream
  mongoDB must be configured with a Replica Set to use this
* HSS will send IDR if subscription data changes
* HSS will send CLR to old MME if MME host or realm changes
* Function created to allow ULA and IDR to generate Subscription-Data AVP
* MME Hostname and Realm shown in WebUI

* Resolve freeDiameter errors

During a ULR, if database does not contain a last known MME, a CLR is being sent to a Null destination.  This will ensure that a destination is available in the database before sending the CLR.

* Removed change streams.  Added PUR handling.

* newline needed at end of file.

* Removed temp variable.

* * Change WebUI to 2x2 display
* Including UE Purged indicator
* Using pointers in ogs_subscription_data_t
* better memory mangement with pointers
* Tweak to Destination used by hss_s6a_send_idr to use last known MME

* Check for null mme_host and mme_realms

Do this before trying to compare the strings.
2022-09-13 16:48:20 +09:00
Sukchan Lee f54bccacf5 Support service-based NF subscription 2022-09-08 22:12:01 +09:00
Bostjan Meglic 87cd34d300 Minor typo fix 2022-09-07 18:01:21 +09:00