Compare commits

..

37 Commits

Author SHA1 Message Date
Pau Espin c6c73c1f70 MME: Gn: Fill PDP Context requested from SGSN with IP allocated by SMF
IP assigned from SMF: session->paa
Static IP read from the Subscriber DB: session->ue_ip

When passing the PDP context information to the SGSN, we actually wanna
provide it with the IP address currently in use.
2024-05-22 07:14:53 +09:00
Pau Espin f401e7df14 Revert "[MME] Fixed ttcn3-mme-test-ogs (#2806) (#315)"
This reverts commit 87d9cdf569.
2024-05-22 07:14:53 +09:00
Sukchan Lee 87d9cdf569 [MME] Fixed ttcn3-mme-test-ogs (#2806) (#315)
Try to fix the following error

"MME_Tests.ttcn:955 : no SGSN Context Response from MME"
      MME_Tests.ttcn:1572 MME_Tests control part
      MME_Tests.ttcn:1457 TC_ue_cell_reselect_eutran_to_geran testcase
2024-05-21 21:06:17 +09:00
Sukchan Lee 02d302b15a [SEC] Fix Assertion ogs_pfcp_parse_volume (#3207) 2024-05-18 21:37:28 +09:00
Sukchan Lee 15ff23de75 [SEC] Fix Assertion ogs_pfcp_parse_sdf_filter (#3207) 2024-05-18 21:37:28 +09:00
Sukchan Lee b1bf2b10e2 [SEC] Fix Assertion ogs_pfcp_f_seid_to_ip (#3207) 2024-05-18 21:37:28 +09:00
Sukchan Lee bd4d925f0f [SEC] Fix Assertion ogs_pfcp_parse_user_plane_ip_resource_info() (#3207) 2024-05-18 21:37:28 +09:00
Sukchan Lee 5f425445a8 [SEC] Fix Assertion ogs_gtp2_parse_uli (#3209) 2024-05-18 21:37:28 +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
Sukchan Lee bba0ebe6a4 [SEC] crash for IMSI/MSISDN/IMEI overflow (#3207)
When using ogs_buffer_to_bcd(), an overflow occurs if the input buffer length
is larger than the output bcd size, causing a crash.

We adjusted the size of the input buffer length using ogs_min as follows.
```
    sgwc_ue->imsi_len = ogs_min(imsi_len, OGS_MAX_IMSI_LEN);
    memcpy(sgwc_ue->imsi, imsi, sgwc_ue->imsi_len);
    ogs_buffer_to_bcd(sgwc_ue->imsi, sgwc_ue->imsi_len, sgwc_ue->imsi_bcd);
```
2024-05-17 20:25:49 +09:00
Sukchan Lee 80ab4c4a1b [NF] Move ogs_log_config_domain() location (#3210)
When we run the test, for example,
./tests/registration/registration simple-init,
wee get an INFO message like the one below.

```
05/17 14:24:03.933: [sbi] INFO: NF EndPoint(addr) setup [127.0.0.200:7777] (../lib/sbi/context.c:474)
```

When we run the code in Open5GS, the log level initially defaults to INFO.

However, for test code, we change the log level to ERROR
by automatically inserting the -e error option into argv.

The reason for this is to prevent WARNING and INFO messages
from appearing when the test code is run.

However, the log level to ERROR is changed at the bottom of
the initialize routine, which caused the above message
to be printed during testing.

To prevent this from being printed, I modified the code
to change that log level to ERROR a little earlier.
2024-05-17 14:54:32 +09:00
Sukchan Lee 95de14c72b [SBI] SearchResult.validityPeriod 3600->30s (#3210)
The validity time for NF Instances obtained through NF Discovery was
not properly implemented. Since the validity was 3600 seconds(1 hour),
which caused 5G Core to not work properly after 3600 seconds(1 hour).

There was an issue where an NF Instance should be deleted
when its validity time expired, but it was not working correctly
due to incorrect use of reference count.

Therefore, I have modified the Validity of NF Instances obtained
through NF Discovery to work properly.

I also changed the default value of valdityPeriod to 30 seconds.
2024-05-17 14:54:32 +09:00
Sukchan Lee 7a9fea8aec [SBI] Re-factor NF Instance Context (#3093)
Fixed not using Reference Count for adding/deleting NF Instances.

Up until now, NF Instances have been managed by referencing the Reference Count.

Initially, when an NF Instance is added, the Reference Count is incremented and
when it is deleted, the Reference Count is decremented.

If a UE discovers another NF Instance through the NF Discovery function,
the Reference Count is incremented. And if a UE de-registers,
the Reference Count of the discovered NF is decremented.

However, there's a problem with this approach.

When other NF is de-registered,
there is no guarantee that it will be 100% notified.

For example, if a UDM is de-registered, but an SCP is de-registered before it,
the AMF will not be notified that the UDM has been de-registered.

In situations where this is not clear, Reference Count cannot be used.

Therefore, we have modified it to not use the Reference Count method.

Also, when a UE connects, it is modified to always search
whether an NF Instance exists by NF Instance ID whenever it is discovered.

To do this, we modified lib/sbi/path.c as shown below.

```diff
@@ -281,13 +281,15 @@ int ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
     }

     /* Target NF-Instance */
-    nf_instance = sbi_object->service_type_array[service_type].nf_instance;
+    nf_instance = ogs_sbi_nf_instance_find(
+            sbi_object->service_type_array[service_type].nf_instance_id);
     if (!nf_instance) {
         nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
                         target_nf_type, requester_nf_type, discovery_option);
-        if (nf_instance)
-            OGS_SBI_SETUP_NF_INSTANCE(
-                    sbi_object->service_type_array[service_type], nf_instance);
+        if (nf_instance) {
+            OGS_SBI_SETUP_NF_INSTANCE_ID(
+                    sbi_object->service_type_array[service_type], nf_instance->id);
+        }
     }
```
2024-05-12 10:24:15 +09:00
Sukchan Lee 9d8d560be7 [DOCKER] Change UID from 1000 to 2000
The ubuntu docker image defaults to UID 1000 as the ubuntu username,
so change the UID of the open5gs default user acetcom to 2000.
2024-05-11 16:26:04 +09:00
Daniel Willmann eb28c514ea [MME] s11: Allow CreateSessionResponse with no S5c TEID IE
The TEID is already known (provided by SGSN through Gn SGSNContextResponse),
so not mandatory for it to be set.
2024-05-11 01:07:45 +02:00
Pau Espin f16f6e3c6c [MME] s11: Allow CreateSessionResponse with no PAA IE
The PAA is already known (provided by SGSN through Gn SGSNContextResponse),
so not mandatory for it to be set.
2024-05-11 01:07:45 +02:00
Pau Espin 190b39a75c cosmetic: [MME] Fix wrong content in comment line 2024-05-11 01:07:45 +02:00
Sukchan Lee 87b4e4535c [SEC] Stack overflow in PCRF/PCF (#3157)
The indexes rx_message.ims_data.num_of_media_component and media_component->num_of_sub can overflow.

```
static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp,
        struct session *sess, void *opaque, enum disp_action *act)
..
        /* Gwt Specific-Action */
        case OGS_DIAM_RX_AVP_CODE_SPECIFIC_ACTION:
            break;
        /* Gwt Media-Component-Description */
        case OGS_DIAM_RX_AVP_CODE_MEDIA_COMPONENT_DESCRIPTION:
            media_component = &rx_message.ims_data.
                    media_component[rx_message.ims_data.num_of_media_component];

            ret = fd_msg_browse(avpch1, MSG_BRW_FIRST_CHILD, &avpch2, NULL);
            ogs_assert(ret == 0);
            while (avpch2) {
                ret = fd_msg_avp_hdr(avpch2, &hdr);
..
                }

                fd_msg_browse(avpch2, MSG_BRW_NEXT, &avpch2, NULL);
            }

            rx_message.ims_data.num_of_media_component++;
            break;
        default:
            ogs_warn("Not supported(%d)", hdr->avp_code);
            break;
        }
..
}
```
2024-05-01 16:52:10 +09:00
Sukchan Lee b57722178a [SEC] Heap overflow in open5gs-mmed/s1ap (#3153)
Assert shall be triggered if the mme_enb_t object is corrupted.

```
$ gdb -q -p `pidof open5gs-mmed`
..
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
0x0000ffff90deb46c in __GI___sigtimedwait (set=set@entry=0xfffffe63be68, info=info@entry=0xfffffe63bda8, timeout=timeout@entry=0x0) at ../sysdeps/unix/sysv/linux/sigtimedwait.c:61
61      ../sysdeps/unix/sysv/linux/sigtimedwait.c: No such file or directory.
Breakpoint 1 at 0xaaaabef69250: file ../src/mme/s1ap-handler.c, line 199.
[Switching to Thread 0xffff1efdef00 (LWP 20348)]

Thread 38 "open5gs-mmed" hit Breakpoint 1, s1ap_handle_s1_setup_request (enb=0xffff9029b5a0, message=0xffff1efdc498) at ../src/mme/s1ap-handler.c:199
warning: Source file is more recent than executable.
199         if (maximum_number_of_enbs_is_reached()) {
(gdb) p enb.supported_ta_list
$1 = {{plmn_id = {mcc1 = 0 '\000', mcc2 = 0 '\000', mcc3 = 1 '\001', mnc1 = 15 '\017', mnc2 = 0 '\000', mnc3 = 1 '\001'}, tac = 1} <repeats 256 times>}
(gdb) p enb
$2 = (mme_enb_t *) 0xffff9029b5a0
(gdb) p *enb
$3 = {lnode = {prev = 0x0, next = 0x0}, sm = {init = 0xaaaabef66540 <s1ap_state_initial>, fini = 0xaaaabef66640 <s1ap_state_final>, state = 0xaaaabef66730 <s1ap_state_operational>}, enb_id = 1, plmn_id = {
    mcc1 = 1 '\001', mcc2 = 2 '\002', mcc3 = 3 '\003', mnc1 = 15 '\017', mnc2 = 4 '\004', mnc3 = 5 '\005'}, sctp = {type = 1, sock = 0xfffedc000bd0, addr = 0xfffedc000e70, poll = {read = 0xffff9032a0f0,
      write = 0x0}, write_queue = {prev = 0x0, next = 0x0}}, state = {s1_setup_success = false}, max_num_of_ostreams = 30, ostream_id = 0, num_of_supported_ta_list = 258, supported_ta_list = {{plmn_id = {
        mcc1 = 0 '\000', mcc2 = 0 '\000', mcc3 = 1 '\001', mnc1 = 15 '\017', mnc2 = 0 '\000', mnc3 = 1 '\001'}, tac = 1} <repeats 256 times>}, s1_reset_ack = 0x10f100000110f100, enb_ue_list = {prev = 0x1,
    next = 0x0}}
pwndbg> vmmap enb
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
             Start                End Perm     Size Offset File
    0xffff8edd4000     0xffff8ede4000 ---p    10000      0 [anon_ffff8edd4]
►   0xffff8ede4000     0xffff90650000 rw-p  186c000      0 [anon_ffff8ede4] +0x1517010
    0xffff90650000     0xffff90659000 r-xp     9000      0 /usr/lib/aarch64-linux-gnu/libffi.so.8.1.0
```

The value s1_reset_ack = 0x10f100000110f100 shall contain a function pointer, but has been corrupted.

The following patch will abort the process:

```diff
$ diff --git a/src/mme/s1ap-handler.c b/src/mme/s1ap-handler.c
index dff401ded..55a1f7e1b 100644
--- a/src/mme/s1ap-handler.c
+++ b/src/mme/s1ap-handler.c
@@ -178,6 +178,7 @@ void s1ap_handle_s1_setup_request(mme_enb_t *enb, ogs_s1ap_message_t *message)
                 SupportedTAs_Item->broadcastPLMNs.list.array[j];
             ogs_assert(pLMNidentity);

+           ogs_assert(enb->num_of_supported_ta_list < OGS_ARRAY_SIZE(enb->supported_ta_list));
             memcpy(&enb->supported_ta_list[enb->num_of_supported_ta_list].tac,
                     tAC->buf, sizeof(uint16_t));
             enb->supported_ta_list[enb->num_of_supported_ta_list].tac =
@@ -310,6 +311,7 @@ void s1ap_handle_enb_configuration_update(
                     SupportedTAs_Item->broadcastPLMNs.list.array[j];
                 ogs_assert(pLMNidentity);

+               ogs_assert(enb->num_of_supported_ta_list < OGS_ARRAY_SIZE(enb->supported_ta_list));
                 memcpy(&enb->supported_ta_list[
                         enb->num_of_supported_ta_list].tac,
                         tAC->buf, sizeof(uint16_t));
```
2024-05-01 16:25:33 +09:00
Sukchan Lee 7ea82cb87b [SEC] Heap overflow in open5gs-mmed/s6a (#3156)
An assert shall be triggered.

The vulnerable code path is in src/mme/mme-fd-path.c:

```
/* s6a process Subscription-Data from avp */
static int mme_s6a_subscription_data_from_avp(struct avp *avp,
    ogs_subscription_data_t *subscription_data,
    mme_ue_t *mme_ue, uint32_t *subdatamask)
{
...
    /* AVP: 'MSISDN'( 701 )
     * The MSISDN AVP is of type OctetString. This AVP contains an MSISDN,
     * in international number format as described in ITU-T Rec E.164 [8],
     * encoded as a TBCD-string, i.e. digits from 0 through 9 are encoded
     * 0000 to 1001; 1111 is used as a filler when there is an odd number
     * of digits; bits 8 to 5 of octet n encode digit 2n; bits 4 to 1 of
     * octet n encode digit 2(n-1)+1.
     * Reference: 3GPP TS 29.329
     */
    ret = fd_avp_search_avp(avp, ogs_diam_s6a_msisdn, &avpch1);
    ogs_assert(ret == 0);
    if (avpch1) {
        ret = fd_msg_avp_hdr(avpch1, &hdr);
        ogs_assert(ret == 0);
        if (hdr->avp_value->os.data && hdr->avp_value->os.len) {
            mme_ue->msisdn_len = hdr->avp_value->os.len;                /* 1 */
            memcpy(mme_ue->msisdn, hdr->avp_value->os.data,
                    ogs_min(mme_ue->msisdn_len, OGS_MAX_MSISDN_LEN));   /* 2 */
            ogs_buffer_to_bcd(mme_ue->msisdn,
                    mme_ue->msisdn_len, mme_ue->msisdn_bcd);            /* 3 */
            *subdatamask = (*subdatamask | OGS_DIAM_S6A_SUBDATA_MSISDN);
        }
    }
```
2024-05-01 14:51:11 +09:00
Sukchan Lee e89aa79efe [SEC] Stack overflow in open5gs-hssd/s6a (#3155)
An assert shall be triggered if a stack corruption occurs.

The vulnerable code path is in src/hss/hss-s6a-path.c:

```
static int hss_ogs_diam_s6a_air_cb( struct msg **msg, struct avp *avp,
        struct session *session, void *opaque, enum disp_action *act)
{
..
    ogs_plmn_id_t visited_plmn_id;
..
    ret = fd_msg_search_avp(qry, ogs_diam_visited_plmn_id, &avp);
    ogs_assert(ret == 0);
    ret = fd_msg_avp_hdr(avp, &hdr);
    ogs_assert(ret == 0);
    memcpy(&visited_plmn_id, hdr->avp_value->os.data, hdr->avp_value->os.len);
```
2024-04-30 22:25:52 +09:00
Sukchan Lee 048a74005b [SEC] Heap overflow in parse PLMN-ID (#3154)
An assert shall be triggered if sepp_node is corrupted.

```
pwndbg> p *sepp_node
$5 = {
  lnode = {
    prev = 0x0,
    next = 0xaaaac920c638
  },
  receiver = 0xaaaac9230990 "sepp2.localdomain",
  negotiated_security_scheme = OpenAPI_security_capability_TLS,
  target_apiroot_supported = true,
  plmn_id = {{
      mcc1 = 6 '\006',
      mcc2 = 6 '\006',
      mcc3 = 6 '\006',
      mnc1 = 6 '\006',
      mnc2 = 6 '\006',
      mnc3 = 6 '\006'
    } <repeats 12 times>},
  num_of_plmn_id = 6710887,
  target_plmn_id_presence = false,
  target_plmn_id = {
    mcc1 = 0 '\000',
    mcc2 = 0 '\000',
    mcc3 = 0 '\000',
    mnc1 = 0 '\000',
    mnc2 = 0 '\000',
    mnc3 = 0 '\000'
  },
  supported_features = 1,
  sm = {
    init = 0xaaaaada181fc <sepp_handshake_state_initial>,
    fini = 0xaaaaada18390 <sepp_handshake_state_final>,
    state = 0xaaaaada194b4 <sepp_handshake_state_established>
  },
  t_establish_interval = 0xffffa7d6c4e0,
  client = 0xaaaac91af010,
  n32f = {
    client = 0xaaaac91af090
  }
}
pwndbg> p/x sepp_node.num_of_plmn_id
$6 = 0x666667
```
2024-04-30 22:10:45 +09:00
Sukchan Lee f6c0ded7b4 [NSSF] Added POST nnrf-nfm/nf-status-notify
When NSSF was first implemented, nf-status-notify was not required.

This is because there was no need to be notified
if other NFs were registered or de-registered in the NRF.

However, this situation changed with the addition of SEPP.

NSSFs can be notified whenever a SEPP registers or de-registers an NRF.

Therefore, we added nf-status-notify,
which was not implemented when the NSSF was originally created.
2024-04-30 21:35:42 +09:00
Sukchan Lee 819861be2f [DOCS] Update Helm Chars Links (#3173) 2024-04-27 09:18:11 +09:00
Sukchan Lee 4c00edd839 Update document for v2.7.1 2024-04-19 21:24:08 +09:00
Sukchan Lee 426fa3f84a Release v2.7.1 2024-04-19 21:22:24 +09:00
Pau Espin c0a520f32a systemd: network: Add explicit routes towards tundev for UE pool of addresses
When running the open5gs package with systemd network config, the 1st IP address
of the UE pool configured in open5gs-upfd config file for ogstun is
being assigned to the interface through this file.
That was discussed as being a desirable default setup.

However, in the event a user wants a setup where no IP address is
assigned to the tundev, then it's not enough removing the IP address,
because then the implicit routing rules regarding the subnet of the IP
address added automatically by the kernel are also removed.

This patch adds config sections to set up the routing explicitly, with
the aim to get the routing still applied if the user decides to comment
out the IP address, so that packets are still forwarded properly in that
case.

Related: https://osmocom.org/issues/6361
2024-04-19 08:32:19 +09:00
Sukchan Lee d14304461b Oops! Fix the compile error! 2024-04-18 21:32:25 +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
Oliver Smith 7973e45d16 [CORE] logger: add option to disable timestamps
Add an option to disable printing the timestamp. This is useful to not
have duplicate timestamps, when stderr is piped into a logging system
that adds timestamps on its own. For example with systemd's journald:

$ journalctl -u open5gs-smfd
Apr 10 13:25:18 hostname open5gs-smfd[1582]: 04/10 13:25:18.274: [app] INFO: Configuration: '/etc/open5gs/smf.yaml' (../lib/app/ogs-init.c:130)

Configuration change:
```
<OLD Format>
logger:
  file: /var/log/open5gs/smf.log

<NEW Format>
logger:
  file:
    path: /var/log/open5gs/smf.log
```

Example config, to have no timestamps on stderr:
```
logger:
  default:
    timestamp: false
  file:
    path: /var/log/open5gs/smf.log
    timestamp: true
```
2024-04-18 21:08:35 +09:00
Sukchan Lee f960047ccb [SMF/UPF] Follow-up on Pull #3137 (Issues #2975) 2024-04-14 09:19:07 +09:00
Sukchan Lee a6830b30a0 [SMF/UPF] Changes subnet configuration (#2975)
The way subnet is set up has changed as shown below.

```
<OLD Format>
smf:
  session:
    - subnet: 10.45.0.1/16

<NEW Format>
smf:
  session:
    - subnet: 10.45.0.0/16
      gateway: 10.45.0.1
```

For more information, please refer to Pull Request #2975.
2024-04-13 19:31:19 +09:00
Sukchan Lee 2b6369e9d9 [SMF] crash when malformed NAS message (#3132)
A malformed PDU Session Modification Request is sent from UE
after Registration Complete.

```
Crash 1:
04/12 15:00:44.031: [amf] INFO: [imsi-999700000000001:1:11][0:0:NULL] /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify (../src/amf/nsmf-handler.c:837)
04/12 15:00:46.569: [nas] FATAL: ogs_nas_parse_qos_flow_descriptions: Assertion `descriptions->length' failed. (../lib/nas/5gs/types.c:486)
04/12 15:00:46.569: [core] FATAL: backtrace() returned 11 addresses (../lib/core/ogs-abort.c:37)
../src/smf/../../lib/nas/5gs/libogsnas-5gs.so.2(ogs_nas_parse_qos_flow_descriptions+0x162) [0x7e6e7a5a4e5d]
../src/smf/open5gs-smfd(+0x8c6ec) [0x5dd6c333d6ec]
../src/smf/open5gs-smfd(+0x2d69b) [0x5dd6c32de69b]
../src/smf/../../lib/core/libogscore.so.2(ogs_fsm_dispatch+0x119) [0x7e6e7b216c0c]
../src/smf/open5gs-smfd(+0x288b3) [0x5dd6c32d98b3]
../src/smf/../../lib/core/libogscore.so.2(ogs_fsm_dispatch+0x119) [0x7e6e7b216c0c]
../src/smf/open5gs-smfd(+0xf2d8) [0x5dd6c32c02d8]
../src/smf/../../lib/core/libogscore.so.2(+0x1197a) [0x7e6e7b20797a]
/lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7e6e7a094ac3]
/lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7e6e7a126850]
04/12 15:00:46.613: [app] ERROR: Signal-NUM[17] received (Child status change) (../src/main.c:81)
04/12 15:00:46.613: [sbi] WARNING: [92] HTTP/2 stream 19 was not closed cleanly before end of the underlying stream (../lib/sbi/client.c:626)
04/12 15:00:46.613: [scp] WARNING: response_handler() failed [-1] (../src/scp/sbi-path.c:539)
04/12 15:00:46.613: [amf] ERROR: [1:0] No SmContextUpdateError [500] (../src/amf/nsmf-handler.c:866)
04/12 15:00:46.613: [amf] ERROR: AMF_SESS_CLEAR (../src/amf/amf-sm.c:484)
04/12 15:00:46.613: [amf] INFO: [Removed] Number of AMF-Sessions is now 0 (../src/amf/context.c:2551)
04/12 15:00:50.596: [nrf] WARNING: [c466ec64-f8fe-41ee-a888-194dc4363612] No heartbeat (../src/nrf/nrf-sm.c:260)
04/12 15:00:50.596: [nrf] INFO: [c466ec64-f8fe-41ee-a888-194dc4363612] NF de-registered (../src/nrf/nf-sm.c:205)
04/12 15:00:50.596: [sbi] INFO: [c466ec64-f8fe-41ee-a888-194dc4363612:1] NF removed (../lib/sbi/nnrf-handler.c:750)
04/12 15:00:50.596: [sbi] INFO: [c466ec64-f8fe-41ee-a888-194dc4363612:1] NF removed (../lib/sbi/nnrf-handler.c:750)
04/12 15:00:55.094: [pfcp] WARNING: [10] LOCAL  No Reponse. Give up! for step 1 type 1 peer [127.0.0.4]:8805 (../lib/pfcp/xact.c:599)
04/12 15:00:55.094: [upf] WARNING: No Heartbeat from SMF [127.0.0.4]:8805 (../src/upf/pfcp-sm.c:329)
04/12 15:00:55.094: [upf] INFO: PFCP de-associated [127.0.0.4]:8805 (../src/upf/pfcp-sm.c:199)
04/12 15:01:02.599: [pfcp] WARNING: [11] LOCAL  No Reponse. Give up! for step 1 type 5 peer [127.0.0.4]:8805 (../lib/pfcp/xact.c:599)
04/12 15:01:06.098: [upf] WARNING: Retry to association with peer [127.0.0.4]:8805 failed (../src/upf/pfcp-sm.c:107)

Crash 2:
04/12 15:16:39.748: [amf] INFO: [imsi-999700000000001:1:11][0:0:NULL] /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify (../src/amf/nsmf-handler.c:837)
04/12 15:16:42.155: [nas] FATAL: ogs_nas_parse_qos_rules: Assertion `size+sizeof(rule->flow.flags) <= length' failed. (../lib/nas/5gs/types.c:961)
04/12 15:16:42.155: [core] FATAL: backtrace() returned 11 addresses (../lib/core/ogs-abort.c:37)
../src/smf/../../lib/nas/5gs/libogsnas-5gs.so.2(ogs_nas_parse_qos_rules+0x12d1) [0x7d1affbd2d72]
../src/smf/open5gs-smfd(+0x8b446) [0x629a57861446]
../src/smf/open5gs-smfd(+0x2d69b) [0x629a5780369b]
../src/smf/../../lib/core/libogscore.so.2(ogs_fsm_dispatch+0x119) [0x7d1affd05c0c]
../src/smf/open5gs-smfd(+0x288b3) [0x629a577fe8b3]
../src/smf/../../lib/core/libogscore.so.2(ogs_fsm_dispatch+0x119) [0x7d1affd05c0c]
../src/smf/open5gs-smfd(+0xf2d8) [0x629a577e52d8]
../src/smf/../../lib/core/libogscore.so.2(+0x1197a) [0x7d1affcf697a]
/lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7d1afea94ac3]
/lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7d1afeb26850]
04/12 15:16:42.199: [sbi] WARNING: [92] HTTP/2 stream 13 was not closed cleanly before end of the underlying stream (../lib/sbi/client.c:626)
04/12 15:16:42.199: [scp] WARNING: response_handler() failed [-1] (../src/scp/sbi-path.c:539)
04/12 15:16:42.199: [app] ERROR: Signal-NUM[17] received (Child status change) (../src/main.c:81)
04/12 15:16:42.200: [amf] ERROR: [1:0] No SmContextUpdateError [500] (../src/amf/nsmf-handler.c:866)
04/12 15:16:42.200: [amf] ERROR: AMF_SESS_CLEAR (../src/amf/amf-sm.c:484)
04/12 15:16:42.200: [amf] INFO: [Removed] Number of AMF-Sessions is now 0 (../src/amf/context.c:2551)
04/12 15:16:49.858: [nrf] WARNING: [23f1aee2-f901-41ee-a488-85a58e1e3420] No heartbeat (../src/nrf/nrf-sm.c:260)
04/12 15:16:49.858: [nrf] INFO: [23f1aee2-f901-41ee-a488-85a58e1e3420] NF de-registered (../src/nrf/nf-sm.c:205)
04/12 15:16:49.859: [sbi] INFO: [23f1aee2-f901-41ee-a488-85a58e1e3420:1] NF removed (../lib/sbi/nnrf-handler.c:750)
04/12 15:16:49.859: [sbi] INFO: [23f1aee2-f901-41ee-a488-85a58e1e3420:1] NF removed (../lib/sbi/nnrf-handler.c:750)
04/12 15:16:59.364: [pfcp] WARNING: [5] LOCAL  No Reponse. Give up! for step 1 type 1 peer [127.0.0.4]:8805 (../lib/pfcp/xact.c:599)
04/12 15:16:59.364: [upf] WARNING: No Heartbeat from SMF [127.0.0.4]:8805 (../src/upf/pfcp-sm.c:329)
04/12 15:16:59.364: [upf] INFO: PFCP de-associated [127.0.0.4]:8805 (../src/upf/pfcp-sm.c:199)
```

So, I've fixed it.
2024-04-13 15:03:09 +09:00
Sukchan Lee 3cfa8ba301 [AMF/MME] NAS message in an invaild state (#3131)
In InitialUEMessage, send a NAS message with a message type
other than Registration Request, Deregistration Request, or Service Request,
the following messages from UE will not be accepted.

We found this issue in not only the initial state but multiple states.
We believe if an attacker has the ability to inject a NAS message to the core,
it can perform a DoS attack on the victim UE.

So, I've fixed that The MME/AMF deletes MME_UE_S1AP_ID/AMF_UE_NGAP_ID,
and will not accept any following messages from the UE.
2024-04-13 13:25:09 +09:00
203 changed files with 2695 additions and 1346 deletions

View File

@ -2,51 +2,51 @@ name: Meson Continuous Integration
on: [push, pull_request]
jobs:
macos-latest:
name: Build and Test on MacOS Latest
runs-on: macos-latest
steps:
# - name: Install MongoDB with Package Manager
# macos-latest:
# name: Build and Test on MacOS Latest
# runs-on: macos-latest
# steps:
## - name: Install MongoDB with Package Manager
## run: |
## brew tap mongodb/brew
## brew install mongodb-community
## brew services start mongodb-community
# - name: Create the TUN device with the interface name `ogstun`.
# run: |
# brew tap mongodb/brew
# brew install mongodb-community
# brew services start mongodb-community
- name: Create the TUN device with the interface name `ogstun`.
run: |
sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.6 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.7 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.8 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.9 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255
- name: Install the dependencies for building the source code.
run: brew install mongo-c-driver libidn libmicrohttpd nghttp2 bison libusrsctp libtins talloc meson
- name: Check out repository code
uses: actions/checkout@main
- name: Setup Meson Build
run: PATH="/usr/local/opt/bison/bin:$PATH" PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" meson setup build
env:
CC: gcc
- name : Build Open5GS
run: ninja -C build
- name: Test Open5GS
run: sudo meson test -C build -v crypt unit
# sudo ifconfig lo0 alias 127.0.0.2 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.3 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.4 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.5 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.6 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.7 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.8 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.9 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.10 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.11 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.12 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.13 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.14 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.15 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.16 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.17 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.18 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
# sudo ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255
# - name: Install the dependencies for building the source code.
# run: brew install mongo-c-driver libidn libmicrohttpd nghttp2 bison libusrsctp libtins talloc meson
# - name: Check out repository code
# uses: actions/checkout@main
# - name: Setup Meson Build
# run: PATH="/usr/local/opt/bison/bin:$PATH" PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH" meson setup build
# env:
# CC: gcc
# - name : Build Open5GS
# run: ninja -C build
# - name: Test Open5GS
# run: sudo meson test -C build -v crypt unit
#
ubuntu-latest:
name: Build and Test on Ubuntu Latest
runs-on: ubuntu-latest

View File

@ -109,8 +109,10 @@ smf:
server:
- address: 127.0.0.4
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -189,8 +191,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -142,8 +142,10 @@ smf:
server:
- address: 127.0.0.4
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -219,8 +221,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -112,8 +112,10 @@ smf:
- address: 127.0.1.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -207,8 +209,10 @@ upf:
server:
- address: 127.0.1.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.1.7

View File

@ -112,8 +112,10 @@ smf:
- address: 127.0.2.4
port: 9090
session:
- subnet: 10.46.0.1/16
- subnet: 2001:db8:babe::1/48
- subnet: 10.46.0.0/16
gateway: 10.46.0.1
- subnet: 2001:db8:babe::/48
gateway: 2001:db8:babe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -207,9 +209,11 @@ upf:
server:
- address: 127.0.2.7
session:
- subnet: 10.46.0.1/16
- subnet: 10.46.0.0/16
gateway: 10.46.0.1
dev: ogstun2
- subnet: 2001:db8:babe::1/48
- subnet: 2001:db8:babe::/48
gateway: 2001:db8:babe::1
dev: ogstun2
metrics:
server:

View File

@ -112,8 +112,10 @@ smf:
- address: 127.0.3.4
port: 9090
session:
- subnet: 10.47.0.1/16
- subnet: 2001:db8:face::1/48
- subnet: 10.47.0.0/16
gateway: 10.47.0.1
- subnet: 2001:db8:face::/48
gateway: 2001:db8:face::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -207,9 +209,11 @@ upf:
server:
- address: 127.0.3.7
session:
- subnet: 10.47.0.1/16
- subnet: 10.47.0.0/16
gateway: 10.47.0.1
dev: ogstun3
- subnet: 2001:db8:face::1/48
- subnet: 2001:db8:face::/48
gateway: 2001:db8:face::1
dev: ogstun3
metrics:
server:

View File

@ -113,8 +113,10 @@ smf:
- address: 127.0.1.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -208,8 +210,10 @@ upf:
server:
- address: 127.0.1.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.1.7

View File

@ -113,8 +113,10 @@ smf:
- address: 127.0.2.4
port: 9090
session:
- subnet: 10.46.0.1/16
- subnet: 2001:db8:babe::1/48
- subnet: 10.46.0.0/16
gateway: 10.46.0.1
- subnet: 2001:db8:babe::/48
gateway: 2001:db8:babe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -208,9 +210,11 @@ upf:
server:
- address: 127.0.2.7
session:
- subnet: 10.46.0.1/16
- subnet: 10.46.0.0/16
gateway: 10.46.0.1
dev: ogstun2
- subnet: 2001:db8:babe::1/48
- subnet: 2001:db8:babe::/48
gateway: 2001:db8:babe::1
dev: ogstun2
metrics:
server:

View File

@ -113,8 +113,10 @@ smf:
- address: 127.0.3.4
port: 9090
session:
- subnet: 10.47.0.1/16
- subnet: 2001:db8:face::1/48
- subnet: 10.47.0.0/16
gateway: 10.47.0.1
- subnet: 2001:db8:face::/48
gateway: 2001:db8:face::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -208,9 +210,11 @@ upf:
server:
- address: 127.0.3.7
session:
- subnet: 10.47.0.1/16
- subnet: 10.47.0.0/16
gateway: 10.47.0.1
dev: ogstun3
- subnet: 2001:db8:face::1/48
- subnet: 2001:db8:face::/48
gateway: 2001:db8:face::1
dev: ogstun3
metrics:
server:

View File

@ -118,8 +118,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -203,8 +205,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -118,8 +118,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -203,8 +205,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -116,8 +116,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -198,8 +200,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -118,8 +118,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -203,8 +205,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -116,8 +116,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -198,8 +200,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -118,8 +118,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -203,8 +205,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -118,8 +118,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -203,8 +205,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -118,8 +118,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -203,8 +205,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -116,8 +116,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -198,8 +200,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -110,8 +110,10 @@ smf:
server:
- address: 127.0.0.4
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -192,8 +194,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/amf.log
file:
path: @localstatedir@/log/open5gs/amf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/ausf.log
file:
path: @localstatedir@/log/open5gs/ausf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/bsf.log
file:
path: @localstatedir@/log/open5gs/bsf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,6 +1,7 @@
db_uri: mongodb://localhost/open5gs
logger:
file: @localstatedir@/log/open5gs/hss.log
file:
path: @localstatedir@/log/open5gs/hss.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/mme.log
file:
path: @localstatedir@/log/open5gs/mme.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/nrf.log
file:
path: @localstatedir@/log/open5gs/nrf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/nssf.log
file:
path: @localstatedir@/log/open5gs/nssf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,6 +1,7 @@
db_uri: mongodb://localhost/open5gs
logger:
file: @localstatedir@/log/open5gs/pcf.log
file:
path: @localstatedir@/log/open5gs/pcf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,59 +1,7 @@
db_uri: mongodb://localhost/open5gs
db_json:
default:
af:
ambr:
up: 10000
down: 10000
gmbr:
up: 1000
down: 1000
qci: 4
normal:
ambr:
up: 10000
down: 10000
gmbr:
up: 10000
down: 10000
qci: 5
charging_profiles:
af:
- 1
- 2
- 3
- 4
normal:
- 1
- 2
- 3
- 4
dir:
normal: "/tmp/profiles"
af: "/tmp/profiles_af"
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Default values are used, so no configuration is required)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# logger:
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# logger:
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# logger:
# level: trace
# domain: core,sbi,ausf,event,tlv,mem,sock
#
logger:
file: @localstatedir@/log/open5gs/pcrf.log
file:
path: @localstatedir@/log/open5gs/pcrf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/scp.log
file:
path: @localstatedir@/log/open5gs/scp.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/sepp1.log
file:
path: @localstatedir@/log/open5gs/sepp1.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/sepp2.log
file:
path: @localstatedir@/log/open5gs/sepp2.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/sgwc.log
file:
path: @localstatedir@/log/open5gs/sgwc.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/sgwu.log
file:
path: @localstatedir@/log/open5gs/sgwu.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/smf.log
file:
path: @localstatedir@/log/open5gs/smf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:
@ -34,8 +35,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -327,23 +330,26 @@ smf:
# o Specific DNN/APN(e.g 'ims') uses 10.46.0.1/16, 2001:db8:babe::1/48
# (If the UE has unknown DNN/APN(not internet/ims), SMF/UPF will crash.)
# session:
# - subnet: 10.45.0.1/16
# - subnet: 10.45.0.0/16
# gateway: 10.45.0.1
# dnn: internet
# - subnet: 2001:db8:cafe::1/48
# - subnet: 2001:db8:cafe::/48
# dnn: internet
# - subnet: 10.46.0.1/16
# - subnet: 10.46.0.0/16
# gateway: 10.46.0.1
# dnn: ims
# - subnet: 2001:db8:babe::1/48
# - subnet: 2001:db8:babe::/48
# dnn: ims
#
# o Pool Range
# session:
# - subnet: 10.45.0.1/16
# - subnet: 10.45.0.0/16
# gateway: 10.45.0.1
# range:
# - 10.45.0.100-10.45.0.200
# - 10.45.1.100-
# - -10.45.0.200
# - subnet: 2001:db8:cafe::1/48
# - subnet: 2001:db8:cafe::/48
# range:
# - 2001:db8:cafe:a0::0-2001:db8:cafe:b0::0
# - 2001:db8:cafe:c0::0-2001:db8:cafe:d0::0

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/udm.log
file:
path: @localstatedir@/log/open5gs/udm.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,6 +1,7 @@
db_uri: mongodb://localhost/open5gs
logger:
file: @localstatedir@/log/open5gs/udr.log
file:
path: @localstatedir@/log/open5gs/udr.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:

View File

@ -1,5 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/upf.log
file:
path: @localstatedir@/log/open5gs/upf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:
@ -18,8 +19,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7
@ -70,14 +73,16 @@ upf:
# $ sudo ip addr add 2001:db8:babe::1/48 dev ogstun3
#
# session:
# - subnet: 10.45.0.1/16
# - subnet: 10.45.0.0/16
# gateway: 10.45.0.1
# dnn: internet
# - subnet: 2001:db8:cafe::1/48
# - subnet: 2001:db8:cafe::/48
# dnn: internet
# dev: ogstun2
# - subnet: 10.46.0.1/16
# - subnet: 10.46.0.0/16
# gateway: 10.46.0.1
# dnn: ims
# dev: ogstun3
# - subnet: 2001:db8:babe::1/48
# - subnet: 2001:db8:babe::/48
# dnn: ims
# dev: ogstun3

View File

@ -118,8 +118,10 @@ smf:
- address: 127.0.0.4
port: 9090
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -203,8 +205,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -110,8 +110,10 @@ smf:
server:
- address: 127.0.0.4
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -194,8 +196,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -107,8 +107,10 @@ smf:
server:
- address: 127.0.0.4
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -184,8 +186,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -5,6 +5,14 @@ Name=ogstun
Address=10.45.0.1/16
Address=2001:db8:cafe::1/48
[Route]
Gateway=0.0.0.0
Destination=10.45.0.0/16
[Route]
Gateway=::
Destination=2001:db8:cafe::0/48
[Link]
MTUBytes=1400
RequiredForOnline=false

View File

@ -107,8 +107,10 @@ smf:
server:
- address: 127.0.0.4
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
dns:
- 8.8.8.8
- 8.8.4.4
@ -187,8 +189,10 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
gateway: 2001:db8:cafe::1
metrics:
server:
- address: 127.0.0.7

View File

@ -110,8 +110,9 @@ smf:
server:
- address: 127.0.0.4
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
dns:
- 8.8.8.8
- 8.8.4.4
@ -193,8 +194,9 @@ upf:
server:
- address: 127.0.0.7
session:
- subnet: 10.45.0.1/16
- subnet: 2001:db8:cafe::1/48
- subnet: 10.45.0.0/16
gateway: 10.45.0.1
- subnet: 2001:db8:cafe::/48
metrics:
server:
- address: 127.0.0.7

31
debian/changelog vendored
View File

@ -1,15 +1,32 @@
open5gs (2.7.0~sysmocom2) unstable; urgency=medium
open5gs (2.7.1) unstable; urgency=medium
* Rebase on open5gs.git main of 2024-04-09
* Bug Fixed
-- Oliver Smith <osmith@sysmocom.de> Tue, 09 Apr 2024 14:05:56 +0200
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:21:46 +0900
open5gs (2.7.0sysmocom1) unstable; urgency=medium
open5gs (2.7.1~mantic) mantic; urgency=medium
* Remove mongodb dependency
* Use default APN if none could be found
* Bug Fixed
-- Daniel Willmann <dwillmann@sysmocom.de> Mon, 29 Jan 2024 20:17:10 +0100
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:18:53 +0900
open5gs (2.7.1~bionic) bionic; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:16:21 +0900
open5gs (2.7.1~jammy) jammy; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:11:30 +0900
open5gs (2.7.1~focal) focal; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Fri, 19 Apr 2024 21:08:46 +0900
open5gs (2.7.0) unstable; urgency=medium

20
debian/control vendored
View File

@ -14,6 +14,7 @@ Build-Depends: debhelper (>= 11),
libgcrypt-dev,
libssl-dev,
libidn11-dev,
libmongoc-dev,
libbson-dev,
libsctp-dev,
libyaml-dev,
@ -120,11 +121,29 @@ Description: UPF (User Plane Function)
.
This package provides the UPF (User Plane Function)
Package: open5gs-hss
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
mongodb-org | mongodb,
open5gs-common (= ${binary:Version})
Description: HSS (Home Subscriber Server)
Open5GS is a C-language implementation of 5G Core and EPC
Packet Core, i.e. the core network of an NR/LTE network (Release-17)
.
This package provides the HSS (Home Subscriber Server) element of the
EPC, i.e. the central database of mobile network subscribers, with
their IMSI, MSISDN, cryptographic key materials, service subscription
information, etc. It implements the S6a interface towards the MME
using the DIAMETER protocol.
Package: open5gs-pcrf
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
mongodb-org | mongodb,
open5gs-common (= ${binary:Version})
Description: PCRF (Policy and Charging Rules Function)
Open5GS is a C-language implementation of 5G Core and EPC
@ -254,6 +273,7 @@ Depends: ${misc:Depends},
open5gs-amf (= ${binary:Version}),
open5gs-sgwu (= ${binary:Version}),
open5gs-upf (= ${binary:Version}),
open5gs-hss (= ${binary:Version}),
open5gs-pcrf (= ${binary:Version}),
open5gs-nrf (= ${binary:Version}),
open5gs-scp (= ${binary:Version}),

6
debian/open5gs-hss.install vendored Normal file
View File

@ -0,0 +1,6 @@
usr/bin/open5gs-hssd
configs/freeDiameter/hss.* etc/freeDiameter
configs/open5gs/hss.yaml etc/open5gs
configs/open5gs/tls/hss.key etc/open5gs/tls
configs/open5gs/tls/hss.crt etc/open5gs/tls
configs/systemd/open5gs-hssd.service lib/systemd/system

View File

@ -13,7 +13,7 @@ RUN apk update && \
sudo
ARG username=acetcom
RUN adduser -u 1000 acetcom -D && \
RUN adduser -u 2000 acetcom -D && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username}

View File

@ -27,7 +27,7 @@ RUN apt-get update && \
COPY setup.sh /root
ARG username=acetcom
RUN useradd -m --uid=1000 ${username} && \
RUN useradd -m --uid=2000 ${username} && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username}

View File

@ -16,7 +16,7 @@ RUN dnf -y install \
COPY setup.sh /root
ARG username=acetcom
RUN useradd -m --uid=1000 ${username} && \
RUN useradd -m --uid=2000 ${username} && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username}

View File

@ -33,7 +33,7 @@ RUN apt-get update && \
COPY setup.sh /root
ARG username=acetcom
RUN useradd -m --uid=1000 ${username} && \
RUN useradd -m --uid=2000 ${username} && \
echo "${username} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${username} && \
chmod 0440 /etc/sudoers.d/${username}

View File

@ -428,6 +428,34 @@ $ sudo systemctl restart open5gs-amfd
$ sudo systemctl restart open5gs-upfd
```
#### Configure logging
The Open5GS components log to `/var/log/open5gs/*.log` and to `stderr` by
default.
##### Avoid duplicate timestamps in journalctl
Open5GS adds timestamps to each log line in the log file, and on `stderr`. If
you run Open5GS with systemd and prefer looking at the logs with `journalctl`,
then each line will have two timestamps. To fix this, disable the timestamp for
`stderr` with the following configuration change:
```diff
diff --git a/configs/open5gs/mme.yaml.in b/configs/open5gs/mme.yaml.in
index 87c251b9d..599032b8a 100644
--- a/configs/open5gs/mme.yaml.in
+++ b/configs/open5gs/mme.yaml.in
@@ -1,6 +1,9 @@
logger:
+ default:
+ timestamp: false
file:
path: /var/log/open5gs/mme.log
+ timestamp: true
# level: info # fatal|error|warn|info(default)|debug|trace
global:
```
#### Register Subscriber Information
---

View File

@ -169,7 +169,8 @@ index a70143f08..e0dba560c 100644
+++ b/configs/open5gs/amf.yaml.in
@@ -1,6 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/amf.log
file:
path: @localstatedir@/log/open5gs/amf.log
-# level: info # fatal|error|warn|info(default)|debug|trace
+ level: debug

View File

@ -485,7 +485,8 @@ index a70143f08..e0dba560c 100644
+++ b/configs/open5gs/amf.yaml.in
@@ -1,6 +1,6 @@
logger:
file: @localstatedir@/log/open5gs/amf.log
file:
path: @localstatedir@/log/open5gs/amf.log
-# level: info # fatal|error|warn|info(default)|debug|trace
+ level: debug

View File

@ -92,7 +92,8 @@ NRF shall follow TS23.003(28.3.2.3.2 Format of NRF FQDN) for routing.
```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/h-nrf.yaml
logger:
file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-nrf.log
file:
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-nrf.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:
@ -116,7 +117,8 @@ EOF'
```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/h-scp.yaml
logger:
file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-scp.log
file:
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/h-scp.log
# level: info # fatal|error|warn|info(default)|debug|trace
global:
@ -302,7 +304,8 @@ $ diff -u ./install/etc/open5gs/pcf.yaml.old ./install/etc/open5gs/pcf.yaml
@@ -1,4 +1,3 @@
-db_uri: mongodb://localhost/open5gs
logger:
file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log
file:
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log
# level: info # fatal|error|warn|info(default)|debug|trace
@@ -22,6 +21,29 @@
server:
@ -646,7 +649,8 @@ For now we will set up SEPP without using TLS.
```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml
logger:
file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
file:
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
# level: info # fatal|error|warn|info(default)|debug|trace
max:
@ -966,7 +970,8 @@ For now we will set up SEPP without using TLS.
```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml
logger:
file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
file:
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
# level: info # fatal|error|warn|info(default)|debug|trace
max:
@ -1286,7 +1291,8 @@ For now we will set up SEPP without using TLS.
```bash
$ sh -c 'cat << EOF > ./install/etc/open5gs/sepp.yaml
logger:
file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
file:
path: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sepp.log
# level: info # fatal|error|warn|info(default)|debug|trace
max:

View File

@ -75,8 +75,10 @@ head_inline: "<style> ul { padding-bottom: 1em; } </style>"
- [srsRAN with eUPF(eBPF/XDP UPF)](https://github.com/s5uishida/open5gs_epc_srsran_eupf_sample_config)
- @gradiant helm charts
- [Open5GS EPC and SRS LTE in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-srslte.html)
- [Open5GS NGC and UERANSIM in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-ueransim-gnb.html)
- [Open5GS NGC and OpenAirInterface GNB with ettus USRP in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-oaignb.html)
- [Open5GS EPC and SRS ENB with ettus USRP in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-srsenb.html)
- [Open5GS with Service Communication Proxy in kubernetes](https://gradiant.github.io/openverso-charts/open5gs-scp.html)
- [Open5GS and srsRAN-5G in kubernetes](https://gradiant.github.io/5g-charts/open5gs-srsran-5g-zmq.html)
- [Open5GS and srsLTE in kubernetes](https://gradiant.github.io/5g-charts/open5gs-srslte.html)
- [Open5GS and UERANSIM](https://gradiant.github.io/5g-charts/open5gs-ueransim-gnb.html)
- [Open5GS and PacketRusher](https://gradiant.github.io/5g-charts/open5gs-packetrusher.html)
- [Open5GS and OAI-GNB](https://gradiant.github.io/5g-charts/open5gs-oaignb.html)
- [Open5GS and srsenb](https://gradiant.github.io/5g-charts/open5gs-srsenb.html)
- [Open5GS with SCP(Service Communication Proxy](https://gradiant.github.io/5g-charts/open5gs-scp.html)

View File

@ -25,7 +25,8 @@ Example of sgw.yaml to use this feature:
```
logger:
file: /var/log/open5gs/sgw.log
file:
path: /var/log/open5gs/sgw.log
level: debug
parameter:

View File

@ -0,0 +1,15 @@
---
title: "v2.7.1 - Bug Fixed"
date: 2024-04-19 21:23:00 +0900
categories:
- Release
tags:
- News
- Release
head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>"
---
See [Release Note](https://github.com/open5gs/open5gs/releases/tag/v2.7.1)
Download -- [v2.7.1.tar.gz](https://github.com/open5gs/open5gs/archive/v2.7.1.tar.gz)
{: .notice--info}

View File

@ -408,8 +408,8 @@ static int local_conf_prepare(void)
* Heartbeat Interval(e.g: 10 seconds) + No Heartbeat Margin(1 second) */
local_conf.time.nf_instance.no_heartbeat_margin = 1;
/* 3600 seconds = 1 hour */
local_conf.time.nf_instance.validity_duration = 3600;
/* 30 seconds */
local_conf.time.nf_instance.validity_duration = 30;
/* 86400 seconds = 1 day */
local_conf.time.subscription.validity_duration = 86400;

View File

@ -36,10 +36,15 @@ typedef struct ogs_app_context_s {
const char *db_uri;
struct {
ogs_log_ts_e timestamp;
} logger_default;
struct {
const char *file;
const char *level;
const char *domain;
ogs_log_ts_e timestamp;
} logger;
ogs_queue_t *queue;

View File

@ -114,6 +114,9 @@ int ogs_app_initialize(
ogs_app()->logger.domain, ogs_app()->logger.level);
if (rv != OGS_OK) return rv;
ogs_log_set_timestamp(ogs_app()->logger_default.timestamp,
ogs_app()->logger.timestamp);
/**************************************************************************
* Stage 5 : Setup Database Module
*/
@ -254,6 +257,57 @@ static int context_validation(void)
return OGS_OK;
}
static void parse_config_logger_file(ogs_yaml_iter_t *logger_iter,
const char *logger_key)
{
ogs_yaml_iter_t iter;
/* Legacy format:
* logger:
* file: /var/log/open5gs/mme.log */
if (!strcmp(logger_key, "file") && ogs_yaml_iter_has_value(logger_iter)) {
ogs_app()->logger.file = ogs_yaml_iter_value(logger_iter);
ogs_warn("Please change the configuration file as below.");
ogs_log_print(OGS_LOG_WARN, "\n<OLD Format>\n");
ogs_log_print(OGS_LOG_WARN, "logger:\n");
ogs_log_print(OGS_LOG_WARN, " file: %s\n", ogs_app()->logger.file);
ogs_log_print(OGS_LOG_WARN, "\n<NEW Format>\n");
ogs_log_print(OGS_LOG_WARN, "logger:\n");
ogs_log_print(OGS_LOG_WARN, " file:\n");
ogs_log_print(OGS_LOG_WARN, " path: %s\n", ogs_app()->logger.file);
ogs_log_print(OGS_LOG_WARN, "\n\n\n");
return;
}
/* Current format:
* logger:
* default:
* timestamp: false
* file:
* path: /var/log/open5gs/mme.log
* timestamp: true */
ogs_yaml_iter_recurse(logger_iter, &iter);
while (ogs_yaml_iter_next(&iter)) {
const char *key = ogs_yaml_iter_key(&iter);
ogs_assert(key);
if (!strcmp(key, "timestamp")) {
ogs_log_ts_e ts = ogs_yaml_iter_bool(&iter)
? OGS_LOG_TS_ENABLED
: OGS_LOG_TS_DISABLED;
if (!strcmp(logger_key, "default")) {
ogs_app()->logger_default.timestamp = ts;
} else if (!strcmp(logger_key, "file")) {
ogs_app()->logger.timestamp = ts;
}
} else if (!strcmp(key, "path")) {
if (!strcmp(logger_key, "file")) {
ogs_app()->logger.file = ogs_yaml_iter_value(&iter);
}
}
}
}
static int parse_config(void)
{
int rv;
@ -278,9 +332,8 @@ static int parse_config(void)
while (ogs_yaml_iter_next(&logger_iter)) {
const char *logger_key = ogs_yaml_iter_key(&logger_iter);
ogs_assert(logger_key);
if (!strcmp(logger_key, "file")) {
ogs_app()->logger.file = ogs_yaml_iter_value(&logger_iter);
} else if (!strcmp(logger_key, "level")) {
parse_config_logger_file(&logger_iter, logger_key);
if (!strcmp(logger_key, "level")) {
ogs_app()->logger.level =
ogs_yaml_iter_value(&logger_iter);
} else if (!strcmp(logger_key, "domain")) {

View File

@ -178,6 +178,34 @@ const char *ogs_yaml_iter_value(ogs_yaml_iter_t *iter)
return NULL;
}
int ogs_yaml_iter_has_value(ogs_yaml_iter_t *iter)
{
ogs_assert(iter);
ogs_assert(iter->document);
ogs_assert(iter->node);
if (iter->node->type == YAML_SCALAR_NODE) {
return 1;
} else if (iter->node->type == YAML_MAPPING_NODE) {
yaml_node_t *node = NULL;
ogs_assert(iter->pair);
node = yaml_document_get_node(iter->document, iter->pair->value);
ogs_assert(node);
return node->type == YAML_SCALAR_NODE;
} else if (iter->node->type == YAML_SEQUENCE_NODE) {
yaml_node_t *node = NULL;
ogs_assert(iter->item);
node = yaml_document_get_node(iter->document, *iter->item);
ogs_assert(node);
return node->type == YAML_SCALAR_NODE;
}
ogs_assert_if_reached();
return 0;
}
int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter)
{
const char *v = ogs_yaml_iter_value(iter);

View File

@ -59,6 +59,7 @@ void ogs_yaml_iter_recurse(ogs_yaml_iter_t *parent, ogs_yaml_iter_t *iter);
int ogs_yaml_iter_type(ogs_yaml_iter_t *iter);
const char *ogs_yaml_iter_key(ogs_yaml_iter_t *iter);
const char *ogs_yaml_iter_value(ogs_yaml_iter_t *iter);
int ogs_yaml_iter_has_value(ogs_yaml_iter_t *iter);
int ogs_yaml_iter_bool(ogs_yaml_iter_t *iter);
#ifdef __cplusplus

View File

@ -340,6 +340,28 @@ void ogs_log_set_mask_level(const char *_mask, ogs_log_level_e level)
}
}
void ogs_log_set_timestamp(ogs_log_ts_e ts_default, ogs_log_ts_e ts_file)
{
ogs_log_t *log;
if (ts_default == OGS_LOG_TS_UNSET)
ts_default = OGS_LOG_TS_ENABLED;
if (ts_file == OGS_LOG_TS_UNSET)
ts_file = ts_default;
ogs_list_for_each(&log_list, log) {
switch (log->type) {
case OGS_LOG_FILE_TYPE:
log->print.timestamp = (ts_file == OGS_LOG_TS_ENABLED);
break;
default:
log->print.timestamp = (ts_default == OGS_LOG_TS_ENABLED);
break;
}
}
}
static ogs_log_level_e ogs_log_level_from_string(const char *string)
{
ogs_log_level_e level = OGS_ERROR;

View File

@ -64,6 +64,12 @@ typedef enum {
OGS_LOG_FULL = OGS_LOG_TRACE,
} ogs_log_level_e;
typedef enum {
OGS_LOG_TS_UNSET,
OGS_LOG_TS_ENABLED,
OGS_LOG_TS_DISABLED,
} ogs_log_ts_e;
typedef struct ogs_log_s ogs_log_t;
typedef struct ogs_log_domain_s ogs_log_domain_t;
@ -90,6 +96,7 @@ void ogs_log_install_domain(int *domain_id,
int ogs_log_config_domain(const char *domain, const char *level);
void ogs_log_set_mask_level(const char *mask, ogs_log_level_e level);
void ogs_log_set_timestamp(ogs_log_ts_e ts_default, ogs_log_ts_e ts_file);
void ogs_log_vprintf(ogs_log_level_e level, int id,
ogs_err_t err, const char *file, int line, const char *func,

View File

@ -19,7 +19,6 @@
#include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data)
{
@ -203,15 +202,3 @@ out:
return rv;
}
#else /* OGS_DBI_WITH_MONGODB */
int ogs_dbi_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data)
{
return OGS_ERROR;
}
int ogs_dbi_ims_data(char *supi, ogs_ims_data_t *ims_data)
{
return OGS_ERROR;
}
#endif

View File

@ -25,6 +25,9 @@ libdbi_sources = files('''
session.c
ims.c
'''.split())
libmongoc_dep = dependency('libmongoc-1.0')
libdbi_inc = include_directories('.')
libdbi = library('ogsdbi',
@ -32,10 +35,10 @@ libdbi = library('ogsdbi',
version : libogslib_version,
c_args : '-DOGS_DBI_COMPILATION',
include_directories : [libdbi_inc, libinc],
dependencies : [libproto_dep],
dependencies : [libproto_dep, libmongoc_dep],
install : true)
libdbi_dep = declare_dependency(
link_with : libdbi,
include_directories : [libdbi_inc, libinc],
dependencies : [libproto_dep])
dependencies : [libproto_dep, libmongoc_dep])

View File

@ -1,34 +0,0 @@
/*
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MESON_DUMMY_H
#define MESON_DUMMY_H
#ifdef __cplusplus
extern "C" {
#endif
struct dummy_bson;
typedef struct dummy_bson bson_t;
#ifdef __cplusplus
}
#endif
#endif /* MESON_DUMMY_H */

View File

@ -17,14 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <mongoc.h>
#include "ogs-dbi.h"
int __ogs_dbi_domain;
#ifdef OGS_DBI_WITH_MONGODB
#include <mongoc.h>
static ogs_mongoc_t self;
/*
@ -222,28 +220,3 @@ int ogs_dbi_collection_watch_init(void)
return OGS_ERROR;
#endif
}
#else /* OGS_DBI_WITH_MONGODB */
int ogs_mongoc_init(const char *db_uri)
{
return OGS_ERROR;
}
void ogs_mongoc_final(void)
{
}
ogs_mongoc_t *ogs_mongoc(void)
{
return NULL;
}
int ogs_dbi_init(const char *db_uri)
{
return OGS_OK;
}
void ogs_dbi_final()
{
}
#endif

View File

@ -24,8 +24,7 @@
#ifndef OGS_MONGOC_H
#define OGS_MONGOC_H
/* STUB to disable building with mongodb (OS#6215) */
#define MONGOC_CHECK_VERSION(a, b, c) false
#include <mongoc.h>
#ifdef __cplusplus
extern "C" {

View File

@ -19,7 +19,6 @@
#include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data)
{
@ -504,27 +503,3 @@ out:
return rv;
}
#else /* OGS_DBI_WITH_MONGODB */
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data)
{
ogs_session_t *session = &session_data->session;
ogs_qos_t *qos = &session->qos;
session->name = ogs_strndup("staticprof", strlen("foobar"));
/* check if have to set type */
session->ambr.downlink = 300 * 1024 * 1024;
session->ambr.uplink = 150 * 1024 * 1024;
session->qos.index = OGS_QOS_INDEX_5;
session->qos.arp.priority_level = 1;
session->qos.mbr.downlink = 10;
session->qos.mbr.uplink = 10;
session->qos.gbr.downlink = 10;
session->qos.gbr.uplink = 10;
return OGS_OK;
}
#endif /* OGS_DBI_WITH_MONGODB */

View File

@ -19,7 +19,6 @@
#include "ogs-dbi.h"
#ifdef OGS_DBI_WITH_MONGODB
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
{
int rv = OGS_OK;
@ -817,31 +816,3 @@ out:
return rv;
}
#else
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info)
{
return OGS_ERROR;
}
int ogs_dbi_update_sqn(char *supi, uint64_t sqn)
{
return OGS_ERROR;
}
int ogs_dbi_update_imeisv(char *supi, char *imeisv)
{
return OGS_ERROR;
}
int ogs_dbi_increment_sqn(char *supi)
{
return OGS_ERROR;
}
int ogs_dbi_subscription_data(char *supi,
ogs_subscription_data_t *subscription_data)
{
return OGS_ERROR;
}
#endif /* OGS_DBI_WITH_MONGODB */

View File

@ -629,7 +629,11 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size++;
if (uli->flags.cgi) {
ogs_assert(size + sizeof(uli->cgi) <= octet->len);
if (size + sizeof(uli->cgi) > octet->len) {
ogs_error("size[%d]+sizeof(uli->cgi)[%d] > IE Length[%d]",
size, (int)sizeof(uli->cgi), octet->len);
return 0;
}
memcpy(&uli->cgi,
(unsigned char *)octet->data + size, sizeof(uli->cgi));
uli->cgi.lac = be16toh(uli->cgi.lac);
@ -637,7 +641,11 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size += sizeof(uli->cgi);
}
if (uli->flags.sai) {
ogs_assert(size + sizeof(uli->sai) <= octet->len);
if (size + sizeof(uli->sai) > octet->len) {
ogs_error("size[%d]+sizeof(uli->sai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->sai), octet->len);
return 0;
}
memcpy(&uli->sai,
(unsigned char *)octet->data + size, sizeof(uli->sai));
uli->sai.lac = be16toh(uli->sai.lac);
@ -645,7 +653,11 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size += sizeof(uli->sai);
}
if (uli->flags.rai) {
ogs_assert(size + sizeof(uli->rai) <= octet->len);
if (size + sizeof(uli->rai) > octet->len) {
ogs_error("size[%d]+sizeof(uli->lai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->lai), octet->len);
return 0;
}
memcpy(&uli->rai,
(unsigned char *)octet->data + size, sizeof(uli->rai));
uli->rai.lac = be16toh(uli->rai.lac);
@ -653,28 +665,44 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
size += sizeof(uli->rai);
}
if (uli->flags.tai) {
ogs_assert(size + sizeof(uli->tai) <= octet->len);
if (size + sizeof(uli->tai) > octet->len) {
ogs_error("size[%d]+sizeof(uli->tai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->tai), octet->len);
return 0;
}
memcpy(&uli->tai,
(unsigned char *)octet->data + size, sizeof(uli->tai));
uli->tai.tac = be16toh(uli->tai.tac);
size += sizeof(uli->tai);
}
if (uli->flags.e_cgi) {
ogs_assert(size + sizeof(uli->e_cgi) <= octet->len);
if (size + sizeof(uli->e_cgi) > octet->len) {
ogs_error("size[%d]+sizeof(uli->e_cgi)[%d] > IE Length[%d]",
size, (int)sizeof(uli->e_cgi), octet->len);
return 0;
}
memcpy(&uli->e_cgi,
(unsigned char *)octet->data + size, sizeof(uli->e_cgi));
uli->e_cgi.cell_id = be32toh(uli->e_cgi.cell_id);
size += sizeof(uli->e_cgi);
}
if (uli->flags.lai) {
ogs_assert(size + sizeof(uli->lai) <= octet->len);
if (size + sizeof(uli->lai) > octet->len) {
ogs_error("size[%d]+sizeof(uli->lai)[%d] > IE Length[%d]",
size, (int)sizeof(uli->lai), octet->len);
return 0;
}
memcpy(&uli->lai,
(unsigned char *)octet->data + size, sizeof(uli->lai));
uli->lai.lac = be16toh(uli->lai.lac);
size += sizeof(uli->lai);
}
if (uli->flags.enodeb_id) {
ogs_assert(size + sizeof(uli->enodeb_id) <= octet->len);
if (size + sizeof(uli->enodeb_id) > octet->len) {
ogs_error("size[%d]+sizeof(uli->enodeb_id)[%d] > IE Length[%d]",
size, (int)sizeof(uli->enodeb_id), octet->len);
return 0;
}
memcpy(&uli->enodeb_id,
(unsigned char *)octet->data + size, sizeof(uli->enodeb_id));
uli->enodeb_id.enodeb_id = be16toh(uli->enodeb_id.enodeb_id);
@ -684,7 +712,8 @@ int16_t ogs_gtp2_parse_uli(ogs_gtp2_uli_t *uli, ogs_tlv_octet_t *octet)
ogs_error("Extended Macro eNodeB ID in ULI not implemented! see 3GPP TS 29.274 8.21.8");
}
ogs_assert(size == octet->len);
if (size != octet->len)
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size;
}

View File

@ -483,35 +483,59 @@ int ogs_nas_parse_qos_flow_descriptions(
ogs_assert(description);
ogs_assert(descriptions);
ogs_assert(descriptions->length);
if (descriptions->length == 0) {
ogs_error("Length is 0");
goto cleanup;
}
if (descriptions->buffer == NULL) {
ogs_error("Buffer is NULL");
goto cleanup;
}
length = descriptions->length;
ogs_assert(descriptions->buffer);
buffer = descriptions->buffer;
size = 0;
while (size < length) {
memset(description, 0, sizeof(*description));
ogs_assert(size+3 <= length);
if (size+3 > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(description, buffer+size, 3);
size += 3;
for (i = 0; i < description->num_of_parameter &&
i < OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER; i++) {
ogs_assert(size+sizeof(description->param[i].identifier) <= length);
if (size+sizeof(description->param[i].identifier) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&description->param[i].identifier, buffer+size,
sizeof(description->param[i].identifier));
size += sizeof(description->param[i].identifier);
ogs_assert(size+sizeof(description->param[i].len) <= length);
if (size+sizeof(description->param[i].len) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&description->param[i].len, buffer+size,
sizeof(description->param[i].len));
size += sizeof(description->param[i].len);
switch(description->param[i].identifier) {
case OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI:
ogs_assert(description->param[i].len == 1);
ogs_assert(size+description->param[i].len <= length);
if (description->param[i].len != 1) {
ogs_error("Invalid len[%d]", description->param[i].len);
goto cleanup;
}
if (size+description->param[i].len > length) {
ogs_error("Overflow: len[%d] length[%d]",
description->param[i].len, length);
goto cleanup;
}
memcpy(&description->param[i].qos_index,
buffer+size, description->param[i].len);
size += description->param[i].len;
@ -521,8 +545,15 @@ int ogs_nas_parse_qos_flow_descriptions(
case OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_DOWNLINK:
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_UPLINK:
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_DOWNLINK:
ogs_assert(description->param[i].len == 3);
ogs_assert(size+description->param[i].len <= length);
if (description->param[i].len != 3) {
ogs_error("Invalid len[%d]", description->param[i].len);
goto cleanup;
}
if (size+description->param[i].len > length) {
ogs_error("Overflow: len[%d] length[%d]",
description->param[i].len, length);
goto cleanup;
}
memcpy(&description->param[i].br,
buffer+size, description->param[i].len);
description->param[i].br.value =
@ -530,15 +561,17 @@ int ogs_nas_parse_qos_flow_descriptions(
size += description->param[i].len;
break;
default:
ogs_fatal("Unknown qos_flow parameter identifier [%d]",
ogs_error("Unknown qos_flow parameter identifier [%d]",
description->param[i].identifier);
ogs_assert_if_reached();
goto cleanup;
}
}
description++;
}
cleanup:
return (int)(description-first);
}
@ -777,28 +810,50 @@ int ogs_nas_parse_qos_rules(
ogs_assert(rule);
ogs_assert(rules);
ogs_assert(rules->length);
if (rules->length == 0) {
ogs_error("Length is 0");
goto cleanup;
}
if (rules->buffer == NULL) {
ogs_error("Buffer is NULL");
goto cleanup;
}
length = rules->length;
ogs_assert(rules->buffer);
buffer = rules->buffer;
size = 0;
while (size < length) {
memset(rule, 0, sizeof(*rule));
ogs_assert(size+sizeof(rule->identifier) <= length);
if (size+sizeof(rule->identifier) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->identifier, buffer+size, sizeof(rule->identifier));
size += sizeof(rule->identifier);
ogs_assert(size+sizeof(rule->length) <= length);
if (size+sizeof(rule->length) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->length, buffer+size, sizeof(rule->length));
rule->length = be16toh(rule->length);
size += sizeof(rule->length);
ogs_assert(size+sizeof(rule->flags) <= length);
if (size+sizeof(rule->flags) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->flags, buffer+size, sizeof(rule->flags));
size += sizeof(rule->flags);
if (rule->code == 0 || rule->code == 7) { /* Reserved */
ogs_error("Reserved Rule Code [%d]", rule->code);
goto cleanup;
}
if (rule->code == OGS_NAS_QOS_CODE_DELETE_EXISTING_QOS_RULE ||
rule->code == OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS) {
if (rule->num_of_packet_filter != 0) {
@ -806,12 +861,16 @@ int ogs_nas_parse_qos_rules(
"and number of packet filter[%d]",
rule->code, rule->num_of_packet_filter);
rule->num_of_packet_filter = 0;
goto cleanup;
}
}
for (i = 0; i < rule->num_of_packet_filter &&
i < OGS_MAX_NUM_OF_FLOW_IN_GTP; i++) {
ogs_assert(size+sizeof(rule->pf[i].flags) <= length);
if (size+sizeof(rule->pf[i].flags) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->pf[i].flags, buffer+size, sizeof(rule->pf[i].flags));
size += sizeof(rule->pf[i].flags);
@ -819,24 +878,35 @@ int ogs_nas_parse_qos_rules(
OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS)
continue;
ogs_assert(size+sizeof(rule->pf[i].content.length) <= length);
if (size+sizeof(rule->pf[i].content.length) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.length, buffer+size,
sizeof(rule->pf[i].content.length));
size += sizeof(rule->pf[i].content.length);
j = 0; len = 0;
while(len < rule->pf[i].content.length) {
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].type) <= length);
if (size+len+
sizeof(rule->pf[i].content.component[j].type) > length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].type,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].type));
len += sizeof(rule->pf[i].content.component[j].type);
switch(rule->pf[i].content.component[j].type) {
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].proto) <=
length);
if (size+len+
sizeof(rule->pf[i].content.component[j].proto) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].proto,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].proto));
@ -844,17 +914,25 @@ int ogs_nas_parse_qos_rules(
break;
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].ipv4.addr) <=
length);
if (size+len+
sizeof(rule->pf[i].content.component[j].ipv4.addr) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv4.addr,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].ipv4.addr));
len += sizeof(rule->pf[i].content.component[j].ipv4.addr);
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].ipv4.mask) <=
length);
if (size+len+
sizeof(rule->pf[i].content.component[j].ipv4.mask) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv4.mask,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].ipv4.mask));
@ -862,18 +940,26 @@ int ogs_nas_parse_qos_rules(
break;
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].ipv6.addr) <=
length);
if (size+len+
sizeof(rule->pf[i].content.component[j].ipv6.addr) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6.addr,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].ipv6.addr));
len += sizeof(rule->pf[i].content.component[j].ipv6.addr);
ogs_assert(size+len+
if (size+len+
sizeof(
rule->pf[i].content.component[j].ipv6.prefixlen) <=
length);
rule->pf[i].content.component[j].ipv6.prefixlen) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6.prefixlen,
buffer+size+len,
sizeof(
@ -883,10 +969,14 @@ int ogs_nas_parse_qos_rules(
break;
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
ogs_assert(size+len+
if (size+len+
sizeof(
rule->pf[i].content.component[j].ipv6_mask.addr) <=
length);
rule->pf[i].content.component[j].ipv6_mask.addr) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6_mask.addr,
buffer+size+len,
sizeof(
@ -894,10 +984,14 @@ int ogs_nas_parse_qos_rules(
len += sizeof(
rule->pf[i].content.component[j].ipv6_mask.addr);
ogs_assert(size+len+
if (size+len+
sizeof(
rule->pf[i].content.component[j].ipv6_mask.mask) <=
length);
rule->pf[i].content.component[j].ipv6_mask.mask) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].ipv6_mask.mask,
buffer+size+len,
sizeof(
@ -907,9 +1001,13 @@ int ogs_nas_parse_qos_rules(
break;
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].port.low) <=
length);
if (size+len+
sizeof(rule->pf[i].content.component[j].port.low) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].port.low,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].port.low));
@ -919,9 +1017,13 @@ int ogs_nas_parse_qos_rules(
break;
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].port.low) <=
length);
if (size+len+
sizeof(rule->pf[i].content.component[j].port.low) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].port.low,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].port.low));
@ -929,9 +1031,13 @@ int ogs_nas_parse_qos_rules(
be16toh(rule->pf[i].content.component[j].port.low);
len += sizeof(rule->pf[i].content.component[j].port.low);
ogs_assert(size+len+
sizeof(rule->pf[i].content.component[j].port.high) <=
length);
if (size+len+
sizeof(rule->pf[i].content.component[j].port.high) >
length) {
ogs_error("Overflow : size[%d] len[%d] length[%d]",
size, len, length);
goto cleanup;
}
memcpy(&rule->pf[i].content.component[j].port.high,
buffer+size+len,
sizeof(rule->pf[i].content.component[j].port.high));
@ -942,7 +1048,7 @@ int ogs_nas_parse_qos_rules(
default:
ogs_error("Unknown Packet Filter Type(%d)",
rule->pf[i].content.component[j].type);
return -1;
goto cleanup;
}
j++;
}
@ -954,11 +1060,17 @@ int ogs_nas_parse_qos_rules(
rule->code != OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_AND_DELETE_PACKET_FILTERS &&
rule->code != OGS_NAS_QOS_CODE_MODIFY_EXISTING_QOS_RULE_WITHOUT_MODIFYING_PACKET_FILTERS) {
ogs_assert(size+sizeof(rule->precedence) <= length);
if (size+sizeof(rule->precedence) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->precedence, buffer+size, sizeof(rule->precedence));
size += sizeof(rule->precedence);
ogs_assert(size+sizeof(rule->flow.flags) <= length);
if (size+sizeof(rule->flow.flags) > length) {
ogs_error("Overflow : size[%d] length[%d]", size, length);
goto cleanup;
}
memcpy(&rule->flow.flags, buffer+size, sizeof(rule->flow.flags));
size += sizeof(rule->flow.flags);
}
@ -966,6 +1078,8 @@ int ogs_nas_parse_qos_rules(
rule++;
}
cleanup:
return (int)(rule-first);
}

