Changes of Revision 202

commit_939b311b2d534d1e3b022f8db3f448d434e306ab.txt Deleted
commit_b9a3157467c86581c7cdef244f2674dcfa6cd250.txt Added
open5gs_2.6.1.26.939b3.dsc Deleted
x
 
1
@@ -1,38 +0,0 @@
2
-Format: 3.0 (native)
3
-Source: open5gs
4
-Binary: open5gs-common, open5gs-mme, open5gs-sgwc, open5gs-smf, open5gs-amf, open5gs-sgwu, open5gs-upf, open5gs-hss, open5gs-pcrf, open5gs-nrf, open5gs-scp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg
5
-Architecture: any
6
-Version: 2.6.1.26.939b3
7
-Maintainer: Harald Welte <laforge@gnumonks.org>
8
-Uploaders: Sukchan Lee <acetcom@gmail.com>
9
-Homepage: https://open5gs.org
10
-Standards-Version: 4.3.0
11
-Vcs-Browser: https://github.com/open5gs/open5gs
12
-Vcs-Git: git://github.com/open5gs/open5gs
13
-Build-Depends: debhelper (>= 11), git, pkg-config, meson (>= 0.43.0), cmake, flex, bison, libgnutls28-dev, libgcrypt-dev, libssl-dev, libidn11-dev, libmongoc-dev, libbson-dev, libsctp-dev, libyaml-dev, libmicrohttpd-dev, libcurl4-gnutls-dev, libnghttp2-dev, libtins-dev, libtalloc-dev
14
-Package-List:
15
- open5gs deb net optional arch=any
16
- open5gs-amf deb net optional arch=any
17
- open5gs-ausf deb net optional arch=any
18
- open5gs-bsf deb net optional arch=any
19
- open5gs-common deb net optional arch=any
20
- open5gs-dbg deb net optional arch=any
21
- open5gs-hss deb net optional arch=any
22
- open5gs-mme deb net optional arch=any
23
- open5gs-nrf deb net optional arch=any
24
- open5gs-nssf deb net optional arch=any
25
- open5gs-pcf deb net optional arch=any
26
- open5gs-pcrf deb net optional arch=any
27
- open5gs-scp deb net optional arch=any
28
- open5gs-sgwc deb net optional arch=any
29
- open5gs-sgwu deb net optional arch=any
30
- open5gs-smf deb net optional arch=any
31
- open5gs-udm deb net optional arch=any
32
- open5gs-udr deb net optional arch=any
33
- open5gs-upf deb net optional arch=any
34
-Checksums-Sha1:
35
- bd31c11fffcb2a34f8a3c844ae37f9a78241a1bc 14111796 open5gs_2.6.1.26.939b3.tar.xz
36
-Checksums-Sha256:
37
- afd945a3cef416dff318c68e4d8a0dc1386a303db447a0a9dce68e8fe8e0bcde 14111796 open5gs_2.6.1.26.939b3.tar.xz
38
-Files:
39
- 0b9775b2039d1c4fe2e5fefad1e7b4fe 14111796 open5gs_2.6.1.26.939b3.tar.xz
40
open5gs_2.6.1.27.b9a3.dsc Added
40
 
1
@@ -0,0 +1,38 @@
2
+Format: 3.0 (native)
3
+Source: open5gs
4
+Binary: open5gs-common, open5gs-mme, open5gs-sgwc, open5gs-smf, open5gs-amf, open5gs-sgwu, open5gs-upf, open5gs-hss, open5gs-pcrf, open5gs-nrf, open5gs-scp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg
5
+Architecture: any
6
+Version: 2.6.1.27.b9a3
7
+Maintainer: Harald Welte <laforge@gnumonks.org>
8
+Uploaders: Sukchan Lee <acetcom@gmail.com>
9
+Homepage: https://open5gs.org
10
+Standards-Version: 4.3.0
11
+Vcs-Browser: https://github.com/open5gs/open5gs
12
+Vcs-Git: git://github.com/open5gs/open5gs
13
+Build-Depends: debhelper (>= 11), git, pkg-config, meson (>= 0.43.0), cmake, flex, bison, libgnutls28-dev, libgcrypt-dev, libssl-dev, libidn11-dev, libmongoc-dev, libbson-dev, libsctp-dev, libyaml-dev, libmicrohttpd-dev, libcurl4-gnutls-dev, libnghttp2-dev, libtins-dev, libtalloc-dev
14
+Package-List:
15
+ open5gs deb net optional arch=any
16
+ open5gs-amf deb net optional arch=any
17
+ open5gs-ausf deb net optional arch=any
18
+ open5gs-bsf deb net optional arch=any
19
+ open5gs-common deb net optional arch=any
20
+ open5gs-dbg deb net optional arch=any
21
+ open5gs-hss deb net optional arch=any
22
+ open5gs-mme deb net optional arch=any
23
+ open5gs-nrf deb net optional arch=any
24
+ open5gs-nssf deb net optional arch=any
25
+ open5gs-pcf deb net optional arch=any
26
+ open5gs-pcrf deb net optional arch=any
27
+ open5gs-scp deb net optional arch=any
28
+ open5gs-sgwc deb net optional arch=any
29
+ open5gs-sgwu deb net optional arch=any
30
+ open5gs-smf deb net optional arch=any
31
+ open5gs-udm deb net optional arch=any
32
+ open5gs-udr deb net optional arch=any
33
+ open5gs-upf deb net optional arch=any
34
+Checksums-Sha1:
35
+ e43def5aa87a9b7e3a81c24aae0b15f6beb4b495 14113196 open5gs_2.6.1.27.b9a3.tar.xz
36
+Checksums-Sha256:
37
+ 0f1ff0f463d862f4982ae7948220b8290da61988b9f46bcb8ffdf4f6711914d0 14113196 open5gs_2.6.1.27.b9a3.tar.xz
38
+Files:
39
+ a19ed7eb09eff6114a8f0f0a9d889899 14113196 open5gs_2.6.1.27.b9a3.tar.xz
40
open5gs_2.6.1.26.939b3.tar.xz/.tarball-version -> open5gs_2.6.1.27.b9a3.tar.xz/.tarball-version Changed
4
 
1
@@ -1 +1 @@
2
-2.6.1.26-939b3
3
+2.6.1.27-b9a3
4
open5gs_2.6.1.26.939b3.tar.xz/debian/changelog -> open5gs_2.6.1.27.b9a3.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-open5gs (2.6.1.26.939b3) unstable; urgency=medium
3
+open5gs (2.6.1.27.b9a3) unstable; urgency=medium
4
 