View File

@ -743,6 +743,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
ogs_pfcp_subnet_t *subnet = NULL;
const char *ipstr = NULL;
const char *gateway = NULL;
const char *mask_or_numbits = NULL;
const char *dnn = NULL;
const char *dev = self.tun_ifname;
@ -781,6 +782,8 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
mask_or_numbits = (const char *)v;
}
}
} else if (!strcmp(subnet_key, "gateway")) {
gateway = ogs_yaml_iter_value(&subnet_iter);
} else if (!strcmp(subnet_key, "apn") ||
!strcmp(subnet_key, "dnn")) {
dnn = ogs_yaml_iter_value(&subnet_iter);
@ -825,7 +828,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
}
subnet = ogs_pfcp_subnet_add(
ipstr, mask_or_numbits, dnn, dev);
ipstr, mask_or_numbits, gateway, dnn, dev);
ogs_assert(subnet);
subnet->num_of_range = num;
@ -2150,7 +2153,7 @@ ogs_pfcp_dev_t *ogs_pfcp_dev_find_by_ifname(const char *ifname)
ogs_pfcp_subnet_t *ogs_pfcp_subnet_add(
const char *ipstr, const char *mask_or_numbits,
const char *dnn, const char *ifname)
const char *gateway, const char *dnn, const char *ifname)
{
int rv;
ogs_pfcp_dev_t *dev = NULL;
@ -2179,6 +2182,41 @@ ogs_pfcp_subnet_t *ogs_pfcp_subnet_add(
subnet->family = subnet->gw.family;
subnet->prefixlen = atoi(mask_or_numbits);
if (memcmp(subnet->gw.sub, subnet->sub.sub,
sizeof(subnet->gw.sub)) != 0) {
char *subnet_string = NULL;
if (subnet->family == AF_INET) {
subnet_string = ogs_ipv4_to_string(subnet->sub.sub[0]);
ogs_assert(subnet_string);
} else if (subnet->family == AF_INET6) {
subnet_string = ogs_ipv6addr_to_string(
(uint8_t*)&subnet->sub.sub[0]);
ogs_assert(subnet_string);
}
ogs_warn("Please change the configuration files of "
"smf.yaml and upf.yaml as below.");
ogs_log_print(OGS_LOG_WARN, "\n<OLD Format>\n");
ogs_log_print(OGS_LOG_WARN, "smf:\n");
ogs_log_print(OGS_LOG_WARN, " session:\n");
ogs_log_print(OGS_LOG_WARN, " - subnet: %s/%s\n",
ipstr, mask_or_numbits);
ogs_log_print(OGS_LOG_WARN, "\n<NEW Format>\n");
ogs_log_print(OGS_LOG_WARN, "smf:\n");
ogs_log_print(OGS_LOG_WARN, " session:\n");
ogs_log_print(OGS_LOG_WARN, " - subnet: %s/%s\n",
subnet_string ? subnet_string : "Unknown", mask_or_numbits);
ogs_log_print(OGS_LOG_WARN, " gateway: %s\n\n\n", ipstr);
ogs_free(subnet_string);
}
}
if (gateway) {
rv = ogs_ipsubnet(&subnet->gw, gateway, NULL);
ogs_assert(rv == OGS_OK);
}
if (dnn)

View File

@ -491,7 +491,7 @@ ogs_pfcp_dev_t *ogs_pfcp_dev_find_by_ifname(const char *ifname);
ogs_pfcp_subnet_t *ogs_pfcp_subnet_add(
const char *ipstr, const char *mask_or_numbits,
const char *dnn, const char *ifname);
const char *gateway, const char *dnn, const char *ifname);
ogs_pfcp_subnet_t *ogs_pfcp_subnet_next(ogs_pfcp_subnet_t *subnet);
void ogs_pfcp_subnet_remove(ogs_pfcp_subnet_t *subnet);
void ogs_pfcp_subnet_remove_all(void);