5
   * Automatically generated changelog entry for building the Osmocom master feed
6
 
7
- -- Osmocom OBS scripts <info@osmocom.org>  Sat, 01 Apr 2023 02:55:23 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org>  Tue, 04 Apr 2023 12:27:11 +0000
9
 
10
 open5gs (2.6.1) unstable; urgency=medium
11
 
12
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/build.c -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/build.c Changed
62
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -36,7 +36,7 @@
9
     req = &pfcp_message->pfcp_heartbeat_request;
10
 
11
     req->recovery_time_stamp.presence = 1;
12
-    req->recovery_time_stamp.u32 = ogs_pfcp_self()->pfcp_started;
13
+    req->recovery_time_stamp.u32 = ogs_pfcp_self()->local_recovery;
14
 
15
     pfcp_message->h.type = type;
16
     pkbuf = ogs_pfcp_build_msg(pfcp_message);
17
@@ -64,7 +64,7 @@
18
     rsp = &pfcp_message->pfcp_heartbeat_response;
19
 
20
     rsp->recovery_time_stamp.presence = 1;
21
-    rsp->recovery_time_stamp.u32 = ogs_pfcp_self()->pfcp_started;
22
+    rsp->recovery_time_stamp.u32 = ogs_pfcp_self()->local_recovery;
23
 
24
     pfcp_message->h.type = type;
25
     pkbuf = ogs_pfcp_build_msg(pfcp_message);
26
@@ -105,7 +105,7 @@
27
     req->node_id.len = node_id_len;
28
 
29
     req->recovery_time_stamp.presence = 1;
30
-    req->recovery_time_stamp.u32 = ogs_pfcp_self()->pfcp_started;
31
+    req->recovery_time_stamp.u32 = ogs_pfcp_self()->local_recovery;
32
 
33
     req->cp_function_features.presence = 1;
34
     req->cp_function_features.u8 = ogs_pfcp_self()->cp_function_features.octet5;
35
@@ -153,7 +153,7 @@
36
     rsp->cause.u8 = cause;
37
 
38
     rsp->recovery_time_stamp.presence = 1;
39
-    rsp->recovery_time_stamp.u32 = ogs_pfcp_self()->pfcp_started;
40
+    rsp->recovery_time_stamp.u32 = ogs_pfcp_self()->local_recovery;
41
 
42
     rsp->cp_function_features.presence = 1;
43
     rsp->cp_function_features.u8 = ogs_pfcp_self()->cp_function_features.octet5;
44
@@ -202,7 +202,7 @@
45
     req->node_id.len = node_id_len;
46
 
47
     req->recovery_time_stamp.presence = 1;
48
-    req->recovery_time_stamp.u32 = ogs_pfcp_self()->pfcp_started;
49
+    req->recovery_time_stamp.u32 = ogs_pfcp_self()->local_recovery;
50
 
51
     ogs_assert(ogs_pfcp_self()->up_function_features_len);
52
     req->up_function_features.presence = 1;
53
@@ -273,7 +273,7 @@
54
     rsp->cause.u8 = cause;
55
 
56
     rsp->recovery_time_stamp.presence = 1;
57
-    rsp->recovery_time_stamp.u32 = ogs_pfcp_self()->pfcp_started;
58
+    rsp->recovery_time_stamp.u32 = ogs_pfcp_self()->local_recovery;
59
 
60
     ogs_assert(ogs_pfcp_self()->up_function_features_len);
61
     rsp->up_function_features.presence = 1;
62
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/context.c -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/context.c Changed
45
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -44,7 +44,7 @@
9
     /* Initialize SMF context */
10
     memset(&self, 0, sizeof(ogs_pfcp_context_t));
11
 
12
-    self.pfcp_started = ogs_time_ntp32_now();
13
+    self.local_recovery = ogs_time_ntp32_now();
14
 
15
     ogs_log_install_domain(&__ogs_pfcp_domain, "pfcp", ogs_core()->log.level);
16
 
17
@@ -455,9 +455,6 @@
18
                         uint64_t nr_cell_idOGS_MAX_NUM_OF_CELL_ID = {0,};
19
                         int num_of_nr_cell_id = 0;
20
 
21
-                        /* full list RR enabled by default */
22
-                        uint8_t rr_enable = 1;
23
-
24
                         if (ogs_yaml_iter_type(&pfcp_array) ==
25
                                 YAML_MAPPING_NODE) {
26
                             memcpy(&pfcp_iter, &pfcp_array,
27
@@ -621,9 +618,6 @@
28
                                 } while (
29
                                     ogs_yaml_iter_type(&nr_cell_id_iter) ==
30
                                         YAML_SEQUENCE_NODE);
31
-                            } else if (!strcmp(pfcp_key, "rr")) {
32
-                                const char *v = ogs_yaml_iter_value(&pfcp_iter);
33
-                                if (v) rr_enable = atoi(v);
34
                             } else
35
                                 ogs_warn("unknown key `%s`", pfcp_key);
36
                         }
37
@@ -664,7 +658,6 @@
38
                             memcpy(node->nr_cell_id, nr_cell_id,
39
                                     sizeof(node->nr_cell_id));
40
 
41
-                        node->rr_enable = rr_enable;
42
                     } while (ogs_yaml_iter_type(&pfcp_array) ==
43
                             YAML_SEQUENCE_NODE);
44
                 }
45
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/context.h -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/context.h Changed
28
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -55,7 +55,7 @@
9
     ogs_sockaddr_t  *pfcp_addr;     /* PFCP IPv4 Address */
10
     ogs_sockaddr_t  *pfcp_addr6;    /* PFCP IPv6 Address */
11
 
12
-    uint32_t        pfcp_started;   /* UTC time when the PFCP entity started */
13
+    uint32_t        local_recovery; /* UTC time */
14
 
15
     /* CP Function Features */
16
     ogs_pfcp_cp_function_features_t cp_function_features;
17
@@ -105,8 +105,8 @@
18
     uint64_t        nr_cell_idOGS_MAX_NUM_OF_CELL_ID;
19
     uint8_t         num_of_nr_cell_id;
20
 
21
-    /* flag to enable/ disable full list RR for this node */
22
-    uint8_t         rr_enable;
23
+    uint32_t        remote_recovery; /* UTC time */
24
+    bool            restoration_required;
25
 
26
     ogs_list_t      gtpu_resource_list; /* User Plane IP Resource Information */
27
 
28
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/handler.c -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/handler.c Changed
67
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -24,7 +24,27 @@
9
         ogs_pfcp_heartbeat_request_t *req)
10
 {
11
     int rv;
12
+    ogs_assert(node);
13
     ogs_assert(xact);
14
+    ogs_assert(req);
15
+
16
+    if (req->recovery_time_stamp.presence == 0) {
17
+        ogs_error("No Recovery Time Stamp");
18
+        return false;
19
+    }
20
+
21
+    if (node->remote_recovery == 0 ||
22
+        node->remote_recovery == req->recovery_time_stamp.u32) {
23
+    } else if (node->remote_recovery < req->recovery_time_stamp.u32) {
24
+        ogs_error("Remote PFCP restarted %u<%u in Heartbeat REQ",
25
+            node->remote_recovery, req->recovery_time_stamp.u32);
26
+        node->restoration_required = true;
27
+    } else if (node->remote_recovery > req->recovery_time_stamp.u32) {
28
+        ogs_error("Invalid Recovery Time Stamp %u>%u in Heartbeat REQ",
29
+        node->remote_recovery, req->recovery_time_stamp.u32);
30
+    }
31
+
32
+    node->remote_recovery = req->recovery_time_stamp.u32;
33
 
34
     rv = ogs_pfcp_send_heartbeat_response(xact);
35
     if (rv != OGS_OK) {
36
@@ -39,9 +59,30 @@
37
         ogs_pfcp_node_t *node, ogs_pfcp_xact_t *xact,
38
         ogs_pfcp_heartbeat_response_t *rsp)
39
 {
40
+    ogs_assert(node);
41
     ogs_assert(xact);
42
+    ogs_assert(rsp);
43
+
44
     ogs_pfcp_xact_commit(xact);
45
 
46
+    if (rsp->recovery_time_stamp.presence == 0) {
47
+        ogs_error("No Recovery Time Stamp");
48
+        return false;
49
+    }
50
+
51
+    if (node->remote_recovery == 0 ||
52
+        node->remote_recovery == rsp->recovery_time_stamp.u32) {
53
+    } else if (node->remote_recovery < rsp->recovery_time_stamp.u32) {
54
+        ogs_error("Remote PFCP restarted %u<%u in Heartbeat RSP",
55
+            node->remote_recovery, rsp->recovery_time_stamp.u32);
56
+        node->restoration_required = true;
57
+    } else if (node->remote_recovery > rsp->recovery_time_stamp.u32) {
58
+        ogs_error("Invalid Recovery Time Stamp %u>%u in Heartbeat RSP",
59
+        node->remote_recovery, rsp->recovery_time_stamp.u32);
60
+    }
61
+
62
+    node->remote_recovery = rsp->recovery_time_stamp.u32;
63
+
64
     ogs_timer_start(node->t_no_heartbeat,
65
             ogs_app()->time.message.pfcp.no_heartbeat_duration);
66
 
67
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/handler.h -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/handler.h Changed
8
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/path.c -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/path.c Changed
17
 
1
@@ -193,6 +193,15 @@
2
     rv = ogs_pfcp_xact_commit(xact);
3
     ogs_expect(rv == OGS_OK);
4
 
5
+    /*
6
+     * Force delete the PFCP transaction to check the PFCP recovery timestamp.
7
+     *
8
+     * Otherwise, duplicated request (lib/pfcp/xact.c:384) prevents the message
9
+     * from being passed to the state machine, so the PFCP recovery timestamp
10
+     * cannot be delivered in the handler routine.
11
+     */
12
+    ogs_pfcp_xact_delete(xact);
13
+
14
     return rv;
15
 }
16
 
17
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/xact.c -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/xact.c Changed
18
 
1
@@ -39,7 +39,6 @@
2
         ogs_pfcp_node_t *node, uint32_t sqn);
3
 static ogs_pfcp_xact_stage_t ogs_pfcp_xact_get_stage(
4
         uint8_t type, uint32_t xid);
5
-static int ogs_pfcp_xact_delete(ogs_pfcp_xact_t *xact);
6
 static int ogs_pfcp_xact_update_rx(ogs_pfcp_xact_t *xact, uint8_t type);
7
 
8
 static void response_timeout(void *data);
9
@@ -772,7 +771,7 @@
10
     return stage;
11
 }
12
 