View File

@ -94,6 +94,7 @@ bool ogs_pfcp_cp_handle_association_setup_request(
ogs_pfcp_association_setup_request_t *req)
{
int i;
int16_t decoded;
ogs_assert(xact);
ogs_assert(node);
@ -112,8 +113,11 @@ bool ogs_pfcp_cp_handle_association_setup_request(
if (message->presence == 0)
break;
ogs_pfcp_parse_user_plane_ip_resource_info(&info, message);
ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
decoded = ogs_pfcp_parse_user_plane_ip_resource_info(&info, message);
if (message->len == decoded)
ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
else
ogs_error("Invalid User Plane IP Resource Info");
}
if (req->up_function_features.presence) {
@ -143,6 +147,7 @@ bool ogs_pfcp_cp_handle_association_setup_response(
ogs_pfcp_association_setup_response_t *rsp)
{
int i;
int16_t decoded;
ogs_assert(xact);
ogs_pfcp_xact_commit(xact);
@ -160,8 +165,11 @@ bool ogs_pfcp_cp_handle_association_setup_response(
if (message->presence == 0)
break;
ogs_pfcp_parse_user_plane_ip_resource_info(&info, message);
ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
decoded = ogs_pfcp_parse_user_plane_ip_resource_info(&info, message);
if (message->len == decoded)
ogs_gtpu_resource_add(&node->gtpu_resource_list, &info);
else
ogs_error("Invalid User Plane IP Resource Info");
}
if (rsp->up_function_features.presence) {
@ -424,7 +432,10 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_create_pdr(ogs_pfcp_sess_t *sess,
len = ogs_pfcp_parse_sdf_filter(
&sdf_filter, &message->pdi.sdf_filter[i]);
ogs_assert(message->pdi.sdf_filter[i].len == len);
if (message->pdi.sdf_filter[i].len != len) {
ogs_error("Invalid SDF Filter");
break;
}
/* Check Previous SDF Filter ID */
if (sdf_filter.bid) {
@ -518,12 +529,13 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_create_pdr(ogs_pfcp_sess_t *sess,
if (message->pdi.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1];
ogs_assert(0 < ogs_fqdn_parse(dnn,
message->pdi.network_instance.data,
ogs_min(message->pdi.network_instance.len, OGS_MAX_DNN_LEN)));
pdr->dnn = ogs_strdup(dnn);
ogs_assert(pdr->dnn);
if (ogs_fqdn_parse(dnn, message->pdi.network_instance.data,
ogs_min(message->pdi.network_instance.len, OGS_MAX_DNN_LEN)) > 0) {
pdr->dnn = ogs_strdup(dnn);
ogs_assert(pdr->dnn);
} else {
ogs_error("Invalid pdi.network_instance");
}
}
pdr->chid = false;
@ -765,7 +777,10 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_update_pdr(ogs_pfcp_sess_t *sess,
len = ogs_pfcp_parse_sdf_filter(
&sdf_filter, &message->pdi.sdf_filter[i]);
ogs_assert(message->pdi.sdf_filter[i].len == len);
if (message->pdi.sdf_filter[i].len != len) {
ogs_error("Invalid SDF Filter");
break;
}
/* Check Previous SDF Filter ID */
if (sdf_filter.bid) {
@ -855,14 +870,16 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_update_pdr(ogs_pfcp_sess_t *sess,
if (message->pdi.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1];
ogs_assert(0 < ogs_fqdn_parse(dnn,
message->pdi.network_instance.data,
ogs_min(message->pdi.network_instance.len, OGS_MAX_DNN_LEN)));
if (pdr->dnn)
ogs_free(pdr->dnn);
pdr->dnn = ogs_strdup(dnn);
ogs_assert(pdr->dnn);
if (ogs_fqdn_parse(dnn, message->pdi.network_instance.data,
ogs_min(message->pdi.network_instance.len,
OGS_MAX_DNN_LEN)) > 0) {
if (pdr->dnn)
ogs_free(pdr->dnn);
pdr->dnn = ogs_strdup(dnn);
ogs_assert(pdr->dnn);
} else {
ogs_error("Invalid pdi.network_instance");
}
}
if (message->pdi.local_f_teid.presence) {
@ -964,13 +981,15 @@ ogs_pfcp_far_t *ogs_pfcp_handle_create_far(ogs_pfcp_sess_t *sess,
if (message->forwarding_parameters.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1];
ogs_assert(0 < ogs_fqdn_parse(dnn,
if (ogs_fqdn_parse(dnn,
message->forwarding_parameters.network_instance.data,
ogs_min(message->forwarding_parameters.network_instance.len,
OGS_MAX_DNN_LEN)));
far->dnn = ogs_strdup(dnn);
ogs_assert(far->dnn);
ogs_min(message->forwarding_parameters.network_instance.len,
OGS_MAX_DNN_LEN)) > 0) {
far->dnn = ogs_strdup(dnn);
ogs_assert(far->dnn);
} else {
ogs_error("Invalid forwarding_parameters.network_instance");
}
}
if (message->forwarding_parameters.outer_header_creation.presence) {
@ -1069,15 +1088,18 @@ ogs_pfcp_far_t *ogs_pfcp_handle_update_far(ogs_pfcp_sess_t *sess,
if (message->update_forwarding_parameters.network_instance.presence) {
char dnn[OGS_MAX_DNN_LEN+1];
ogs_assert(0 < ogs_fqdn_parse(dnn,
if (ogs_fqdn_parse(dnn,
message->update_forwarding_parameters.network_instance.data,
ogs_min(message->update_forwarding_parameters.
network_instance.len, OGS_MAX_DNN_LEN)));
if (far->dnn)
ogs_free(far->dnn);
far->dnn = ogs_strdup(dnn);
ogs_assert(far->dnn);
ogs_min(message->update_forwarding_parameters.
network_instance.len, OGS_MAX_DNN_LEN)) > 0) {
if (far->dnn)
ogs_free(far->dnn);
far->dnn = ogs_strdup(dnn);
ogs_assert(far->dnn);
} else {
ogs_error("Invalid "
"update_forwarding_parameters.network_instance");
}
}
if (message->update_forwarding_parameters.
@ -1307,6 +1329,7 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_create_urr(ogs_pfcp_sess_t *sess,
ogs_pfcp_tlv_create_urr_t *message,
uint8_t *cause_value, uint8_t *offending_ie_value)
{
int16_t decoded;
ogs_pfcp_urr_t *urr = NULL;
ogs_assert(message);
@ -1355,12 +1378,26 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_create_urr(ogs_pfcp_sess_t *sess,
if (message->volume_threshold.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
ogs_pfcp_parse_volume(&urr->vol_threshold, &message->volume_threshold);
decoded = ogs_pfcp_parse_volume(
&urr->vol_threshold, &message->volume_threshold);
if (message->volume_threshold.len != decoded) {
ogs_error("Invalid Volume Threshold");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_THRESHOLD_TYPE;
return NULL;
}
}
if (message->volume_quota.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
ogs_pfcp_parse_volume(&urr->vol_quota, &message->volume_quota);
decoded = ogs_pfcp_parse_volume(
&urr->vol_quota, &message->volume_quota);
if (message->volume_quota.len != decoded) {
ogs_error("Invalid Volume Quota");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_QUOTA_TYPE;
return NULL;
}
}
if (message->event_threshold.presence &&
@ -1409,6 +1446,7 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_update_urr(ogs_pfcp_sess_t *sess,
ogs_pfcp_tlv_update_urr_t *message,
uint8_t *cause_value, uint8_t *offending_ie_value)
{
int16_t decoded;
ogs_pfcp_urr_t *urr = NULL;
ogs_assert(message);
@ -1447,12 +1485,26 @@ ogs_pfcp_urr_t *ogs_pfcp_handle_update_urr(ogs_pfcp_sess_t *sess,
if (message->volume_threshold.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
ogs_pfcp_parse_volume(&urr->vol_threshold, &message->volume_threshold);
decoded = ogs_pfcp_parse_volume(
&urr->vol_threshold, &message->volume_threshold);
if (message->volume_threshold.len != decoded) {
ogs_error("Invalid Volume Threshold");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_THRESHOLD_TYPE;
return NULL;
}
}
if (message->volume_quota.presence &&
(urr->meas_method & OGS_PFCP_MEASUREMENT_METHOD_VOLUME)) {
ogs_pfcp_parse_volume(&urr->vol_quota, &message->volume_quota);
decoded = ogs_pfcp_parse_volume(
&urr->vol_quota, &message->volume_quota);
if (message->volume_quota.len != decoded) {
ogs_error("Invalid Volume Quota");
*cause_value = OGS_PFCP_CAUSE_MANDATORY_IE_INCORRECT;
*offending_ie_value = OGS_PFCP_VOLUME_QUOTA_TYPE;
return NULL;
}
}
if (message->event_threshold.presence &&

View File

@ -149,14 +149,22 @@ int16_t ogs_pfcp_parse_user_plane_ip_resource_info(
size++;
if (info->teidri) {
ogs_assert(size + sizeof(info->teid_range) <= octet->len);
if (size + sizeof(info->teid_range) > octet->len) {
ogs_error("size[%d]+sizeof(info->teid_range)[%d] > IE Length[%d]",
size, (int)sizeof(info->teid_range), octet->len);
return 0;
}
memcpy(&info->teid_range, (unsigned char *)octet->data + size,
sizeof(info->teid_range));
size += sizeof(info->teid_range);
}
if (info->v4) {
ogs_assert(size + sizeof(info->addr) <= octet->len);
if (size + sizeof(info->addr) > octet->len) {
ogs_error("size[%d]+sizeof(info->addr)[%d] > IE Length[%d]",
size, (int)sizeof(info->addr), octet->len);
return 0;
}
memcpy(&info->addr,
(unsigned char *)octet->data + size,
sizeof(info->addr));
@ -164,30 +172,51 @@ int16_t ogs_pfcp_parse_user_plane_ip_resource_info(
}
if (info->v6) {
ogs_assert(size + OGS_IPV6_LEN <= octet->len);
if (size + OGS_IPV6_LEN > octet->len) {
ogs_error("size[%d]+OGS_IPV6_LEN[%d] > IE Length[%d]",
size, (int)OGS_IPV6_LEN, octet->len);
return 0;
}
memcpy(&info->addr6, (unsigned char *)octet->data + size, OGS_IPV6_LEN);
size += OGS_IPV6_LEN;
}
if (info->assoni) {
int len = octet->len - size;
if (info->assosi) len--;
if (len <= 0) {
ogs_error("len[%d] octect->len[%d] size[%d]", len, octet->len, size);
return 0;
}
ogs_assert(0 < ogs_fqdn_parse(
info->network_instance, (char *)octet->data + size,
ogs_min(len, OGS_MAX_APN_LEN)));
if (info->assosi) len--;
if (len <= 0) {
ogs_error("info->assosi[%d] len[%d] octect->len[%d] size[%d]",
info->assosi, len, octet->len, size);
return 0;
}
if (ogs_fqdn_parse(info->network_instance, (char *)octet->data + size,
ogs_min(len, OGS_MAX_APN_LEN)) <= 0) {
ogs_error("Invalid info->network_instance");
info->network_instance[0] = 0;
}
size += len;
}
if (info->assosi) {
ogs_assert(size + sizeof(info->source_interface) <=
octet->len);
if (size + sizeof(info->source_interface) > octet->len) {
ogs_error("size[%d]+sizeof(info->source_interface)[%d] > "
"IE Length[%d]",
size, (int)sizeof(info->source_interface), octet->len);
return 0;
}
memcpy(&info->source_interface, (unsigned char *)octet->data + size,
sizeof(info->source_interface));
size += sizeof(info->source_interface);
}
ogs_assert(size == octet->len);
if (size != octet->len)
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size;
}
@ -282,18 +311,32 @@ int16_t ogs_pfcp_parse_sdf_filter(
memset(filter, 0, sizeof(ogs_pfcp_sdf_filter_t));
ogs_assert(size + sizeof(filter->flags) <= octet->len);
if (size + sizeof(filter->flags) > octet->len) {
ogs_error("size[%d]+sizeof(filter->flags)[%d] > IE Length[%d]",
size, (int)sizeof(filter->flags), octet->len);
return 0;
}
memcpy(&filter->flags,
(unsigned char *)octet->data + size, sizeof(filter->flags));
size++;
ogs_assert(size + sizeof(filter->spare2) <= octet->len);
if (size + sizeof(filter->spare2) > octet->len) {
ogs_error("size[%d]+sizeof(filter->spare2)[%d] > IE Length[%d]",
size, (int)sizeof(filter->spare2), octet->len);
return 0;
}
memcpy(&filter->spare2,
(unsigned char *)octet->data + size, sizeof(filter->flags));
size++;
if (filter->fd) {
ogs_assert(size + sizeof(filter->flow_description_len) <= octet->len);
if (size + sizeof(filter->flow_description_len) > octet->len) {
ogs_error("size[%d]+sizeof(filter->flow_description_len)[%d] "
"> IE Length[%d]",
size, (int)sizeof(filter->flow_description_len),
octet->len);
return 0;
}
memcpy(&filter->flow_description_len,
(unsigned char *)octet->data + size,
sizeof(filter->flow_description_len));
@ -305,7 +348,12 @@ int16_t ogs_pfcp_parse_sdf_filter(
}
if (filter->ttc) {
ogs_assert(size + sizeof(filter->tos_traffic_class) <= octet->len);
if (size + sizeof(filter->tos_traffic_class) > octet->len) {
ogs_error("size[%d]+sizeof(filter->tos_traffic_class)[%d] "
"> IE Length[%d]",
size, (int)sizeof(filter->tos_traffic_class), octet->len);
return 0;
}
memcpy(&filter->tos_traffic_class,
(unsigned char *)octet->data + size,
sizeof(filter->tos_traffic_class));
@ -314,8 +362,13 @@ int16_t ogs_pfcp_parse_sdf_filter(
}
if (filter->spi) {
ogs_assert(size + sizeof(filter->security_parameter_index) <=
octet->len);
if (size + sizeof(filter->security_parameter_index) > octet->len) {
ogs_error("size[%d]+sizeof(filter->security_parameter_index)[%d] "
"> IE Length[%d]",
size, (int)sizeof(filter->security_parameter_index),
octet->len);
return 0;
}
memcpy(&filter->security_parameter_index,
(unsigned char *)octet->data + size,
sizeof(filter->security_parameter_index));
@ -326,7 +379,11 @@ int16_t ogs_pfcp_parse_sdf_filter(
if (filter->fl) {
int bit24_len = 3;
ogs_assert(size + bit24_len <= octet->len);
if (size + bit24_len > octet->len) {
ogs_error("size[%d]+bit24_len[%d] > IE Length[%d]",
size, bit24_len, octet->len);
return 0;
}
memcpy(&filter->flow_label,
(unsigned char *)octet->data + size, bit24_len);
filter->flow_label = be32toh(filter->flow_label);
@ -334,14 +391,20 @@ int16_t ogs_pfcp_parse_sdf_filter(
}
if (filter->bid) {
ogs_assert(size + sizeof(filter->sdf_filter_id) <= octet->len);
if (size + sizeof(filter->sdf_filter_id) > octet->len) {
ogs_error("size[%d]+sizeof(filter->sdf_filter_id)[%d]"
"> IE Length[%d]",
size, (int)sizeof(filter->sdf_filter_id), octet->len);
return 0;
}
memcpy(&filter->sdf_filter_id, (unsigned char *)octet->data + size,
sizeof(filter->sdf_filter_id));
filter->sdf_filter_id = be32toh(filter->sdf_filter_id);
size += sizeof(filter->sdf_filter_id);
}
ogs_assert(size == octet->len);
if (size != octet->len)
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size;
}
@ -479,25 +542,44 @@ int16_t ogs_pfcp_parse_volume(
size += sizeof(volume->flags);
if (volume->tovol) {
if (size + sizeof(volume->total_volume) > octet->len) {
ogs_error("size[%d]+sizeof(volume->total_volume)[%d] "
"> IE Length[%d]",
size, (int)sizeof(volume->total_volume), octet->len);
return 0;
}
memcpy(&volume->total_volume, (unsigned char *)octet->data + size,
sizeof(volume->total_volume));
volume->total_volume = be64toh(volume->total_volume);
size += sizeof(volume->total_volume);
}
if (volume->ulvol) {
if (size + sizeof(volume->uplink_volume) > octet->len) {
ogs_error("size[%d]+sizeof(volume->uplink_volume)[%d] "
"> IE Length[%d]",
size, (int)sizeof(volume->uplink_volume), octet->len);
return 0;
}
memcpy(&volume->uplink_volume, (unsigned char *)octet->data + size,
sizeof(volume->uplink_volume));
volume->uplink_volume = be64toh(volume->uplink_volume);
size += sizeof(volume->uplink_volume);
}
if (volume->dlvol) {
if (size + sizeof(volume->downlink_volume) > octet->len) {
ogs_error("size[%d]+sizeof(volume->downlink_volume)[%d] "
"> IE Length[%d]",
size, (int)sizeof(volume->downlink_volume), octet->len);
return 0;
}
memcpy(&volume->downlink_volume, (unsigned char *)octet->data + size,
sizeof(volume->downlink_volume));
volume->downlink_volume = be64toh(volume->downlink_volume);
size += sizeof(volume->downlink_volume);
}
ogs_assert(size == octet->len);
if (size != octet->len)
ogs_error("Mismatch IE Length[%d] != Decoded[%d]", octet->len, size);
return size;
}

View File

@ -419,8 +419,8 @@ int ogs_fqdn_parse(char *dst, const char *src, int length)
while (i+1 < length) {
len = src[i++];
if ((j + len + 1) > length) {
ogs_error("Invalid FQDN encoding[len:%d] + 1 > length[%d]",
len, length);
ogs_error("Invalid FQDN encoding[j:%d+len:%d] + 1 > length[%d]",
j, len, length);
ogs_log_hexdump(OGS_LOG_ERROR, (unsigned char *)src, length);
return 0;
}

View File

@ -379,11 +379,6 @@ ED2(uint8_t spare:4;,
typedef struct ogs_paa_s {
ED2(uint8_t spare:5;,
/* 8.34 PDN Type */
#define OGS_PDU_SESSION_TYPE_IS_VALID(x) \
((x) == OGS_PDU_SESSION_TYPE_IPV4 || \
(x) == OGS_PDU_SESSION_TYPE_IPV6 || \
(x) == OGS_PDU_SESSION_TYPE_IPV4V6) \
uint8_t session_type:3;)
union {
/* PDU_SESSION_TYPE_IPV4 */

View File

@ -57,6 +57,19 @@ extern "C" {
OGS_OBJECT_REF(__pClient); \
((__cTX)->client) = (__pClient); \
ogs_debug("CLIENT Ref [%d]", (__pClient)->reference_count); \
if ((__pClient)->fqdn) { \
ogs_info("NF EndPoint(fqdn) setup [%s:%d]", \
(__pClient)->fqdn, (__pClient)->fqdn_port); \
} \
if ((__pClient)->addr) { \
ogs_info("NF EndPoint(addr) setup [%s:%d]", \
OGS_ADDR((__pClient)->addr, buf), OGS_PORT((__pClient)->addr)); \
} \
if ((__pClient)->addr6) { \
ogs_info("NF EndPoint(addr6) setup [%s:%d]", \
OGS_ADDR((__pClient)->addr6, buf), \
OGS_PORT((__pClient)->addr6)); \
} \
} while(0)
typedef int (*ogs_sbi_client_cb_f)(

View File

@ -1085,8 +1085,6 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(void)
ogs_assert(nf_instance);
memset(nf_instance, 0, sizeof(ogs_sbi_nf_instance_t));
OGS_OBJECT_REF(nf_instance);
nf_instance->time.heartbeat_interval =
ogs_local_conf()->time.nf_instance.heartbeat_interval;
@ -1096,10 +1094,10 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(void)
ogs_list_add(&ogs_sbi_self()->nf_instance_list, nf_instance);
ogs_debug("[%s] NFInstance added with Ref [%s:%d]",
ogs_debug("[%s] NFInstance added with Ref [%s]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
nf_instance->id);
return nf_instance;
}
@ -1196,20 +1194,10 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
{
ogs_assert(nf_instance);
ogs_debug("[%s] NFInstance UnRef [%s:%d]",
ogs_debug("[%s] NFInstance removed [%s]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
if (OGS_OBJECT_IS_REF(nf_instance)) {
OGS_OBJECT_UNREF(nf_instance);
return;
}
ogs_debug("[%s] NFInstance removed [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
nf_instance->id);
ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance);
@ -2130,9 +2118,6 @@ bool ogs_sbi_discovery_param_is_matched(
if (NF_INSTANCE_EXCLUDED_FROM_DISCOVERY(nf_instance))
return false;
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered))
return false;
if (nf_instance->nf_type != target_nf_type)
return false;
@ -2202,10 +2187,10 @@ void ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
client = nf_instance_find_client(nf_instance);
ogs_assert(client);
ogs_debug("[%s] NFInstance associated [%s:%d]",
ogs_debug("[%s] NFInstance associated [%s]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
nf_instance->id);
OGS_SBI_SETUP_CLIENT(nf_instance, client);
@ -2260,30 +2245,15 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_type(
return nf_service->client;
}
return nf_instance->client;
return NULL;
}
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
{
int i;
ogs_assert(sbi_object);
if (ogs_list_count(&sbi_object->xact_list))
ogs_error("SBI running [%d]", ogs_list_count(&sbi_object->xact_list));
for (i = 0; i < OGS_SBI_MAX_NUM_OF_SERVICE_TYPE; i++) {
ogs_sbi_nf_instance_t *nf_instance =
sbi_object->service_type_array[i].nf_instance;
if (nf_instance)
ogs_sbi_nf_instance_remove(nf_instance);
}
for (i = 0; i < OGS_SBI_MAX_NUM_OF_NF_TYPE; i++) {
ogs_sbi_nf_instance_t *nf_instance =
sbi_object->nf_type_array[i].nf_instance;
if (nf_instance)
ogs_sbi_nf_instance_remove(nf_instance);
}
}
ogs_sbi_xact_t *ogs_sbi_xact_add(
@ -2493,12 +2463,26 @@ ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void)
return subscription_data;
}
void ogs_sbi_subscription_data_set_resource_uri(
ogs_sbi_subscription_data_t *subscription_data, char *resource_uri)
{
ogs_assert(subscription_data);
ogs_assert(resource_uri);
if (subscription_data->resource_uri)
ogs_free(subscription_data->resource_uri);
subscription_data->resource_uri = ogs_strdup(resource_uri);
ogs_assert(subscription_data->resource_uri);
}
void ogs_sbi_subscription_data_set_id(
ogs_sbi_subscription_data_t *subscription_data, char *id)
{
ogs_assert(subscription_data);
ogs_assert(id);
if (subscription_data->id)
ogs_free(subscription_data->id);
subscription_data->id = ogs_strdup(id);
ogs_assert(subscription_data->id);
}
@ -2516,6 +2500,9 @@ void ogs_sbi_subscription_data_remove(
if (subscription_data->notification_uri)
ogs_free(subscription_data->notification_uri);
if (subscription_data->resource_uri)
ogs_free(subscription_data->resource_uri);
if (subscription_data->req_nf_instance_id)
ogs_free(subscription_data->req_nf_instance_id);

View File

@ -175,7 +175,6 @@ typedef struct ogs_sbi_nf_instance_s {
#define NF_INSTANCE_CLIENT(__nFInstance) \
((__nFInstance) ? ((__nFInstance)->client) : NULL)
void *client; /* only used in CLIENT */
unsigned int reference_count; /* reference count for memory free */
} ogs_sbi_nf_instance_t;
typedef enum {
@ -194,6 +193,16 @@ typedef struct ogs_sbi_object_s {
struct {
ogs_sbi_nf_instance_t *nf_instance;
/*
* Search.Result stored in nf_instance->time.validity_duration;
*
* validity_timeout = nf_instance->validity->timeout =
* ogs_get_monotonic_time() + nf_instance->time.validity_duration;
*
* if no validityPeriod in SearchResult, validity_timeout is 0.
*/
ogs_time_t validity_timeout;
} nf_type_array[OGS_SBI_MAX_NUM_OF_NF_TYPE],
service_type_array[OGS_SBI_MAX_NUM_OF_SERVICE_TYPE];
@ -286,6 +295,7 @@ typedef struct ogs_sbi_subscription_data_s {
OpenAPI_nf_type_e req_nf_type; /* reqNfType */
OpenAPI_nf_status_e nf_status;
char *notification_uri;
char *resource_uri;
struct {
OpenAPI_nf_type_e nf_type; /* nfType */
@ -295,7 +305,7 @@ typedef struct ogs_sbi_subscription_data_s {
uint64_t requester_features;
uint64_t nrf_supported_features;
void *client; /* only used in SERVER */
void *client;
} ogs_sbi_subscription_data_t;
typedef struct ogs_sbi_smf_info_s {
@ -461,18 +471,47 @@ int ogs_sbi_default_client_port(OpenAPI_uri_scheme_e scheme);
#define OGS_SBI_SETUP_NF_INSTANCE(__cTX, __nFInstance) \
do { \
ogs_assert(__nFInstance); \
ogs_assert((__nFInstance)->id); \
ogs_assert((__nFInstance)->t_validity); \
\
if ((__cTX).nf_instance) { \
ogs_warn("NF Instance [%s] updated [%s]", \
OpenAPI_nf_type_ToString((__nFInstance)->nf_type), \
(__nFInstance)->id); \
ogs_sbi_nf_instance_remove((__cTX).nf_instance); \
ogs_warn("[%s] NF Instance updated [type:%s validity:%ds]", \
((__cTX).nf_instance)->id, \
OpenAPI_nf_type_ToString(((__cTX).nf_instance)->nf_type), \
((__cTX).nf_instance)->time.validity_duration); \
} \
\
OGS_OBJECT_REF(__nFInstance); \
((__cTX).nf_instance) = (__nFInstance); \
((__cTX).nf_instance) = __nFInstance; \
if ((__nFInstance)->time.validity_duration) { \
((__cTX).validity_timeout) = (__nFInstance)->t_validity->timeout; \
} else { \
((__cTX).validity_timeout) = 0; \
} \
ogs_info("[%s] NF Instance setup [type:%s validity:%ds]", \
(__nFInstance)->id, \
OpenAPI_nf_type_ToString((__nFInstance)->nf_type), \
(__nFInstance)->time.validity_duration); \
} while(0)
/*
* Search.Result stored in nf_instance->time.validity_duration;
*
* validity_timeout = nf_instance->validity->timeout =
* ogs_get_monotonic_time() + nf_instance->time.validity_duration;
*
* if no validityPeriod in SearchResult, validity_timeout is 0.
*/
#define OGS_SBI_GET_NF_INSTANCE(__cTX) \
((__cTX).validity_timeout == 0 || \
(__cTX).validity_timeout > ogs_get_monotonic_time() ? \
((__cTX).nf_instance) : NULL)
#define OGS_SBI_NF_INSTANCE_VALID(__nFInstance) \
(((__nFInstance) && ((__nFInstance)->t_validity) && \
((__nFInstance)->time.validity_duration == 0 || \
(__nFInstance)->t_validity->timeout > ogs_get_monotonic_time())) ? \
true : false)
bool ogs_sbi_discovery_param_is_matched(
ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_type_e target_nf_type,
@ -515,6 +554,8 @@ void ogs_sbi_subscription_spec_remove(
void ogs_sbi_subscription_spec_remove_all(void);
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void);
void ogs_sbi_subscription_data_set_resource_uri(
ogs_sbi_subscription_data_t *subscription_data, char *resource_uri);
void ogs_sbi_subscription_data_set_id(
ogs_sbi_subscription_data_t *subscription_data, char *id);
void ogs_sbi_subscription_data_remove(

View File

@ -32,19 +32,6 @@ void ogs_sbi_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance)
ogs_sbi_nf_state_initial, ogs_sbi_nf_state_final, &e);
}
void ogs_sbi_nf_fsm_tran(ogs_sbi_nf_instance_t *nf_instance, void *state)
{
ogs_event_t e;
ogs_assert(nf_instance);
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
memset(&e, 0, sizeof(e));
e.sbi.data = nf_instance;
ogs_fsm_tran(&nf_instance->sm, state, &e);
}
void ogs_sbi_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance)
{
ogs_event_t e;
@ -307,7 +294,7 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
break;
case OGS_TIMER_NF_INSTANCE_NO_HEARTBEAT:
ogs_error("[%s:%s] No heartbeat",
ogs_error("[%s] No heartbeat [type:%s]",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
OpenAPI_nf_type_ToString(
NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance)));
@ -318,22 +305,24 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
ogs_assert(!NF_INSTANCE_TYPE_IS_NRF(nf_instance));
ogs_assert(nf_instance->id);
ogs_info("[%s] NF expired", nf_instance->id);
ogs_info("[%s] NF expired [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_de_registered);
break;
default:
ogs_error("[%s:%s] Unknown timer[%s:%d]",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_error("[%s] Unknown timer [type:%s timer:%s:%d]",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_timer_get_name(e->timer_id), e->timer_id);
}
break;
default:
ogs_error("[%s:%s] Unknown event %s",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_error("[%s] Unknown event [type:%s event:%s]",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_event_get_name(e));
break;
}
@ -353,19 +342,20 @@ void ogs_sbi_nf_state_de_registered(ogs_fsm_t *s, ogs_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
ogs_info("[%s] NF de-registered",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
}
ogs_info("[%s] NF de-registered [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
ogs_sbi_nf_fsm_fini(nf_instance);
ogs_sbi_nf_instance_remove(nf_instance);
break;
case OGS_FSM_EXIT_SIG:
break;
default:
ogs_error("[%s:%s] Unknown event %s",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_error("[%s] Unknown event [type:%s event:%s]",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_event_get_name(e));
break;
}
@ -409,9 +399,9 @@ void ogs_sbi_nf_state_exception(ogs_fsm_t *s, ogs_event_t *e)
break;
default:
ogs_error("[%s:%s] Unknown timer[%s:%d]",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_error("[%s] Unknown timer[type:%s timer:%s:%d]",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_timer_get_name(e->timer_id), e->timer_id);
}
break;
@ -437,9 +427,9 @@ void ogs_sbi_nf_state_exception(ogs_fsm_t *s, ogs_event_t *e)
break;
default:
ogs_error("[%s:%s] Unknown event %s",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_error("[%s] Unknown event [type:%s event:%s]",
nf_instance->id ? nf_instance->id : "Undefined",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
ogs_event_get_name(e));
break;
}

View File

@ -29,7 +29,6 @@ extern "C" {
#endif
void ogs_sbi_nf_fsm_init(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_fsm_tran(ogs_sbi_nf_instance_t *nf_instance, void *state);
void ogs_sbi_nf_fsm_fini(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_state_initial(ogs_fsm_t *s, ogs_event_t *e);

View File

@ -1712,11 +1712,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_update(
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PATCH;
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
message.h.api.version = (char *)OGS_SBI_API_V1;
message.h.resource.component[0] =
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
message.h.resource.component[1] = subscription_data->id;
message.h.uri = subscription_data->resource_uri;
message.http.content_type = (char *)OGS_SBI_CONTENT_PATCH_TYPE;
@ -1771,11 +1767,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
message.h.api.version = (char *)OGS_SBI_API_V1;
message.h.resource.component[0] =
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
message.h.resource.component[1] = subscription_data->id;
message.h.uri = subscription_data->resource_uri;
message.http.custom.callback =
(char *)OGS_SBI_CALLBACK_NNRF_NFMANAGEMENT_NF_STATUS_NOTIFY;

View File

@ -54,6 +54,15 @@ void ogs_nnrf_nfm_handle_nf_register(
OpenAPI_list_for_each(NFProfile->plmn_list, node) {
OpenAPI_plmn_id_t *PlmnId = node->data;
if (PlmnId) {
if (ogs_local_conf()->num_of_serving_plmn_id >=
OGS_ARRAY_SIZE(ogs_local_conf()->serving_plmn_id)) {
ogs_error("OVERFLOW NFProfile->plmn_list [%d:%d:%d]",
ogs_local_conf()->num_of_serving_plmn_id,
OGS_MAX_NUM_OF_PLMN,
(int)OGS_ARRAY_SIZE(
ogs_local_conf()->serving_plmn_id));
break;
}
ogs_sbi_parse_plmn_id(
&ogs_local_conf()->serving_plmn_id[
ogs_local_conf()->num_of_serving_plmn_id], PlmnId);
@ -96,6 +105,13 @@ void ogs_nnrf_nfm_handle_nf_profile(
OpenAPI_list_for_each(NFProfile->plmn_list, node) {
OpenAPI_plmn_id_t *PlmnId = node->data;
if (PlmnId) {
if (nf_instance->num_of_plmn_id >=
OGS_ARRAY_SIZE(nf_instance->plmn_id)) {
ogs_error("OVERFLOW NFProfile->plmn_list [%d:%d:%d]",
nf_instance->num_of_plmn_id, OGS_MAX_NUM_OF_PLMN,
(int)OGS_ARRAY_SIZE(nf_instance->plmn_id));
break;
}
ogs_sbi_parse_plmn_id(
&nf_instance->plmn_id[nf_instance->num_of_plmn_id], PlmnId);
nf_instance->num_of_plmn_id++;
@ -467,8 +483,12 @@ static void handle_smf_info(
TaiRangeItem = node->data;
if (TaiRangeItem && TaiRangeItem->plmn_id &&
TaiRangeItem->tac_range_list) {
ogs_assert(nf_info->smf.num_of_nr_tai_range <
OGS_MAX_NUM_OF_TAI);
if (nf_info->smf.num_of_nr_tai_range >= OGS_MAX_NUM_OF_TAI) {
ogs_error("OVERFLOW TaiRangeItem [%d:%d]",
nf_info->smf.num_of_nr_tai_range, OGS_MAX_NUM_OF_TAI);
break;
}
ogs_sbi_parse_plmn_id(
&nf_info->smf.nr_tai_range
@ -709,7 +729,13 @@ static void handle_amf_info(
TaiItem = node->data;
if (TaiItem && TaiItem->plmn_id && TaiItem->tac) {
ogs_5gs_tai_t *nr_tai = NULL;
ogs_assert(nf_info->amf.num_of_nr_tai < OGS_MAX_NUM_OF_TAI);
if (nf_info->amf.num_of_nr_tai >= OGS_MAX_NUM_OF_TAI) {
ogs_error("OVERFLOW TaiItem [%d:%d]",
nf_info->amf.num_of_nr_tai, OGS_MAX_NUM_OF_TAI);
break;
}
nr_tai = &nf_info->amf.nr_tai[nf_info->amf.num_of_nr_tai];
ogs_assert(nr_tai);
ogs_sbi_parse_plmn_id(&nr_tai->plmn_id, TaiItem->plmn_id);
@ -726,6 +752,12 @@ static void handle_amf_info(
ogs_assert(nf_info->amf.num_of_nr_tai_range <
OGS_MAX_NUM_OF_TAI);
if (nf_info->amf.num_of_nr_tai_range >= OGS_MAX_NUM_OF_TAI) {
ogs_error("OVERFLOW TaiRangeItem [%d:%d]",
nf_info->amf.num_of_nr_tai_range, OGS_MAX_NUM_OF_TAI);
break;
}
ogs_sbi_parse_plmn_id(
&nf_info->amf.nr_tai_range
[nf_info->amf.num_of_nr_tai_range].plmn_id,
@ -824,6 +856,17 @@ void ogs_nnrf_nfm_handle_nf_status_subscribe(
{
OpenAPI_subscription_data_t *SubscriptionData = NULL;
int rv;
ogs_sbi_message_t message;
ogs_sbi_header_t header;
bool rc;
ogs_sbi_client_t *client = NULL;
OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;
char *fqdn = NULL;
uint16_t fqdn_port = 0;
ogs_sockaddr_t *addr = NULL, *addr6 = NULL;
ogs_assert(recvmsg);
ogs_assert(subscription_data);
@ -833,45 +876,63 @@ void ogs_nnrf_nfm_handle_nf_status_subscribe(
return;
}
if (recvmsg->http.location) {
int rv;
ogs_sbi_message_t message;
ogs_sbi_header_t header;
memset(&header, 0, sizeof(header));
header.uri = recvmsg->http.location;
rv = ogs_sbi_parse_header(&message, &header);
if (rv != OGS_OK) {
ogs_error("Cannot parse http.location [%s]",
recvmsg->http.location);
return;
}
if (!message.h.resource.component[1]) {
ogs_error("No Subscription ID [%s]", recvmsg->http.location);
ogs_sbi_header_free(&header);
return;
}
ogs_sbi_subscription_data_set_id(
subscription_data, message.h.resource.component[1]);
ogs_sbi_header_free(&header);
} else if (SubscriptionData->subscription_id) {
/*
* For compatibility with v2.5.x and lower versions
*
* Deprecated : It will be removed soon.
*/
ogs_sbi_subscription_data_set_id(
subscription_data, SubscriptionData->subscription_id);
} else {
ogs_error("No Subscription ID");
if (!recvmsg->http.location) {
ogs_error("No http.location");
return;
}
memset(&header, 0, sizeof(header));
header.uri = recvmsg->http.location;
rv = ogs_sbi_parse_header(&message, &header);
if (rv != OGS_OK) {
ogs_error("Cannot parse http.location [%s]",
recvmsg->http.location);
return;
}
if (!message.h.resource.component[1]) {
ogs_error("No Subscription ID [%s]", recvmsg->http.location);
ogs_sbi_header_free(&header);
return;
}
rc = ogs_sbi_getaddr_from_uri(
&scheme, &fqdn, &fqdn_port, &addr, &addr6, header.uri);
if (rc == false || scheme == OpenAPI_uri_scheme_NULL) {
ogs_error("Invalid URI [%s]", header.uri);
ogs_sbi_header_free(&header);
return;
}
client = ogs_sbi_client_find(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_debug("%s: ogs_sbi_client_add()", OGS_FUNC);
client = ogs_sbi_client_add(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_error("%s: ogs_sbi_client_add() failed", OGS_FUNC);
ogs_sbi_header_free(&header);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
return;
}
}
OGS_SBI_SETUP_CLIENT(subscription_data, client);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
ogs_sbi_subscription_data_set_resource_uri(
subscription_data, header.uri);
ogs_sbi_subscription_data_set_id(
subscription_data, message.h.resource.component[1]);
ogs_sbi_header_free(&header);
/* SBI Features */
if (SubscriptionData->nrf_supported_features) {
subscription_data->nrf_supported_features =
@ -1026,24 +1087,23 @@ bool ogs_nnrf_nfm_handle_nf_status_notify(
nf_instance, message.h.resource.component[1]);
ogs_sbi_nf_fsm_init(nf_instance);
ogs_info("(NRF-notify) NF registered [%s:%d]",
nf_instance->id, nf_instance->reference_count);
ogs_info("[%s] (NRF-notify) NF registered", nf_instance->id);
} else {
ogs_warn("[%s] (NRF-notify) NF has already been added [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
ogs_sbi_nf_fsm_tran(nf_instance, ogs_sbi_nf_state_registered);
ogs_warn("[%s] (NRF-notify) NF has already been added [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered)) {
ogs_error("[%s] (NRF-notify) NF invalid state [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
}
}
ogs_nnrf_nfm_handle_nf_profile(nf_instance, NFProfile);
ogs_info("[%s] (NRF-notify) NF Profile updated [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_info("[%s] (NRF-notify) NF Profile updated [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
ogs_sbi_client_associate(nf_instance);
@ -1059,27 +1119,11 @@ bool ogs_nnrf_nfm_handle_nf_status_notify(
OpenAPI_notification_event_type_NF_DEREGISTERED) {
nf_instance = ogs_sbi_nf_instance_find(message.h.resource.component[1]);
if (nf_instance) {
if (OGS_OBJECT_IS_REF(nf_instance)) {
/* There are references to other contexts. */
ogs_warn("[%s] (NRF-notify) NF was referenced "
"in other contexts [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) :
"NULL",
nf_instance->id, nf_instance->reference_count);
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
ogs_sbi_nf_fsm_tran(
nf_instance, ogs_sbi_nf_state_de_registered);
} else {
ogs_info("[%s] (NRF-notify) NF_DEREGISTERED event [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) :
"NULL",
nf_instance->id, nf_instance->reference_count);
ogs_sbi_nf_fsm_fini((nf_instance));
ogs_sbi_nf_instance_remove(nf_instance);
}
ogs_info("[%s] (NRF-notify) NF_DEREGISTERED event [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
ogs_sbi_nf_fsm_fini(nf_instance);
ogs_sbi_nf_instance_remove(nf_instance);
} else {
ogs_warn("[%s] (NRF-notify) Not found",
message.h.resource.component[1]);
@ -1155,18 +1199,18 @@ void ogs_nnrf_disc_handle_nf_discover_search_result(
ogs_sbi_nf_instance_set_id(nf_instance, NFProfile->nf_instance_id);
ogs_sbi_nf_fsm_init(nf_instance);
ogs_info("[%s] (NRF-discover) NF registered [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_info("[%s] (NRF-discover) NF registered [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
} else {
ogs_warn("[%s] (NRF-discover) NF has already been added [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
ogs_sbi_nf_fsm_tran(nf_instance, ogs_sbi_nf_state_registered);
ogs_warn("[%s] (NRF-discover) NF has already been added [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered)) {
ogs_error("[%s] (NRF-notify) NF invalid state [type:%s]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type));
}
}
if (NF_INSTANCE_ID_IS_OTHERS(nf_instance->id)) {
@ -1193,15 +1237,18 @@ void ogs_nnrf_disc_handle_nf_discover_search_result(
ogs_time_from_sec(nf_instance->time.validity_duration));
} else
ogs_warn("[%s] NF Instance validity-time should not 0 [%s:%d]",
ogs_warn("[%s] NF Instance validity-time should not 0 "
"[type:%s]",
nf_instance->id,
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
OpenAPI_nf_type_ToString(nf_instance->nf_type) :
"NULL");
ogs_info("[%s] (NF-discover) NF Profile updated [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_info("[%s] (NF-discover) NF Profile updated "
"[type:%s validity:%ds]",
nf_instance->id,
OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->time.validity_duration);
}
}
}

View File

@ -208,18 +208,19 @@ static int client_discover_cb(
ogs_sbi_nf_fsm_init(nf_instance);
ogs_info("[%s] (SCP-discover) NF registered [%s:%d]",
ogs_info("[%s] (SCP-discover) NF registered [%s]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
nf_instance->id);
} else {
ogs_warn("[%s] (SCP-discover) NF has already been added [%s:%d]",
nf_instance->nf_type ?
OpenAPI_nf_type_ToString(nf_instance->nf_type) : "NULL",
nf_instance->id, nf_instance->reference_count);
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
ogs_sbi_nf_fsm_tran(nf_instance, ogs_sbi_nf_state_registered);
ogs_warn("[%s] (SCP-discover) NF has already been added [%s]",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->id);
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered)) {
ogs_error("[%s] (SCP-discover) NF invalid state [%s]",
OpenAPI_nf_type_ToString(nf_instance->nf_type),
nf_instance->id);
}
}
OGS_SBI_SETUP_NF_INSTANCE(
@ -281,7 +282,8 @@ int ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
}
/* Target NF-Instance */
nf_instance = sbi_object->service_type_array[service_type].nf_instance;
nf_instance = OGS_SBI_GET_NF_INSTANCE(
sbi_object->service_type_array[service_type]);
if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, requester_nf_type, discovery_option);
@ -313,6 +315,11 @@ int ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
if (!client) {
ogs_fatal("No Client : [%s]", request->h.uri);
ogs_assert_if_reached();
}
}
if (scp_client) {

View File

@ -46,7 +46,6 @@ if host_system == 'darwin'
libsctp_sources += files('ogs-usrsctp.c')
libsctp_conf.set('HAVE_USRSCTP', 1)
else
libsctp_conf.set('HAVE_NETINET_SCTP_H', 1)
sctp_dep = cc.find_library('sctp', required : false)
libsctp_sources += files('ogs-lksctp.c')
endif

View File

@ -16,7 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
project('open5gs', 'c', 'cpp',
version : '2.7.0',
version : '2.7.1',
license : 'AGPL-3.0-or-later',
meson_version : '>= 0.43.0',
default_options : [
@ -25,7 +25,7 @@ project('open5gs', 'c', 'cpp',
],
)
libogslib_version = '2.7.0'
libogslib_version = '2.7.1'
prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))
@ -127,7 +127,7 @@ subdir('src')
subdir('misc')
# Don't build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests and get_option('mongodb')
if build_tests
subdir('tests')
endif

View File

@ -1,4 +1,2 @@
option('fuzzing', type: 'boolean', value: false, description: 'Enable fuzzing tests')
option('lib_fuzzing_engine', type : 'string', value : '', description : 'Path to the libFuzzer engine library')
option('metrics_impl', type : 'combo', choices : ['void', 'prometheus'], value : 'void', description : 'libogsmetrics implementation')
option('mongodb', type : 'boolean', value : 'false', description : 'build with mongo db support')

View File

@ -1676,13 +1676,17 @@ void amf_ue_remove(amf_ue_t *amf_ue)
/* Clear SubscribedInfo */
amf_clear_subscribed_info(amf_ue);
if (amf_ue->policy_association_id)
ogs_free(amf_ue->policy_association_id);
if (amf_ue->data_change_subscription_id)
ogs_free(amf_ue->data_change_subscription_id);
PCF_AM_POLICY_CLEAR(amf_ue);
if (amf_ue->policy_association.client)
ogs_sbi_client_remove(amf_ue->policy_association.client);
if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
UDM_SDM_CLEAR(amf_ue);
if (amf_ue->data_change_subscription.client)
ogs_sbi_client_remove(amf_ue->data_change_subscription.client);
CLEAR_5G_AKA_CONFIRMATION(amf_ue);
if (amf_ue->confirmation_for_5g_aka.client)
ogs_sbi_client_remove(amf_ue->confirmation_for_5g_aka.client);
/* Free UeRadioCapability */
OGS_ASN_CLEAR_DATA(&amf_ue->ueRadioCapability);
@ -2249,8 +2253,10 @@ void amf_sess_remove(amf_sess_t *sess)
ogs_list_count(&sess->sbi.xact_list));
ogs_sbi_object_free(&sess->sbi);
if (sess->sm_context_ref)
ogs_free(sess->sm_context_ref);
CLEAR_SESSION_CONTEXT(sess);
if (sess->sm_context.client)
ogs_sbi_client_remove(sess->sm_context.client);
if (sess->payload_container)
ogs_pkbuf_free(sess->payload_container);

View File

@ -290,13 +290,33 @@ struct amf_ue_s {
/* PCF sends the RESPONSE
* of [POST] /npcf-am-polocy-control/v1/policies */
#define PCF_AM_POLICY_ASSOCIATED(__aMF) \
((__aMF) && ((__aMF)->policy_association_id))
((__aMF) && ((__aMF)->policy_association.id))
#define PCF_AM_POLICY_CLEAR(__aMF) \
OGS_MEM_CLEAR((__aMF)->policy_association_id);
#define PCF_AM_POLICY_STORE(__aMF, __iD) \
OGS_STRING_DUP((__aMF)->policy_association_id, __iD);
char *policy_association_id;
do { \
ogs_assert((__aMF)); \
if ((__aMF)->policy_association.resource_uri) \
ogs_free((__aMF)->policy_association.resource_uri); \
(__aMF)->policy_association.resource_uri = NULL; \
if ((__aMF)->policy_association.id) \
ogs_free((__aMF)->policy_association.id); \
(__aMF)->policy_association.id = NULL; \
} while(0)
#define PCF_AM_POLICY_STORE(__aMF, __rESOURCE_URI, __iD) \
do { \
ogs_assert((__aMF)); \
ogs_assert((__rESOURCE_URI)); \
ogs_assert((__iD)); \
PCF_AM_POLICY_CLEAR(__aMF); \
(__aMF)->policy_association.resource_uri = ogs_strdup(__rESOURCE_URI); \
ogs_assert((__aMF)->policy_association.resource_uri); \
(__aMF)->policy_association.id = ogs_strdup(__iD); \
ogs_assert((__aMF)->policy_association.id); \
} while(0)
struct {
char *resource_uri;
char *id;
ogs_sbi_client_t *client;
} policy_association;
/* 5GMM Capability */
struct {
@ -322,7 +342,27 @@ struct amf_ue_s {
/* Security Context */
ogs_nas_ue_security_capability_t ue_security_capability;
ogs_nas_ue_network_capability_t ue_network_capability;
char *confirmation_url_for_5g_aka;
#define CHECK_5G_AKA_CONFIRMATION(__aMF) \
((__aMF) && ((__aMF)->confirmation_for_5g_aka.resource_uri))
#define STORE_5G_AKA_CONFIRMATION(__aMF, __rESOURCE_URI) \
do { \
ogs_assert((__aMF)); \
CLEAR_5G_AKA_CONFIRMATION(__aMF); \
(__aMF)->confirmation_for_5g_aka.resource_uri = \
ogs_strdup(__rESOURCE_URI); \
ogs_assert((__aMF)->confirmation_for_5g_aka.resource_uri); \
} while(0)
#define CLEAR_5G_AKA_CONFIRMATION(__aMF) \
do { \
ogs_assert((__aMF)); \
if ((__aMF)->confirmation_for_5g_aka.resource_uri) \
ogs_free((__aMF)->confirmation_for_5g_aka.resource_uri); \
(__aMF)->confirmation_for_5g_aka.resource_uri = NULL; \
} while(0)
struct {
char *resource_uri;
ogs_sbi_client_t *client;
} confirmation_for_5g_aka;
uint8_t rand[OGS_RAND_LEN];
uint8_t autn[OGS_AUTN_LEN];
uint8_t xres_star[OGS_MAX_RES_LEN];
@ -468,8 +508,34 @@ struct amf_ue_s {
/* SubscriptionId of Subscription to Data Change Notification to UDM */
#define UDM_SDM_SUBSCRIBED(__aMF) \
((__aMF) && ((__aMF)->data_change_subscription_id))
char *data_change_subscription_id;
((__aMF) && ((__aMF)->data_change_subscription.id))
#define UDM_SDM_CLEAR(__aMF) \
do { \
ogs_assert((__aMF)); \
if ((__aMF)->data_change_subscription.resource_uri) \
ogs_free((__aMF)->data_change_subscription.resource_uri); \
(__aMF)->data_change_subscription.resource_uri = NULL; \
if ((__aMF)->data_change_subscription.id) \
ogs_free((__aMF)->data_change_subscription.id); \
(__aMF)->data_change_subscription.id = NULL; \
} while(0)
#define UDM_SDM_STORE(__aMF, __rESOURCE_URI, __iD) \
do { \
ogs_assert((__aMF)); \
ogs_assert((__rESOURCE_URI)); \
ogs_assert((__iD)); \
UDM_SDM_CLEAR(__aMF); \
(__aMF)->data_change_subscription.resource_uri = \
ogs_strdup(__rESOURCE_URI); \
ogs_assert((__aMF)->data_change_subscription.resource_uri); \
(__aMF)->data_change_subscription.id = ogs_strdup(__iD); \
ogs_assert((__aMF)->data_change_subscription.id); \
} while(0)
struct {
char *resource_uri;
char *id;
ogs_sbi_client_t *client;
} data_change_subscription;
struct {
/*
@ -499,18 +565,37 @@ typedef struct amf_sess_s {
uint8_t pti; /* Procedure Trasaction Identity */
#define SESSION_CONTEXT_IN_SMF(__sESS) \
((__sESS) && (__sESS)->sm_context_ref)
#define CLEAR_SM_CONTEXT_REF(__sESS) \
((__sESS) && (__sESS)->sm_context.ref)
#define STORE_SESSION_CONTEXT(__sESS, __rESOURCE_URI, __rEF) \
do { \
ogs_assert(__sESS); \
ogs_assert((__sESS)->sm_context_ref); \
ogs_free((__sESS)->sm_context_ref); \
(__sESS)->sm_context_ref = NULL; \
ogs_assert(__rESOURCE_URI); \
ogs_assert(__rEF); \
CLEAR_SESSION_CONTEXT(__sESS); \
(__sESS)->sm_context.resource_uri = ogs_strdup(__rESOURCE_URI); \
ogs_assert((__sESS)->sm_context.resource_uri); \
(__sESS)->sm_context.ref = ogs_strdup(__rEF); \
ogs_assert((__sESS)->sm_context.ref); \
} while(0);
#define CLEAR_SESSION_CONTEXT(__sESS) \
do { \
ogs_assert(__sESS); \
if ((__sESS)->sm_context.ref) \
ogs_free((__sESS)->sm_context.ref); \
(__sESS)->sm_context.ref = NULL; \
if ((__sESS)->sm_context.resource_uri) \
ogs_free((__sESS)->sm_context.resource_uri); \
(__sESS)->sm_context.resource_uri = NULL; \
} while(0);
/* SMF sends the RESPONSE
* of [POST] /nsmf-pdusession/v1/sm-contexts */
char *sm_context_ref;
struct {
char *resource_uri;
char *ref;
ogs_sbi_client_t *client;
} sm_context;
bool pdu_session_release_complete_received;
bool pdu_session_resource_release_response_received;

View File

@ -1283,9 +1283,11 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
sess->s_nssai.sd.v = selected_slice->s_nssai.sd.v;
ogs_info("UE SUPI[%s] DNN[%s] S_NSSAI[SST:%d SD:0x%x] "
"smContextRef [%s]",
"smContextRef[%s] smContextResourceURI[%s]",
amf_ue->supi, sess->dnn, sess->s_nssai.sst, sess->s_nssai.sd.v,
sess->sm_context_ref ? sess->sm_context_ref : "NULL");
sess->sm_context.ref ? sess->sm_context.ref : "NULL",
sess->sm_context.resource_uri ?
sess->sm_context.resource_uri : "NULL");
if (!SESSION_CONTEXT_IN_SMF(sess)) {
ogs_sbi_nf_instance_t *nf_instance = NULL;
@ -1303,8 +1305,8 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
ogs_sbi_discovery_option_set_tai(
discovery_option, &amf_ue->nr_tai);
nf_instance = sess->sbi.
service_type_array[service_type].nf_instance;
nf_instance = OGS_SBI_GET_NF_INSTANCE(
sess->sbi.service_type_array[service_type]);
if (!nf_instance) {
OpenAPI_nf_type_e requester_nf_type =
NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
@ -1315,8 +1317,8 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION,
requester_nf_type,
discovery_option);
nf_instance = sess->sbi.
service_type_array[service_type].nf_instance;
nf_instance = OGS_SBI_GET_NF_INSTANCE(
sess->sbi.service_type_array[service_type]);
if (!nf_instance)
ogs_info("No SMF Instance");
@ -1435,7 +1437,7 @@ int gmm_handle_ul_nas_transport(ran_ue_t *ran_ue, amf_ue_t *amf_ue,
sess->pdu_session_release_complete_received = true;
if (sess->pdu_session_resource_release_response_received ==
true)
CLEAR_SM_CONTEXT_REF(sess);
CLEAR_SESSION_CONTEXT(sess);
break;
default:
break;
@ -1676,7 +1678,7 @@ static void amf_namf_comm_decode_ue_session_context_list(
sess = amf_sess_add(amf_ue, PduSessionContext->pdu_session_id);
ogs_assert(sess);
sess->sm_context_ref = PduSessionContext->sm_context_ref;
sess->sm_context.ref = PduSessionContext->sm_context_ref;
if (PduSessionContext->s_nssai) {
memset(&sess->s_nssai, 0, sizeof(sess->s_nssai));

View File

@ -274,9 +274,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
ogs_warn("[%s] Ignore SBI message", amf_ue->suci);
break;
CASE(OGS_SBI_HTTP_METHOD_DELETE)
if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
amf_ue->confirmation_url_for_5g_aka = NULL;
CLEAR_5G_AKA_CONFIRMATION(amf_ue);
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) {
@ -378,10 +376,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
*/
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) {
if (amf_ue->data_change_subscription_id) {
ogs_free(amf_ue->data_change_subscription_id);
amf_ue->data_change_subscription_id = NULL;
}
UDM_SDM_CLEAR(amf_ue);
r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
@ -447,7 +442,7 @@ void gmm_state_de_registered(ogs_fsm_t *s, amf_event_t *e)
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) {
if (amf_ue->confirmation_url_for_5g_aka) {
if (CHECK_5G_AKA_CONFIRMATION(amf_ue)) {
r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH,
NULL,
@ -857,9 +852,7 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
ogs_warn("[%s] Ignore SBI message", amf_ue->suci);
break;
CASE(OGS_SBI_HTTP_METHOD_DELETE)
if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
amf_ue->confirmation_url_for_5g_aka = NULL;
CLEAR_5G_AKA_CONFIRMATION(amf_ue);
if (state == AMF_RELEASE_SM_CONTEXT_NO_STATE ||
state == AMF_UE_INITIATED_DE_REGISTERED) {
@ -967,10 +960,7 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
AMF_NETWORK_INITIATED_IMPLICIT_DE_REGISTERED ||
state ==
AMF_NETWORK_INITIATED_EXPLICIT_DE_REGISTERED) {
if (amf_ue->data_change_subscription_id) {
ogs_free(amf_ue->data_change_subscription_id);
amf_ue->data_change_subscription_id = NULL;
}
UDM_SDM_CLEAR(amf_ue);
r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NUDM_UECM, NULL,
@ -1044,7 +1034,7 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
state ==
AMF_NETWORK_INITIATED_EXPLICIT_DE_REGISTERED) {
if (amf_ue->confirmation_url_for_5g_aka) {
if (amf_ue->confirmation_for_5g_aka.resource_uri) {
r = amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NAUSF_AUTH,
NULL,

View File

@ -38,6 +38,10 @@ int amf_initialize(void)
ogs_sbi_context_init(OpenAPI_nf_type_AMF);
amf_context_init();
rv = ogs_log_config_domain(
ogs_app()->logger.domain, ogs_app()->logger.level);
if (rv != OGS_OK) return rv;
rv = ogs_sbi_context_parse_config(APP_NAME, "nrf", "scp");
if (rv != OGS_OK) return rv;
@ -50,10 +54,6 @@ int amf_initialize(void)
rv = amf_context_nf_info();
if (rv != OGS_OK) return rv;
rv = ogs_log_config_domain(
ogs_app()->logger.domain, ogs_app()->logger.level);
if (rv != OGS_OK) return rv;
ogs_metrics_context_open(ogs_metrics_self());
rv = amf_sbi_open();

View File

@ -246,7 +246,7 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
amf_ue->supi, sess->psi,
N1N2MessageTransferReqData->
n1n2_failure_txf_notif_uri);
return OGS_ERROR;;
return OGS_ERROR;
}
client = ogs_sbi_client_find(
@ -287,7 +287,7 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
header.resource.component[1] = amf_ue->supi;
header.resource.component[2] =
(char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES;
header.resource.component[3] = sess->sm_context_ref;
header.resource.component[3] = sess->sm_context.ref;
sendmsg.http.location = ogs_sbi_server_uri(server, &header);
@ -349,13 +349,12 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
header.resource.component[1] = amf_ue->supi;
header.resource.component[2] =
(char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES;
header.resource.component[3] = sess->sm_context_ref;
header.resource.component[3] = sess->sm_context.ref;
sendmsg.http.location = ogs_sbi_server_uri(server, &header);
/* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(
sess, sendmsg.http.location, NULL);
AMF_SESS_STORE_PAGING_INFO(sess, sendmsg.http.location, NULL);
/* Store 5GSM Message */
AMF_SESS_STORE_5GSM_MESSAGE(sess,
@ -424,13 +423,12 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
header.resource.component[1] = amf_ue->supi;
header.resource.component[2] =
(char *)OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES;
header.resource.component[3] = sess->sm_context_ref;
header.resource.component[3] = sess->sm_context.ref;
sendmsg.http.location = ogs_sbi_server_uri(server, &header);
/* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(
sess, sendmsg.http.location, NULL);
AMF_SESS_STORE_PAGING_INFO(sess, sendmsg.http.location, NULL);
/* Store 5GSM Message */
AMF_SESS_STORE_5GSM_MESSAGE(sess,
@ -1174,7 +1172,7 @@ static OpenAPI_list_t *amf_namf_comm_encode_ue_session_context_list(amf_ue_t *am
ogs_assert(sNSSAI);
PduSessionContext->pdu_session_id = sess->psi;
PduSessionContext->sm_context_ref = sess->sm_context_ref;
PduSessionContext->sm_context_ref = sess->sm_context.ref;
sNSSAI->sst = sess->s_nssai.sst;
sNSSAI->sd = ogs_s_nssai_sd_to_string(sess->s_nssai.sd);
@ -1335,6 +1333,8 @@ int amf_namf_comm_handle_ue_context_transfer_request(
OpenAPI_ue_context_transfer_rsp_data_t UeContextTransferRspData;
ogs_sbi_nf_instance_t *pcf_nf_instance = NULL;
char *ue_context_id = NULL;
char *encoded_gmm_capability = NULL;
int status = OGS_SBI_HTTP_STATUS_OK;
@ -1418,8 +1418,14 @@ int amf_namf_comm_handle_ue_context_transfer_request(
encoded_gmm_capability = amf_namf_comm_base64_encode_5gmm_capability(amf_ue);
UeContext._5g_mm_capability = encoded_gmm_capability;
UeContext.pcf_id = amf_ue->sbi.service_type_array[
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL].nf_instance->id;
pcf_nf_instance = OGS_SBI_GET_NF_INSTANCE(
amf_ue->sbi.service_type_array[
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL]);
if (pcf_nf_instance) {
UeContext.pcf_id = pcf_nf_instance->id;
} else {
ogs_warn("No PCF NF Instnace");
}
/* TODO UeContext.pcfAmPolicyUri */
/* TODO UeContext.pcfUePolicyUri */

View File

@ -87,11 +87,11 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate_delete(
ogs_sbi_request_t *request = NULL;
ogs_assert(amf_ue);
ogs_assert(amf_ue->confirmation_url_for_5g_aka);
ogs_assert(amf_ue->confirmation_for_5g_aka.resource_uri);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
message.h.uri = amf_ue->confirmation_url_for_5g_aka;
message.h.uri = amf_ue->confirmation_for_5g_aka.resource_uri;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
@ -110,11 +110,11 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation(
OpenAPI_confirmation_data_t *ConfirmationData = NULL;
ogs_assert(amf_ue);
ogs_assert(amf_ue->confirmation_url_for_5g_aka);
ogs_assert(amf_ue->confirmation_for_5g_aka.resource_uri);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT;
message.h.uri = amf_ue->confirmation_url_for_5g_aka;
message.h.uri = amf_ue->confirmation_for_5g_aka.resource_uri;
ConfirmationData = ogs_calloc(1, sizeof(*ConfirmationData));
if (!ConfirmationData) {

View File

@ -30,9 +30,21 @@ int amf_nausf_auth_handle_authenticate(
OpenAPI_map_t *LinksValueScheme = NULL;
OpenAPI_lnode_t *node = NULL;
bool rc;
ogs_sbi_client_t *client = NULL;
OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;
char *fqdn = NULL;
uint16_t fqdn_port = 0;
ogs_sockaddr_t *addr = NULL, *addr6 = NULL;
ogs_assert(amf_ue);
ogs_assert(message);
if (!message->http.location) {
ogs_error("[%s] No http.location", amf_ue->suci);
return OGS_ERROR;
}
UeAuthenticationCtx = message->UeAuthenticationCtx;
if (!UeAuthenticationCtx) {
ogs_error("[%s] No UeAuthenticationCtx", amf_ue->suci);
@ -92,11 +104,36 @@ int amf_nausf_auth_handle_authenticate(
return OGS_ERROR;
}
if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
amf_ue->confirmation_url_for_5g_aka =
ogs_strdup(LinksValueSchemeValue->href);
ogs_assert(amf_ue->confirmation_url_for_5g_aka);
rc = ogs_sbi_getaddr_from_uri(
&scheme, &fqdn, &fqdn_port, &addr, &addr6, message->http.location);
if (rc == false || scheme == OpenAPI_uri_scheme_NULL) {
ogs_error("[%s] Invalid URI [%s]",
amf_ue->suci, message->http.location);
return OGS_ERROR;
}
client = ogs_sbi_client_find(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_debug("[%s] ogs_sbi_client_add()", amf_ue->suci);
client = ogs_sbi_client_add(scheme, fqdn, fqdn_port, addr, addr6);
if (!client) {
ogs_error("[%s] ogs_sbi_client_add() failed", amf_ue->suci);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
return OGS_ERROR;
}
}
OGS_SBI_SETUP_CLIENT(&amf_ue->confirmation_for_5g_aka, client);
ogs_free(fqdn);
ogs_freeaddrinfo(addr);
ogs_freeaddrinfo(addr6);
STORE_5G_AKA_CONFIRMATION(amf_ue, message->http.location);
ogs_ascii_to_hex(AV5G_AKA->rand, strlen(AV5G_AKA->rand),
amf_ue->rand, sizeof(amf_ue->rand));

View File

@ -209,6 +209,16 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
i++) {
NGAP_SupportedTAItem_t *SupportedTAItem = NULL;
if (gnb->num_of_supported_ta_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list)) {
ogs_error("OVERFLOW GNB->num_of_supported_ta_list "
"[%d:%d:%d]",
gnb->num_of_supported_ta_list,
OGS_MAX_NUM_OF_SUPPORTED_TA,
(int)OGS_ARRAY_SIZE(gnb->supported_ta_list));
break;
}
SupportedTAItem = (NGAP_SupportedTAItem_t *)
SupportedTAList->list.array[i];
if (!SupportedTAItem) {
@ -235,6 +245,17 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
NGAP_BroadcastPLMNItem_t *BroadcastPLMNItem = NULL;
NGAP_PLMNIdentity_t *pLMNIdentity = NULL;
if (gnb->supported_ta_list[i].num_of_bplmn_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list[i].bplmn_list)) {
ogs_error("OVERFLOW GNB->supported_ta_list.num_of_bplmn_list "
"[%d:%d:%d]",
gnb->supported_ta_list[i].num_of_bplmn_list,
OGS_MAX_NUM_OF_BPLMN,
(int)OGS_ARRAY_SIZE(
gnb->supported_ta_list[i].bplmn_list));
break;
}
BroadcastPLMNItem = (NGAP_BroadcastPLMNItem_t *)
SupportedTAItem->broadcastPLMNList.list.array[j];
if (!BroadcastPLMNItem) {
@ -268,6 +289,19 @@ void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
NGAP_SliceSupportItem_t *SliceSupportItem = NULL;
NGAP_S_NSSAI_t *s_NSSAI = NULL;
if (gnb->supported_ta_list[i].bplmn_list[j].num_of_s_nssai >=
OGS_ARRAY_SIZE(
gnb->supported_ta_list[i].bplmn_list[j].s_nssai)) {
ogs_error("OVERFLOW GNB->supported_ta_list."
"bplmn_list.num_of_s_nssai [%d:%d:%d]",
gnb->supported_ta_list[i].bplmn_list[j].
num_of_s_nssai,
OGS_MAX_NUM_OF_SLICE_SUPPORT,
(int)OGS_ARRAY_SIZE(gnb->
supported_ta_list[i].bplmn_list[j].s_nssai));
break;
}
SliceSupportItem = (NGAP_SliceSupportItem_t *)
BroadcastPLMNItem->tAISliceSupportList.list.array[k];
if (!SliceSupportItem) {
@ -2516,7 +2550,7 @@ void ngap_handle_pdu_session_resource_release_response(
sess->pdu_session_resource_release_response_received = true;
if (sess->pdu_session_release_complete_received == true)
CLEAR_SM_CONTEXT_REF(sess);
CLEAR_SESSION_CONTEXT(sess);
}
}
@ -4272,6 +4306,16 @@ void ngap_handle_ran_configuration_update(
i++) {
NGAP_SupportedTAItem_t *SupportedTAItem = NULL;
if (gnb->num_of_supported_ta_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list)) {
ogs_error("OVERFLOW GNB->num_of_supported_ta_list "
"[%d:%d:%d]",
gnb->num_of_supported_ta_list,
OGS_MAX_NUM_OF_SUPPORTED_TA,
(int)OGS_ARRAY_SIZE(gnb->supported_ta_list));
break;
}
SupportedTAItem = (NGAP_SupportedTAItem_t *)
SupportedTAList->list.array[i];
if (!SupportedTAItem) {
@ -4299,6 +4343,17 @@ void ngap_handle_ran_configuration_update(
NGAP_BroadcastPLMNItem_t *BroadcastPLMNItem = NULL;
NGAP_PLMNIdentity_t *pLMNIdentity = NULL;
if (gnb->supported_ta_list[i].num_of_bplmn_list >=
OGS_ARRAY_SIZE(gnb->supported_ta_list[i].bplmn_list)) {
ogs_error("OVERFLOW GNB->supported_ta_list."
"num_of_bplm_list [%d:%d:%d]",
gnb->supported_ta_list[i].num_of_bplmn_list,
OGS_MAX_NUM_OF_BPLMN,
(int)OGS_ARRAY_SIZE(
gnb->supported_ta_list[i].bplmn_list));
break;
}
BroadcastPLMNItem = (NGAP_BroadcastPLMNItem_t *)
SupportedTAItem->broadcastPLMNList.list.array[j];
if (!BroadcastPLMNItem) {
@ -4333,6 +4388,21 @@ void ngap_handle_ran_configuration_update(
NGAP_SliceSupportItem_t *SliceSupportItem = NULL;
NGAP_S_NSSAI_t *s_NSSAI = NULL;
if (gnb->supported_ta_list[i].
bplmn_list[j].num_of_s_nssai >=
OGS_ARRAY_SIZE(gnb->supported_ta_list[i].
bplmn_list[j].s_nssai)) {
ogs_error("OVERFLOW GNB->num_of_supported_ta_list."
"bplmn_list.num_of_s_nssai"
"[%d:%d:%d]",
gnb->supported_ta_list[i].bplmn_list[j].
num_of_s_nssai,
OGS_MAX_NUM_OF_SLICE_SUPPORT,
(int)OGS_ARRAY_SIZE(gnb->supported_ta_list[i].
bplmn_list[j].s_nssai));
break;
}
SliceSupportItem = (NGAP_SliceSupportItem_t *)
BroadcastPLMNItem->tAISliceSupportList.list.array[k];
if (!SliceSupportItem) {

View File

@ -200,6 +200,7 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
default:
ogs_error("Not implemented(security header type:0x%x)",
sh->security_header_type);
ran_ue_remove(ran_ue);
return OGS_ERROR;
}
@ -207,12 +208,39 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
if (nas_5gs_security_decode(ran_ue->amf_ue,
security_header_type, nasbuf) != OGS_OK) {
ogs_error("nas_eps_security_decode failed()");
ran_ue_remove(ran_ue);
return OGS_ERROR;
}
}
h = (ogs_nas_5gmm_header_t *)nasbuf->data;
ogs_assert(h);
if (procedureCode == NGAP_ProcedureCode_id_InitialUEMessage) {
if (h->extended_protocol_discriminator !=
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) {
ogs_error("Invalid extended_protocol_discriminator [%d]",
h->extended_protocol_discriminator);
ogs_pkbuf_free(nasbuf);
ran_ue_remove(ran_ue);
return OGS_ERROR;
}
if (h->message_type != OGS_NAS_5GS_REGISTRATION_REQUEST &&
h->message_type != OGS_NAS_5GS_SERVICE_REQUEST &&
h->message_type != OGS_NAS_5GS_DEREGISTRATION_REQUEST_FROM_UE) {
ogs_error("Invalid 5GMM message type [%d]", h->message_type);
ogs_pkbuf_free(nasbuf);
ran_ue_remove(ran_ue);
return OGS_ERROR;
}
}
if (h->extended_protocol_discriminator ==
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) {
e = amf_event_new(AMF_EVENT_5GMM_MESSAGE);
@ -247,7 +275,10 @@ int ngap_send_to_nas(ran_ue_t *ran_ue,
} else {
ogs_error("Unknown NAS Protocol discriminator 0x%02x",
h->extended_protocol_discriminator);
ogs_pkbuf_free(nasbuf);
ran_ue_remove(ran_ue);
return OGS_ERROR;
}
}

Some files were not shown because too many files have changed in this diff Show More