13
-static int ogs_pfcp_xact_delete(ogs_pfcp_xact_t *xact)
14
+int ogs_pfcp_xact_delete(ogs_pfcp_xact_t *xact)
15
 {
16
     char bufOGS_ADDRSTRLEN;
17
 
18
open5gs_2.6.1.26.939b3.tar.xz/lib/pfcp/xact.h -> open5gs_2.6.1.27.b9a3.tar.xz/lib/pfcp/xact.h Changed
10
 
1
@@ -140,6 +140,8 @@
2
 int ogs_pfcp_xact_commit(ogs_pfcp_xact_t *xact);
3
 void ogs_pfcp_xact_delayed_commit(ogs_pfcp_xact_t *xact, ogs_time_t duration);
4
 
5
+int ogs_pfcp_xact_delete(ogs_pfcp_xact_t *xact);
6
+
7
 int ogs_pfcp_xact_receive(ogs_pfcp_node_t *node,
8
         ogs_pfcp_header_t *h, ogs_pfcp_xact_t **xact);
9
 
10
open5gs_2.6.1.26.939b3.tar.xz/src/amf/context.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/amf/context.c Changed
21
 
1
@@ -1641,6 +1641,9 @@
2
     ogs_timer_delete(amf_ue->implicit_deregistration.timer);
3
 
4
     /* Free SBI object memory */
5
+    if (ogs_list_count(&amf_ue->sbi.xact_list))
6
+        ogs_error("UE transaction %d",
7
+                ogs_list_count(&amf_ue->sbi.xact_list));
8
     ogs_sbi_object_free(&amf_ue->sbi);
9
 
10
     amf_ue_deassociate(amf_ue);
11
@@ -2079,6 +2082,9 @@
12
     ogs_list_remove(&sess->amf_ue->sess_list, sess);
13
 
14
     /* Free SBI object memory */
15
+    if (ogs_list_count(&sess->sbi.xact_list))
16
+        ogs_error("Session transaction %d",
17
+                ogs_list_count(&sess->sbi.xact_list));
18
     ogs_sbi_object_free(&sess->sbi);
19
 
20
     if (sess->sm_context_ref)
21
open5gs_2.6.1.26.939b3.tar.xz/src/amf/context.h -> open5gs_2.6.1.27.b9a3.tar.xz/src/amf/context.h Changed
29
 
1
@@ -490,6 +490,19 @@
2
     bool n1_released;
3
     bool n2_released;
4
 
5
+    /*
6
+     * To check if Reactivation Request has been used.
7
+     *
8
+     * During the PFCP recovery process,
9
+     * when a Reactivation Request is sent to PDU session release command,
10
+     * the UE simultaneously sends PDU session release complete and
11
+     * PDU session establishment request.
12
+     *
13
+     * In this case, old_gsm_type is PDU session release command and
14
+     * current_gsm_type is PDU session establishment request.
15
+     */
16
+    uint8_t old_gsm_type, current_gsm_type;
17
+
18
     struct {
19
         ogs_pkbuf_t *pdu_session_resource_setup_request;
20
         ogs_pkbuf_t *pdu_session_resource_modification_command;
21
@@ -762,6 +775,7 @@
22
         sbi_object = &sess->sbi; \
23
         ogs_assert(sbi_object); \
24
         \
25
+        ogs_error("AMF_SESS_CLEAR"); \
26
         if (ogs_list_count(&sbi_object->xact_list)) { \
27
             ogs_error("SBI running %d", \
28
                     ogs_list_count(&sbi_object->xact_list)); \
29
open5gs_2.6.1.26.939b3.tar.xz/src/amf/gmm-handler.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/amf/gmm-handler.c Changed
22
 
1
@@ -1099,6 +1099,20 @@
2
             }
3
         }
4
 
5
+        /*
6
+         * To check if Reactivation Request has been used.
7
+         *
8
+         * During the PFCP recovery process,
9
+         * when a Reactivation Request is sent to PDU session release command,
10
+         * the UE simultaneously sends PDU session release complete and
11
+         * PDU session establishment request.
12
+         *
13
+         * In this case, old_gsm_type is PDU session release command and
14
+         * current_gsm_type is PDU session establishment request.
15
+         */
16
+        sess->old_gsm_type = sess->current_gsm_type;
17
+        sess->current_gsm_type = gsm_header->message_type;
18
+
19
         if (sess->payload_container)
20
             ogs_pkbuf_free(sess->payload_container);
21
 
22
open5gs_2.6.1.26.939b3.tar.xz/src/amf/namf-handler.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/amf/namf-handler.c Changed
19
 
1
@@ -498,11 +498,15 @@
2
      * If NOTIFICATION comes after the CLIENT response is received,
3
      * sync is done. So, the session context can be removed.
4
      */
5
+    ogs_info("%s:%d%d:%d:%s "
6
+            "/namf-callback/v1/{supi}/sm-context-status/{psi}",
7
+            amf_ue->supi, sess->psi,
8
+            sess->n1_released, sess->n2_released,
9
+            OpenAPI_resource_status_ToString(sess->resource_status));
10
+
11
     if (sess->n1_released == true &&
12
         sess->n2_released == true &&
13
         sess->resource_status == OpenAPI_resource_status_RELEASED) {
14
-
15
-        ogs_debug("%s:%d SM context remove", amf_ue->supi, sess->psi);
16
         amf_nsmf_pdusession_handle_release_sm_context(
17
                 sess, AMF_RELEASE_SM_CONTEXT_NO_STATE);
18
     }
19
open5gs_2.6.1.26.939b3.tar.xz/src/amf/nsmf-handler.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/amf/nsmf-handler.c Changed
76
 
1
@@ -565,7 +565,7 @@
2
                  * 1. PDUSessionResourceReleaseResponse
3
                  * 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
4
                  */
5
-                ogs_debug("%s:%d Receive Update SM context(N2-RELEASED)",
6
+                ogs_info("%s:%d Receive Update SM context(N2-RELEASED)",
7
                         amf_ue->supi, sess->psi);
8
 
9
                 sess->n2_released = true;
10
@@ -577,7 +577,7 @@
11
                  * 2. /nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify
12
                  */
13
 
14
-                ogs_debug("%s:%d Receive Update SM context(N1-RELEASED)",
15
+                ogs_info("%s:%d Receive Update SM context(N1-RELEASED)",
16
                         amf_ue->supi, sess->psi);
17
 
18
                 sess->n1_released = true;
19
@@ -729,11 +729,15 @@
20
              * Remove 'amf_sess_t' context to call
21
              *   amf_nsmf_pdusession_handle_release_sm_context().
22
              */
23
+            ogs_info("%s:%d:%d%d:%d:%s "
24
+                    "/nsmf-pdusession/v1/sm-contexts/{smContextRef}/modify",
25
+                    amf_ue->supi, sess->psi, state,
26
+                    sess->n1_released, sess->n2_released,
27
+                    OpenAPI_resource_status_ToString(sess->resource_status));
28
+
29
             if (sess->n1_released == true &&
30
                 sess->n2_released == true &&
31
                 sess->resource_status == OpenAPI_resource_status_RELEASED) {
32
-
33
-                ogs_debug("%s:%d SM context remove", amf_ue->supi, sess->psi);
34
                 amf_nsmf_pdusession_handle_release_sm_context(
35
                         sess, AMF_RELEASE_SM_CONTEXT_NO_STATE);
36
             }
37
@@ -844,7 +848,37 @@
38
     amf_ue = sess->amf_ue;
39
     ogs_assert(amf_ue);
40
 
41
-    amf_sess_remove(sess);
42
+    /*
43
+     * To check if Reactivation Request has been used.
44
+     *
45
+     * During the PFCP recovery process,
46
+     * when a Reactivation Request is sent to PDU session release command,
47
+     * the UE simultaneously sends PDU session release complete and
48
+     * PDU session establishment request.
49
+     *
50
+     * In this case, old_gsm_type is PDU session release command and
51
+     * current_gsm_type is PDU session establishment request.
52
+     */
53
+    if (sess->old_gsm_type == OGS_NAS_5GS_PDU_SESSION_RELEASE_COMPLETE &&
54
+        sess->current_gsm_type ==
55
+            OGS_NAS_5GS_PDU_SESSION_ESTABLISHMENT_REQUEST) {
56
+        ogs_error("%s:%d Do not remove Session due to Reactivation-requested",
57
+                amf_ue->supi, sess->psi);
58
+
59
+        /* Initialize the context instead of using amf_sess_remove() */
60
+
61
+        sess->old_gsm_type = 0;
62
+        sess->current_gsm_type = 0;
63
+
64
+        sess->n1_released = false;
65
+        sess->n2_released = false;
66
+        sess->resource_status = OpenAPI_resource_status_NULL;
67
+
68
+    } else {
69
+        ogs_info("%s:%d Release SM Context state:%d",
70
+                amf_ue->supi, sess->psi, state);
71
+        amf_sess_remove(sess);
72
+    }
73
 
74
     if (state == AMF_RELEASE_SM_CONTEXT_REGISTRATION_ACCEPT) {
75
         /*
76
open5gs_2.6.1.26.939b3.tar.xz/src/pcf/context.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/pcf/context.c Changed
21
 
1
@@ -183,6 +183,9 @@
2
     ogs_fsm_fini(&pcf_ue->sm, &e);
3
 
4
     /* Free SBI object memory */
5
+    if (ogs_list_count(&pcf_ue->sbi.xact_list))
6
+        ogs_error("UE transaction %d",
7
+                ogs_list_count(&pcf_ue->sbi.xact_list));
8
     ogs_sbi_object_free(&pcf_ue->sbi);
9
 
10
     pcf_sess_remove_all(pcf_ue);
11
@@ -293,6 +296,9 @@
12
     ogs_fsm_fini(&sess->sm, &e);
13
 
14
     /* Free SBI object memory */
15
+    if (ogs_list_count(&sess->sbi.xact_list))
16
+        ogs_error("Session transaction %d",
17
+                ogs_list_count(&sess->sbi.xact_list));
18
     ogs_sbi_object_free(&sess->sbi);
19
 
20
     pcf_app_remove_all(sess);
21
open5gs_2.6.1.26.939b3.tar.xz/src/sgwc/pfcp-sm.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/sgwc/pfcp-sm.c Changed
54
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -124,6 +124,16 @@
9
         ogs_assert(xact);
10
 
11
         switch (message->h.type) {
12
+        case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
13
+            ogs_expect(true ==
14
+                ogs_pfcp_handle_heartbeat_request(node, xact,
15
+                    &message->pfcp_heartbeat_request));
16
+            break;
17
+        case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
18
+            ogs_expect(true ==
19
+                ogs_pfcp_handle_heartbeat_response(node, xact,
20
+                    &message->pfcp_heartbeat_response));
21
+            break;
22
         case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE:
23
             ogs_pfcp_cp_handle_association_setup_request(node, xact,
24
                     &message->pfcp_association_setup_request);
25
@@ -174,6 +184,13 @@
26
             OGS_PORT(&node->addr));
27
         ogs_timer_start(node->t_no_heartbeat,
28
                 ogs_app()->time.message.pfcp.no_heartbeat_duration);
29
+        ogs_assert(OGS_OK ==
30
+            ogs_pfcp_send_heartbeat_request(node, node_timeout));
31
+
32
+        if (node->restoration_required == true) {
33
+            node->restoration_required = false;
34
+            ogs_error("PFCP restoration");
35
+        }
36
         break;
37
     case OGS_FSM_EXIT_SIG:
38
         ogs_info("PFCP de-associated %s:%d",
39
@@ -200,12 +217,12 @@
40
 
41
         switch (message->h.type) {
42
         case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
43
-            ogs_assert(true ==
44
+            ogs_expect(true ==
45
                 ogs_pfcp_handle_heartbeat_request(node, xact,
46
                     &message->pfcp_heartbeat_request));
47
             break;
48
         case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
49
-            ogs_assert(true ==
50
+            ogs_expect(true ==
51
                 ogs_pfcp_handle_heartbeat_response(node, xact,
52
                     &message->pfcp_heartbeat_response));
53
             break;
54
open5gs_2.6.1.26.939b3.tar.xz/src/sgwu/context.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/sgwu/context.c Changed
10
 
1
@@ -189,7 +189,7 @@
2
 
3
 void sgwu_sess_remove_all(void)
4
 {
5
-    sgwu_sess_t *sess = NULL, *next = NULL;;
6
+    sgwu_sess_t *sess = NULL, *next = NULL;
7
 
8
     ogs_list_for_each_safe(&self.sess_list, next, sess) {
9
         sgwu_sess_remove(sess);
10
open5gs_2.6.1.26.939b3.tar.xz/src/sgwu/pfcp-sm.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/sgwu/pfcp-sm.c Changed
131
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -20,6 +20,7 @@
9
 #include "pfcp-path.h"
10
 #include "sxa-handler.h"
11
 
12
+static void pfcp_restoration(ogs_pfcp_node_t *node);
13
 static void node_timeout(ogs_pfcp_xact_t *xact, void *data);
14
 
15
 void sgwu_pfcp_state_initial(ogs_fsm_t *s, sgwu_event_t *e)
16
@@ -120,6 +121,16 @@
17
         ogs_assert(xact);
18
 
19
         switch (message->h.type) {
20
+        case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
21
+            ogs_expect(true ==
22
+                ogs_pfcp_handle_heartbeat_request(node, xact,
23
+                    &message->pfcp_heartbeat_request));
24
+            break;
25
+        case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
26
+            ogs_expect(true ==
27
+                ogs_pfcp_handle_heartbeat_response(node, xact,
28
+                    &message->pfcp_heartbeat_response));
29
+            break;
30
         case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE:
31
             ogs_pfcp_up_handle_association_setup_request(node, xact,
32
                     &message->pfcp_association_setup_request);
33
@@ -170,6 +181,14 @@
34
             OGS_PORT(&node->addr));
35
         ogs_timer_start(node->t_no_heartbeat,
36
                 ogs_app()->time.message.pfcp.no_heartbeat_duration);
37
+        ogs_assert(OGS_OK ==
38
+            ogs_pfcp_send_heartbeat_request(node, node_timeout));
39
+
40
+        if (node->restoration_required == true) {
41
+            pfcp_restoration(node);
42
+            node->restoration_required = false;
43
+            ogs_error("PFCP restoration");
44
+        }
45
         break;
46
     case OGS_FSM_EXIT_SIG:
47
         ogs_info("PFCP de-associated %s:%d",
48
@@ -188,14 +207,60 @@
49
 
50
         switch (message->h.type) {
51
         case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
52
-            ogs_assert(true ==
53
+            ogs_expect(true ==
54
                 ogs_pfcp_handle_heartbeat_request(node, xact,
55
                     &message->pfcp_heartbeat_request));
56
+            if (node->restoration_required == true) {
57
+                if (node->t_association) {
58
+        /*
59
+         * node->t_association that the PFCP entity attempts an association.
60
+         *
61
+         * In this case, even if Remote PFCP entity is restarted,
62
+         * PFCP restoration must be performed after PFCP association.
63
+         *
64
+         * Otherwise, Session related PFCP cannot be initiated
65
+         * because the peer PFCP entity is in a de-associated state.
66
+         */
67
+                    OGS_FSM_TRAN(s, sgwu_pfcp_state_will_associate);
68
+                } else {
69
+
70
+        /*
71
+         * If the peer PFCP entity is performing the association,
72
+         * Restoration can be performed immediately.
73
+         */
74
+                    pfcp_restoration(node);
75
+                    node->restoration_required = false;
76
+                    ogs_error("PFCP restoration");
77
+                }
78
+            }
79
             break;
80
         case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
81
-            ogs_assert(true ==
82
+            ogs_expect(true ==
83
                 ogs_pfcp_handle_heartbeat_response(node, xact,
84
                     &message->pfcp_heartbeat_response));
85
+            if (node->restoration_required == true) {
86
+                if (node->t_association) {
87
+        /*
88
+         * node->t_association that the PFCP entity attempts an association.
89
+         *
90
+         * In this case, even if Remote PFCP entity is restarted,
91
+         * PFCP restoration must be performed after PFCP association.
92
+         *
93
+         * Otherwise, Session related PFCP cannot be initiated
94
+         * because the peer PFCP entity is in a de-associated state.
95
+         */
96
+                    OGS_FSM_TRAN(s, sgwu_pfcp_state_will_associate);
97
+                } else {
98
+
99
+        /*
100
+         * If the peer PFCP entity is performing the association,
101
+         * Restoration can be performed immediately.
102
+         */
103
+                    pfcp_restoration(node);
104
+                    node->restoration_required = false;
105
+                    ogs_error("PFCP restoration");
106
+                }
107
+            }
108
             break;
109
         case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE:
110
             ogs_warn("PFCPREQ has already been associated %s:%d",
111
@@ -288,6 +353,19 @@
112
     }
113
 }
114
 
115
+static void pfcp_restoration(ogs_pfcp_node_t *node)
116
+{
117
+    sgwu_sess_t *sess = NULL, *next = NULL;
118
+
119
+    ogs_list_for_each_safe(&sgwu_self()->sess_list, next, sess) {
120
+        if (node == sess->pfcp_node) {
121
+            ogs_info("DELETION: F-SEIDUP:0x%lx CP:0x%lx",
122
+                (long)sess->sgwu_sxa_seid, (long)sess->sgwc_sxa_f_seid.seid);
123
+            sgwu_sess_remove(sess);
124
+        }
125
+    }
126
+}
127
+
128
 static void node_timeout(ogs_pfcp_xact_t *xact, void *data)
129
 {
130
     int rv;
131
open5gs_2.6.1.26.939b3.tar.xz/src/smf/pfcp-sm.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/smf/pfcp-sm.c Changed
210
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -22,6 +22,7 @@
9
 
10
 #include "n4-handler.h"
11
 
12
+static void reselect_upf(ogs_pfcp_node_t *node);
13
 static void node_timeout(ogs_pfcp_xact_t *xact, void *data);
14
 
15
 void smf_pfcp_state_initial(ogs_fsm_t *s, smf_event_t *e)
16
@@ -126,6 +127,16 @@
17
         ogs_assert(xact);
18
 
19
         switch (message->h.type) {
20
+        case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
21
+            ogs_expect(true ==
22
+                ogs_pfcp_handle_heartbeat_request(node, xact,
23
+                    &message->pfcp_heartbeat_request));
24
+            break;
25
+        case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
26
+            ogs_expect(true ==
27
+                ogs_pfcp_handle_heartbeat_response(node, xact,
28
+                    &message->pfcp_heartbeat_response));
29
+            break;
30
         case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE:
31
             ogs_pfcp_cp_handle_association_setup_request(node, xact,
32
                     &message->pfcp_association_setup_request);
33
@@ -176,6 +187,14 @@
34
             OGS_PORT(&node->addr));
35
         ogs_timer_start(node->t_no_heartbeat,
36
                 ogs_app()->time.message.pfcp.no_heartbeat_duration);
37
+        ogs_assert(OGS_OK ==
38
+            ogs_pfcp_send_heartbeat_request(node, node_timeout));
39
+
40
+        if (node->restoration_required == true) {
41
+            /* PFCP Restoration is being performed after PFCP association */
42
+            node->restoration_required = false;
43
+            ogs_error("PFCP restoration");
44
+        }
45
         break;
46
     case OGS_FSM_EXIT_SIG:
47
         ogs_info("PFCP de-associated %s:%d",
48
@@ -204,14 +223,57 @@
49
 
50
         switch (message->h.type) {
51
         case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
52
-            ogs_assert(true ==
53
+            ogs_expect(true ==
54
                 ogs_pfcp_handle_heartbeat_request(node, xact,
55
                     &message->pfcp_heartbeat_request));
56
+            if (node->restoration_required == true) {
57
+                if (node->t_association) {
58
+        /*
59
+         * node->t_association that the PFCP entity attempts an association.
60
+         *
61
+         * In this case, even if Remote PFCP entity is restarted,
62
+         * PFCP restoration must be performed after PFCP association.
63
+         *
64
+         * Otherwise, Session related PFCP cannot be initiated
65
+         * because the peer PFCP entity is in a de-associated state.
66
+         */
67
+                    OGS_FSM_TRAN(s, smf_pfcp_state_will_associate);
68
+                } else {
69
+
70
+        /*
71
+         * If the peer PFCP entity is performing the association,
72
+         * Restoration can be performed immediately.
73
+         */
74
+                    node->restoration_required = false;
75
+                    ogs_error("PFCP restoration");
76
+                }
77
+            }
78
             break;
79
         case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
80
-            ogs_assert(true ==
81
+            ogs_expect(true ==
82
                 ogs_pfcp_handle_heartbeat_response(node, xact,
83
                     &message->pfcp_heartbeat_response));
84
+            if (node->restoration_required == true) {
85
+        /*
86
+         * node->t_association that the PFCP entity attempts an association.
87
+         *
88
+         * In this case, even if Remote PFCP entity is restarted,
89
+         * PFCP restoration must be performed after PFCP association.
90
+         *
91
+         * Otherwise, Session related PFCP cannot be initiated
92
+         * because the peer PFCP entity is in a de-associated state.
93
+         */
94
+                if (node->t_association) {
95
+                    OGS_FSM_TRAN(s, smf_pfcp_state_will_associate);
96
+                } else {
97
+        /*
98
+         * If the peer PFCP entity is performing the association,
99
+         * Restoration can be performed immediately.
100
+         */
101
+                    node->restoration_required = false;
102
+                    ogs_error("PFCP restoration");
103
+                }
104
+            }
105
             break;
106
         case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE:
107
             ogs_warn("PFCPREQ has already been associated %s:%d",
108
@@ -347,34 +409,48 @@
109
     }
110
 }
111
 
112
-static void node_timeout(ogs_pfcp_xact_t *xact, void *data)
113
+static void reselect_upf(ogs_pfcp_node_t *node)
114
 {
115
-    int r, rv;
116
-
117
-    smf_event_t *e = NULL;
118
-    uint8_t type;
119
-    ogs_pfcp_node_t *node = NULL;
120
+    int r;
121
     smf_ue_t *smf_ue = NULL, *next_ue = NULL;;
122
+    ogs_pfcp_node_t *iter = NULL;
123
 
124
-    ogs_assert(xact);
125
-    type = xact->seq0.type;
126
+    ogs_assert(node);
127
 
128
-    switch (type) {
129
-    case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
130
-        node = data;
131
-        ogs_assert(node);
132
+    if (node->restoration_required == true) {
133
+        ogs_error("UPF has already been restarted");
134
+        return;
135
+    }
136
+
137
+    ogs_list_for_each(&ogs_pfcp_self()->pfcp_peer_list, iter) {
138
+        if (iter == node)
139
+            continue;
140
+        if (OGS_FSM_CHECK(&iter->sm, smf_pfcp_state_associated))
141
+            break;
142
+    }
143
 
144
-        ogs_list_for_each_safe(&smf_self()->smf_ue_list, next_ue, smf_ue) {
145
-            smf_sess_t *sess = NULL, *next_sess = NULL;;
146
-            ogs_assert(smf_ue);
147
+    if (iter == NULL) {
148
+        ogs_error("No UPF avaiable");
149
+        return;
150
+    }
151
 
152
-            ogs_list_for_each_safe(&smf_ue->sess_list, next_sess, sess) {
153
-                ogs_assert(sess);
154
+    ogs_list_for_each_safe(&smf_self()->smf_ue_list, next_ue, smf_ue) {
155
+        smf_sess_t *sess = NULL, *next_sess = NULL;;
156
+        ogs_assert(smf_ue);
157
+
158
+        ogs_list_for_each_safe(&smf_ue->sess_list, next_sess, sess) {
159
+            ogs_assert(sess);
160
+            if (sess->epc) {
161
+                ogs_error("%s:%s EPC restoration is not implemented",
162
+                        smf_ue->imsi_bcd, sess->session.name);
163
+            } else {
164
                 ogs_assert(sess->sm_context_ref);
165
 
166
                 if (node == sess->pfcp_node) {
167
                     smf_npcf_smpolicycontrol_param_t param;
168
 
169
+                    ogs_info("%s:%d SMF-initiated Deletion",
170
+                            smf_ue->supi, sess->psi);
171
                     ogs_assert(sess->sm_context_ref);
172
                     memset(&param, 0, sizeof(param));
173
                     r = smf_sbi_discover_and_send(
174
@@ -387,6 +463,35 @@
175
                 }
176
             }
177
         }
178
+    }
179
+}
180
+
181
+static void node_timeout(ogs_pfcp_xact_t *xact, void *data)
182
+{
183
+    int rv;
184
+
185
+    smf_event_t *e = NULL;
186
+    uint8_t type;
187
+
188
+    ogs_assert(xact);
189
+    type = xact->seq0.type;
190
+
191
+    switch (type) {
192
+    case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
193
+        ogs_assert(data);
194
+
195
+
196
+    /*
197
+     * The code below is not secure.
198
+     * Session does not differentiate between EPC and 5GC.
199
+     * And, it does not check whether there are other PFCP Nodes.
200
+     *
201
+     * So, UPF redundancy will be implemented later.
202
+     *
203
+     * We plan to do this again after testing with restoration first
204
+     * in case peer PFCP restarts.
205
+     */
206
+        reselect_upf(data);
207
 
208
         e = smf_event_new(SMF_EVT_N4_NO_HEARTBEAT);
209
         e->pfcp_node = data;
210
open5gs_2.6.1.26.939b3.tar.xz/src/upf/context.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/upf/context.c Changed
10
 
1
@@ -237,7 +237,7 @@
2
 
3
 void upf_sess_remove_all(void)
4
 {
5
-    upf_sess_t *sess = NULL, *next = NULL;;
6
+    upf_sess_t *sess = NULL, *next = NULL;
7
 
8
     ogs_list_for_each_safe(&self.sess_list, next, sess) {
9
         upf_sess_remove(sess);
10
open5gs_2.6.1.26.939b3.tar.xz/src/upf/pfcp-sm.c -> open5gs_2.6.1.27.b9a3.tar.xz/src/upf/pfcp-sm.c Changed
134
 
1
@@ -1,5 +1,5 @@
2
 /*
3
- * Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
4
+ * Copyright (C) 2019-2023 by Sukchan Lee <acetcom@gmail.com>
5
  *
6
  * This file is part of Open5GS.
7
  *
8
@@ -25,6 +25,7 @@
9
 #include "pfcp-path.h"
10
 #include "n4-handler.h"
11
 
12
+static void pfcp_restoration(ogs_pfcp_node_t *node);
13
 static void node_timeout(ogs_pfcp_xact_t *xact, void *data);
14
 
15
 void upf_pfcp_state_initial(ogs_fsm_t *s, upf_event_t *e)
16
@@ -125,6 +126,16 @@
17
         ogs_assert(xact);
18
 
19
         switch (message->h.type) {
20
+        case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
21
+            ogs_expect(true ==
22
+                ogs_pfcp_handle_heartbeat_request(node, xact,
23
+                    &message->pfcp_heartbeat_request));
24
+            break;
25
+        case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
26
+            ogs_expect(true ==
27
+                ogs_pfcp_handle_heartbeat_response(node, xact,
28
+                    &message->pfcp_heartbeat_response));
29
+            break;
30
         case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE:
31
             ogs_pfcp_up_handle_association_setup_request(node, xact,
32
                     &message->pfcp_association_setup_request);
33
@@ -175,6 +186,14 @@
34
             OGS_PORT(&node->addr));
35
         ogs_timer_start(node->t_no_heartbeat,
36
                 ogs_app()->time.message.pfcp.no_heartbeat_duration);
37
+        ogs_assert(OGS_OK ==
38
+            ogs_pfcp_send_heartbeat_request(node, node_timeout));
39
+
40
+        if (node->restoration_required == true) {
41
+            pfcp_restoration(node);
42
+            node->restoration_required = false;
43
+            ogs_error("PFCP restoration");
44
+        }
45
         break;
46
     case OGS_FSM_EXIT_SIG:
47
         ogs_info("PFCP de-associated %s:%d",
48
@@ -193,14 +212,59 @@
49
 
50
         switch (message->h.type) {
51
         case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
52
-            ogs_assert(true ==
53
+            ogs_expect(true ==
54
                 ogs_pfcp_handle_heartbeat_request(node, xact,
55
                     &message->pfcp_heartbeat_request));
56
+            if (node->restoration_required == true) {
57
+                if (node->t_association) {
58
+        /*
59
+         * node->t_association that the PFCP entity attempts an association.
60
+         *
61
+         * In this case, even if Remote PFCP entity is restarted,
62
+         * PFCP restoration must be performed after PFCP association.
63
+         *
64
+         * Otherwise, Session related PFCP cannot be initiated
65
+         * because the peer PFCP entity is in a de-associated state.
66
+         */
67
+                    OGS_FSM_TRAN(s, upf_pfcp_state_will_associate);
68
+                } else {
69
+
70
+        /*
71
+         * If the peer PFCP entity is performing the association,
72
+         * Restoration can be performed immediately.
73
+         */
74
+                    pfcp_restoration(node);
75
+                    node->restoration_required = false;
76
+                    ogs_error("PFCP restoration");
77
+                }
78
+            }
79
             break;
80
         case OGS_PFCP_HEARTBEAT_RESPONSE_TYPE:
81
-            ogs_assert(true ==
82
+            ogs_expect(true ==
83
                 ogs_pfcp_handle_heartbeat_response(node, xact,
84
                     &message->pfcp_heartbeat_response));
85
+            if (node->restoration_required == true) {
86
+        /*
87
+         * node->t_association that the PFCP entity attempts an association.
88
+         *
89
+         * In this case, even if Remote PFCP entity is restarted,
90
+         * PFCP restoration must be performed after PFCP association.
91
+         *
92
+         * Otherwise, Session related PFCP cannot be initiated
93
+         * because the peer PFCP entity is in a de-associated state.
94
+         */
95
+                if (node->t_association) {
96
+                    OGS_FSM_TRAN(s, upf_pfcp_state_will_associate);
97
+                } else {
98
+        /*
99
+         * If the peer PFCP entity is performing the association,
100
+         * Restoration can be performed immediately.
101
+         */
102
+                    pfcp_restoration(node);
103
+                    node->restoration_required = false;
104
+                    ogs_error("PFCP restoration");
105
+                }
106
+            }
107
             break;
108
         case OGS_PFCP_ASSOCIATION_SETUP_REQUEST_TYPE:
109
             ogs_warn("PFCPREQ has already been associated %s:%d",
110
@@ -293,6 +357,23 @@
111
     }
112
 }
113
 
114
+static void pfcp_restoration(ogs_pfcp_node_t *node)
115
+{
116
+    upf_sess_t *sess = NULL, *next = NULL;
117
+    char buf1OGS_ADDRSTRLEN;
118
+    char buf2OGS_ADDRSTRLEN;
119
+
120
+    ogs_list_for_each_safe(&upf_self()->sess_list, next, sess) {
121
+        if (node == sess->pfcp_node) {
122
+            ogs_info("DELETION: F-SEIDUP:0x%lx CP:0x%lx IPv4%s IPv6%s",
123
+                (long)sess->upf_n4_seid, (long)sess->smf_n4_f_seid.seid,
124
+                sess->ipv4 ? OGS_INET_NTOP(&sess->ipv4->addr, buf1) : "",
125
+                sess->ipv6 ? OGS_INET6_NTOP(&sess->ipv6->addr, buf2) : "");
126
+            upf_sess_remove(sess);
127
+        }
128
+    }
129
+}
130
+
131
 static void node_timeout(ogs_pfcp_xact_t *xact, void *data)
132
 {
133
     int rv;
134
open5gs_2.6.1.26.939b3.tar.xz/tests/app/5gc-init.c -> open5gs_2.6.1.27.b9a3.tar.xz/tests/app/5gc-init.c Changed
10
 
1
@@ -82,7 +82,7 @@
2
      * 
3
      * If freeDiameter is not used, it uses a delay of less than 4 seconds.
4
      */
5
-    ogs_msleep(500);
6
+    ogs_msleep(300);
7
 
8
     return OGS_OK;;
9
 }
10
open5gs_2.6.1.26.939b3.tar.xz/tests/handover/5gc-n2-test.c -> open5gs_2.6.1.27.b9a3.tar.xz/tests/handover/5gc-n2-test.c Changed
51
 
1
@@ -806,6 +806,9 @@
2
     rv = testgnb_ngap_send(ngap2, sendbuf);
3
     ABTS_INT_EQUAL(tc, OGS_OK, rv);
4
 
5
+    /* Waiting for N4 */
6
+    ogs_msleep(100);
7
+
8
     /* Receive End Mark */
9
     recvbuf = test_gtpu_read(gtpu1);
10
     ABTS_PTR_NOTNULL(tc, recvbuf);
11
@@ -923,6 +926,9 @@
12
     rv = testgnb_ngap_send(ngap1, sendbuf);
13
     ABTS_INT_EQUAL(tc, OGS_OK, rv);
14
 
15
+    /* Waiting for N4 */
16
+    ogs_msleep(100);
17
+
18
     /* Receive End Mark */
19
     recvbuf = test_gtpu_read(gtpu2);
20
     ABTS_PTR_NOTNULL(tc, recvbuf);
21
@@ -1838,6 +1844,9 @@
22
     rv = testgnb_ngap_send(ngap2, sendbuf);
23
     ABTS_INT_EQUAL(tc, OGS_OK, rv);
24
 
25
+    /* Waiting for N4 */
26
+    ogs_msleep(100);
27
+
28
     /* Receive End Mark */
29
     recvbuf = test_gtpu_read(gtpu1);
30
     ABTS_PTR_NOTNULL(tc, recvbuf);
31
@@ -1983,6 +1992,9 @@
32
     rv = testgnb_ngap_send(ngap1, sendbuf);
33
     ABTS_INT_EQUAL(tc, OGS_OK, rv);
34
 
35
+    /* Waiting for N4 */
36
+    ogs_msleep(100);
37
+
38
     /* Receive End Mark */
39
     recvbuf = test_gtpu_read(gtpu2);
40
     ABTS_PTR_NOTNULL(tc, recvbuf);
41
@@ -2488,6 +2500,9 @@
42
     rv = testgnb_ngap_send(ngap2, sendbuf);
43
     ABTS_INT_EQUAL(tc, OGS_OK, rv);
44
 
45
+    /* Waiting for N4 */
46
+    ogs_msleep(100);
47
+
48
     /* Receive End Mark */
49
     recvbuf = test_gtpu_read(gtpu1);
50
     ABTS_PTR_NOTNULL(tc, recvbuf);
51