Changes of Revision 1003

open5gs_2.7.2.4636.10b1.202503202026.dsc Deleted
x
 
1
@@ -1,39 +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-sepp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg
5
-Architecture: any
6
-Version: 2.7.2.4636.10b1.202503202026
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, libidn-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-sepp deb net optional arch=any
29
- open5gs-sgwc deb net optional arch=any
30
- open5gs-sgwu deb net optional arch=any
31
- open5gs-smf deb net optional arch=any
32
- open5gs-udm deb net optional arch=any
33
- open5gs-udr deb net optional arch=any
34
- open5gs-upf deb net optional arch=any
35
-Checksums-Sha1:
36
- 699e864e26d4c920550b6c6ca044e463fdf791d4 14529328 open5gs_2.7.2.4636.10b1.202503202026.tar.xz
37
-Checksums-Sha256:
38
- 4308f0f18f9421ddb9f1d1a256940efc9256bd4f20ea4046212d07aacb357c65 14529328 open5gs_2.7.2.4636.10b1.202503202026.tar.xz
39
-Files:
40
- 3d82c380d4cf83cf473f5cf2cadaf3c5 14529328 open5gs_2.7.2.4636.10b1.202503202026.tar.xz
41
open5gs_2.7.2.4639.a551.202503212026.dsc Added
41
 
1
@@ -0,0 +1,39 @@
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-sepp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg
5
+Architecture: any
6
+Version: 2.7.2.4639.a551.202503212026
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, libidn-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-sepp deb net optional arch=any
29
+ open5gs-sgwc deb net optional arch=any
30
+ open5gs-sgwu deb net optional arch=any
31
+ open5gs-smf deb net optional arch=any
32
+ open5gs-udm deb net optional arch=any
33
+ open5gs-udr deb net optional arch=any
34
+ open5gs-upf deb net optional arch=any
35
+Checksums-Sha1:
36
+ 723a292504dbe56f5a200759cd1dcb597053268d 14529788 open5gs_2.7.2.4639.a551.202503212026.tar.xz
37
+Checksums-Sha256:
38
+ 4db819529299415c06177a8e8ad29b071f8bd8087267564fac04187c348c62a9 14529788 open5gs_2.7.2.4639.a551.202503212026.tar.xz
39
+Files:
40
+ 0d4fea5c1b23015a6460ac647e099017 14529788 open5gs_2.7.2.4639.a551.202503212026.tar.xz
41
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/.tarball-version -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/.tarball-version Changed
4
 
1
@@ -1 +1 @@
2
-2.7.2.4636-10b1.202503202026
3
+2.7.2.4639-a551.202503212026
4
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/debian/changelog -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-open5gs (2.7.2.4636.10b1.202503202026) unstable; urgency=medium
3
+open5gs (2.7.2.4639.a551.202503212026) unstable; urgency=medium
4
 
5
   * Automatically generated changelog entry for building the Osmocom nightly feed
6
 
7
- -- Osmocom OBS scripts <info@osmocom.org>  Thu, 20 Mar 2025 20:27:57 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org>  Fri, 21 Mar 2025 20:27:54 +0000
9
 
10
 open5gs (2.7.2) unstable; urgency=medium
11
 
12
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/lib/nas/common/conv.c -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/lib/nas/common/conv.c Changed
90
 
1
@@ -131,56 +131,66 @@
2
         gprs_timer->unit = OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_2_SS;
3
         gprs_timer->value = timer_value / 2;
4
     } else {
5
-        if (timer_value%60 != 0) {
6
-            ogs_error("Not multiples of 1 minute");
7
+        if (timer_value%30 != 0) {
8
+            ogs_error("Not multiples of 30 seconds");
9
             return OGS_ERROR;
10
         }
11
-        timer_value /= 60; /* multiples of 1 minute */
12
+        timer_value /= 30; /* multiples of 30 seconds */
13
         if (timer_value <= 31) {
14
-            gprs_timer->unit = OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_1_MM;
15
+            gprs_timer->unit = OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_30_SS;
16
             gprs_timer->value = timer_value;
17
         } else {
18
-            if (timer_value%10 != 0) {
19
-                ogs_error("Not multiples of decihours(= 10 minutes)");
20
+            if (timer_value%2 != 0) {
21
+                ogs_error("Not multiples of 1 minute");
22
                 return OGS_ERROR;
23
             }
24
-            timer_value /= 10; /* multiples of decihours = 10 mintues */
25
+            timer_value /= 2; /* multiples of 1 minute */
26
             if (timer_value <= 31) {
27
-                gprs_timer->unit = OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_10_MM;
28
+                gprs_timer->unit = OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_1_MM;
29
                 gprs_timer->value = timer_value;
30
             } else {
31
-                if (timer_value%6 != 0) {
32
-                    ogs_error("Not multiples of 1 hour");
33
+                if (timer_value%10 != 0) {
34
+                    ogs_error("Not multiples of decihours(= 10 minutes)");
35
                     return OGS_ERROR;
36
                 }
37
-                timer_value /= 6; /* multiples of 1 hour */
38
+                timer_value /= 10; /* multiples of decihours = 10 mintues */
39
                 if (timer_value <= 31) {
40
-                    gprs_timer->unit =
41
-                        OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_1_HH;
42
+                    gprs_timer->unit = OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_10_MM;
43
                     gprs_timer->value = timer_value;
44
                 } else {
45
-                    if (timer_value%10 != 0) {
46
-                        ogs_error("Not multiples of 10 hours");
47
+                    if (timer_value%6 != 0) {
48
+                        ogs_error("Not multiples of 1 hour");
49
                         return OGS_ERROR;
50
                     }
51
-                    timer_value /= 10; /* multiples of 10 hours */
52
+                    timer_value /= 6; /* multiples of 1 hour */
53
                     if (timer_value <= 31) {
54
                         gprs_timer->unit =
55
-                            OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_10_HH;
56
+                            OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_1_HH;
57
                         gprs_timer->value = timer_value;
58
                     } else {
59
-                        if (timer_value%32 != 0) {
60
+                        if (timer_value%10 != 0) {
61
                             ogs_error("Not multiples of 10 hours");
62
                             return OGS_ERROR;
63
                         }
64
-                        timer_value /= 32; /* multiples of 320 hours */
65
+                        timer_value /= 10; /* multiples of 10 hours */
66
                         if (timer_value <= 31) {
67
                             gprs_timer->unit =
68
-                                OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_320_HH;
69
+                                OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_10_HH;
70
                             gprs_timer->value = timer_value;
71
                         } else {
72
-                            ogs_error("Overflow!");
73
-                            return OGS_ERROR;
74
+                            if (timer_value%32 != 0) {
75
+                                ogs_error("Not multiples of 10 hours");
76
+                                return OGS_ERROR;
77
+                            }
78
+                            timer_value /= 32; /* multiples of 320 hours */
79
+                            if (timer_value <= 31) {
80
+                                gprs_timer->unit =
81
+                                    OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_320_HH;
82
+                                gprs_timer->value = timer_value;
83
+                            } else {
84
+                                ogs_error("Overflow!");
85
+                                return OGS_ERROR;
86
+                            }
87
                         }
88
                     }
89
                 }
90
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/src/amf/context.c -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/src/amf/context.c Changed
156
 
1
@@ -2263,20 +2263,37 @@
2
 
3
         ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
4
                 source_ue->target_ue_id <= OGS_MAX_POOL_ID);
5
-        ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
6
-                target_ue->source_ue_id <= OGS_MAX_POOL_ID);
7
         source_ue->target_ue_id = OGS_INVALID_POOL_ID;
8
-        target_ue->source_ue_id = OGS_INVALID_POOL_ID;
9
+
10
+        if (target_ue) {
11
+            ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
12
+                    target_ue->source_ue_id <= OGS_MAX_POOL_ID);
13
+            target_ue->source_ue_id = OGS_INVALID_POOL_ID;
14
+        } else
15
+            ogs_error("Target-UE-ID %d has already been removed "
16
+                    "(RAN_UE_S1AP_ID%lld AMF_UE_S1AP_ID%lld)",
17
+                    source_ue->target_ue_id,
18
+                    (long long)source_ue->ran_ue_ngap_id,
19
+                    (long long)source_ue->amf_ue_ngap_id);
20
+
21
     } else if (ran_ue->source_ue_id >= OGS_MIN_POOL_ID &&
22
                 ran_ue->source_ue_id <= OGS_MAX_POOL_ID) {
23
         target_ue = ran_ue;
24
         source_ue = ran_ue_find_by_id(ran_ue->source_ue_id);
25
 
26
-        ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
27
-                source_ue->target_ue_id <= OGS_MAX_POOL_ID);
28
+        if (source_ue) {
29
+            ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
30
+                    source_ue->target_ue_id <= OGS_MAX_POOL_ID);
31
+            source_ue->target_ue_id = OGS_INVALID_POOL_ID;
32
+        } else
33
+            ogs_error("Source-UE-ID %d has already been removed "
34
+                    "(RAN_UE_S1AP_ID%lld AMF_UE_S1AP_ID%lld)",
35
+                    target_ue->source_ue_id,
36
+                    (long long)target_ue->ran_ue_ngap_id,
37
+                    (long long)target_ue->amf_ue_ngap_id);
38
+
39
         ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
40
                 target_ue->source_ue_id <= OGS_MAX_POOL_ID);
41
-        source_ue->target_ue_id = OGS_INVALID_POOL_ID;
42
         target_ue->source_ue_id = OGS_INVALID_POOL_ID;
43
     }
44
 }
45
@@ -2686,60 +2703,61 @@
46
     return 0;
47
 }
48
 
49
-/* Backup the sensitive security context fields from the UE context */
50
-void amf_backup_security_context(amf_ue_t *amf_ue,
51
-                                 amf_security_context_t *backup)
52
-{
53
-    ogs_assert(amf_ue);
54
-    ogs_assert(backup);
55
-
56
-    memcpy(&backup->ue_security_capability, &amf_ue->ue_security_capability,
57
-           sizeof(backup->ue_security_capability));
58
-    memcpy(&backup->ue_network_capability, &amf_ue->ue_network_capability,
59
-           sizeof(backup->ue_network_capability));
60
-    memcpy(backup->rand, amf_ue->rand, OGS_RAND_LEN);
61
-    memcpy(backup->autn, amf_ue->autn, OGS_AUTN_LEN);
62
-    memcpy(backup->xres_star, amf_ue->xres_star, OGS_MAX_RES_LEN);
63
-    memcpy(backup->abba, amf_ue->abba, OGS_NAS_MAX_ABBA_LEN);
64
-    backup->abba_len = amf_ue->abba_len;
65
-    memcpy(backup->hxres_star, amf_ue->hxres_star, OGS_MAX_RES_LEN);
66
-    memcpy(backup->kamf, amf_ue->kamf, OGS_SHA256_DIGEST_SIZE);
67
-    memcpy(backup->knas_int, amf_ue->knas_int, OGS_SHA256_DIGEST_SIZE/2);
68
-    memcpy(backup->knas_enc, amf_ue->knas_enc, OGS_SHA256_DIGEST_SIZE/2);
69
-    backup->dl_count = amf_ue->dl_count;
70
-    backup->ul_count = amf_ue->ul_count.i32;
71
-    memcpy(backup->kgnb, amf_ue->kgnb, OGS_SHA256_DIGEST_SIZE);
72
-    memcpy(backup->nh, amf_ue->nh, OGS_SHA256_DIGEST_SIZE);
73
-    backup->selected_enc_algorithm = amf_ue->selected_enc_algorithm;
74
-    backup->selected_int_algorithm = amf_ue->selected_int_algorithm;
75
-}
76
-
77
-/* Restore the sensitive security context fields into the UE context */
78
-void amf_restore_security_context(amf_ue_t *amf_ue,
79
-                                  const amf_security_context_t *backup)
80
+/*
81
+ * Save the sensitive (partial) context fields
82
+ * from the UE context into the memento
83
+ */
84
+void amf_ue_save_memento(amf_ue_t *amf_ue, amf_ue_memento_t *memento)
85
+{
86
+    ogs_assert(amf_ue);
87
+    ogs_assert(memento);
88
+
89
+    memcpy(&memento->ue_security_capability, &amf_ue->ue_security_capability,
90
+           sizeof(memento->ue_security_capability));
91
+    memcpy(&memento->ue_network_capability, &amf_ue->ue_network_capability,
92
+           sizeof(memento->ue_network_capability));
93
+    memcpy(memento->rand, amf_ue->rand, OGS_RAND_LEN);
94
+    memcpy(memento->autn, amf_ue->autn, OGS_AUTN_LEN);
95
+    memcpy(memento->xres_star, amf_ue->xres_star, OGS_MAX_RES_LEN);
96
+    memcpy(memento->abba, amf_ue->abba, OGS_NAS_MAX_ABBA_LEN);
97
+    memento->abba_len = amf_ue->abba_len;
98
+    memcpy(memento->hxres_star, amf_ue->hxres_star, OGS_MAX_RES_LEN);
99
+    memcpy(memento->kamf, amf_ue->kamf, OGS_SHA256_DIGEST_SIZE);
100
+    memcpy(memento->knas_int, amf_ue->knas_int, OGS_SHA256_DIGEST_SIZE/2);
101
+    memcpy(memento->knas_enc, amf_ue->knas_enc, OGS_SHA256_DIGEST_SIZE/2);
102
+    memento->dl_count = amf_ue->dl_count;
103
+    memento->ul_count = amf_ue->ul_count.i32;
104
+    memcpy(memento->kgnb, amf_ue->kgnb, OGS_SHA256_DIGEST_SIZE);
105
+    memcpy(memento->nh, amf_ue->nh, OGS_SHA256_DIGEST_SIZE);
106
+    memento->selected_enc_algorithm = amf_ue->selected_enc_algorithm;
107
+    memento->selected_int_algorithm = amf_ue->selected_int_algorithm;
108
+}
109
+
110
+/* Restore the sensitive context fields into the UE context */
111
+void amf_ue_restore_memento(amf_ue_t *amf_ue, const amf_ue_memento_t *memento)
112
 {
113
     ogs_assert(amf_ue);
114
-    ogs_assert(backup);
115
+    ogs_assert(memento);
116
 
117
-    memcpy(&amf_ue->ue_security_capability, &backup->ue_security_capability,
118
+    memcpy(&amf_ue->ue_security_capability, &memento->ue_security_capability,
119
            sizeof(amf_ue->ue_security_capability));
120
-    memcpy(&amf_ue->ue_network_capability, &backup->ue_network_capability,
121
+    memcpy(&amf_ue->ue_network_capability, &memento->ue_network_capability,
122
            sizeof(amf_ue->ue_network_capability));
123
-    memcpy(amf_ue->rand, backup->rand, OGS_RAND_LEN);
124
-    memcpy(amf_ue->autn, backup->autn, OGS_AUTN_LEN);
125
-    memcpy(amf_ue->xres_star, backup->xres_star, OGS_MAX_RES_LEN);
126
-    memcpy(amf_ue->abba, backup->abba, OGS_NAS_MAX_ABBA_LEN);
127
-    amf_ue->abba_len = backup->abba_len;
128
-    memcpy(amf_ue->hxres_star, backup->hxres_star, OGS_MAX_RES_LEN);
129
-    memcpy(amf_ue->kamf, backup->kamf, OGS_SHA256_DIGEST_SIZE);
130
-    memcpy(amf_ue->knas_int, backup->knas_int, OGS_SHA256_DIGEST_SIZE/2);
131
-    memcpy(amf_ue->knas_enc, backup->knas_enc, OGS_SHA256_DIGEST_SIZE/2);
132
-    amf_ue->dl_count = backup->dl_count;
133
-    amf_ue->ul_count.i32 = backup->ul_count;
134
-    memcpy(amf_ue->kgnb, backup->kgnb, OGS_SHA256_DIGEST_SIZE);
135
-    memcpy(amf_ue->nh, backup->nh, OGS_SHA256_DIGEST_SIZE);
136
-    amf_ue->selected_enc_algorithm = backup->selected_enc_algorithm;
137
-    amf_ue->selected_int_algorithm = backup->selected_int_algorithm;
138
+    memcpy(amf_ue->rand, memento->rand, OGS_RAND_LEN);
139
+    memcpy(amf_ue->autn, memento->autn, OGS_AUTN_LEN);
140
+    memcpy(amf_ue->xres_star, memento->xres_star, OGS_MAX_RES_LEN);
141
+    memcpy(amf_ue->abba, memento->abba, OGS_NAS_MAX_ABBA_LEN);
142
+    amf_ue->abba_len = memento->abba_len;
143
+    memcpy(amf_ue->hxres_star, memento->hxres_star, OGS_MAX_RES_LEN);
144
+    memcpy(amf_ue->kamf, memento->kamf, OGS_SHA256_DIGEST_SIZE);
145
+    memcpy(amf_ue->knas_int, memento->knas_int, OGS_SHA256_DIGEST_SIZE/2);
146
+    memcpy(amf_ue->knas_enc, memento->knas_enc, OGS_SHA256_DIGEST_SIZE/2);
147
+    amf_ue->dl_count = memento->dl_count;
148
+    amf_ue->ul_count.i32 = memento->ul_count;
149
+    memcpy(amf_ue->kgnb, memento->kgnb, OGS_SHA256_DIGEST_SIZE);
150
+    memcpy(amf_ue->nh, memento->nh, OGS_SHA256_DIGEST_SIZE);
151
+    amf_ue->selected_enc_algorithm = memento->selected_enc_algorithm;
152
+    amf_ue->selected_int_algorithm = memento->selected_int_algorithm;
153
 }
154
 
155
 void amf_clear_subscribed_info(amf_ue_t *amf_ue)
156
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/src/amf/context.h -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/src/amf/context.h Changed
48
 
1
@@ -237,7 +237,7 @@
2
     ogs_pool_id_t   amf_ue_id;
3
 }; 
4
 
5
-typedef struct amf_security_context_s {
6
+typedef struct amf_ue_memento_s {
7
     /* UE security capability info: supported security features. */
8
     ogs_nas_ue_security_capability_t ue_security_capability;
9
     /* UE network capability info: supported network features. */
10
@@ -296,7 +296,7 @@
11
     /* Selected algorithms (set by UDM/subscription) */
12
     uint8_t         selected_enc_algorithm;
13
     uint8_t         selected_int_algorithm;
14
-} amf_security_context_t;
15
+} amf_ue_memento_t;
16
 
17
 struct amf_ue_s {
18
     ogs_sbi_object_t sbi;
19
@@ -428,11 +428,11 @@
20
     int             security_context_available;
21
     int             mac_failed;
22
 
23
-    /* flag: 1 = allow restoration of security context, 0 = disallow */
24
-    bool            can_restore_security_context;
25
+    /* flag: 1 = allow restoration of context, 0 = disallow */
26
+    bool            can_restore_context;
27
 
28
-    /* Backup of security context fields */
29
-    amf_security_context_t sec_backup;
30
+    /* Memento of context fields */
31
+    amf_ue_memento_t memento;
32
 
33
     /* Security Context */
34
     ogs_nas_ue_security_capability_t ue_security_capability;
35
@@ -1085,10 +1085,8 @@
36
 uint8_t amf_selected_int_algorithm(amf_ue_t *amf_ue);
37
 uint8_t amf_selected_enc_algorithm(amf_ue_t *amf_ue);
38
 
39
-void amf_backup_security_context(
40
-        amf_ue_t *amf_ue, amf_security_context_t *backup);
41
-void amf_restore_security_context(
42
-        amf_ue_t *amf_ue, const amf_security_context_t *backup);
43
+void amf_ue_save_memento(amf_ue_t *amf_ue, amf_ue_memento_t *memento);
44
+void amf_ue_restore_memento(amf_ue_t *amf_ue, const amf_ue_memento_t *memento);
45
 
46
 void amf_clear_subscribed_info(amf_ue_t *amf_ue);
47
 
48
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/src/amf/gmm-sm.c -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/src/amf/gmm-sm.c Changed
201
 
1
@@ -35,6 +35,24 @@
2
 #undef OGS_LOG_DOMAIN
3
 #define OGS_LOG_DOMAIN __gmm_log_domain
4
 
5
+#define AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s) do {                  \
6
+    if ((amf_ue)->can_restore_context) {                                \
7
+        /* Restore context if allowed */                                \
8
+        amf_ue_restore_memento((amf_ue), &((amf_ue)->memento));         \
9
+        (amf_ue)->security_context_available = 1;                       \
10
+        (amf_ue)->mac_failed = 0;                                       \
11
+        if (!OGS_FSM_CHECK(&amf_ue->sm, gmm_state_registered))          \
12
+            OGS_FSM_TRAN((s), &gmm_state_registered);                   \
13
+        ogs_warn("%s Failure in transaction; restoring context and "  \
14
+                 "transitioning to REGISTERED.", (amf_ue)->supi);       \
15
+    } else {                                                            \
16
+        /* Transition to exception state if not allowed */              \
17
+        OGS_FSM_TRAN((s), &gmm_state_exception);                        \
18
+        ogs_warn("%s Failure in transaction; no context "             \
19
+                 "restoration.", (amf_ue)->supi);                       \
20
+    }                                                                   \
21
+} while (0)
22
+
23
 typedef enum {
24
     GMM_COMMON_STATE_DEREGISTERED,
25
     GMM_COMMON_STATE_REGISTERED,
26
@@ -43,7 +61,6 @@
27
 static void common_register_state(ogs_fsm_t *s, amf_event_t *e,
28
         gmm_common_state_e state);
29
 
30
-
31
 void gmm_state_initial(ogs_fsm_t *s, amf_event_t *e)
32
 {
33
     ogs_assert(s);
34
@@ -1281,11 +1298,11 @@
35
 
36
     /* If transition is from REGISTERED, allow restoration */
37
     if (state == GMM_COMMON_STATE_REGISTERED) {
38
-        amf_ue->can_restore_security_context = 1;
39
-        amf_backup_security_context(amf_ue, &amf_ue->sec_backup);
40
+        amf_ue->can_restore_context = 1;
41
+        amf_ue_save_memento(amf_ue, &amf_ue->memento);
42
     } else if (state == GMM_COMMON_STATE_DEREGISTERED) {
43
         /* Transition from de-registered: do not restore */
44
-        amf_ue->can_restore_security_context = 0;
45
+        amf_ue->can_restore_context = 0;
46
     } else
47
         ogs_assert_if_reached();
48
 
49
@@ -1331,7 +1348,7 @@
50
                 r = nas_5gs_send_registration_reject(ran_ue, amf_ue, gmm_cause);
51
                 ogs_expect(r == OGS_OK);
52
                 ogs_assert(r != OGS_ERROR);
53
-                OGS_FSM_TRAN(s, gmm_state_exception);
54
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
55
                 break;
56
             }
57
 
58
@@ -1392,7 +1409,7 @@
59
                             ran_ue, amf_ue, gmm_cause);
60
                     ogs_expect(r == OGS_OK);
61
                     ogs_assert(r != OGS_ERROR);
62
-                    OGS_FSM_TRAN(s, gmm_state_exception);
63
+                    AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
64
                     break;
65
                 }
66
 
67
@@ -1405,7 +1422,7 @@
68
                                 OGS_5GMM_CAUSE_NO_NETWORK_SLICES_AVAILABLE);
69
                         ogs_expect(r == OGS_OK);
70
                         ogs_assert(r != OGS_ERROR);
71
-                        OGS_FSM_TRAN(s, gmm_state_exception);
72
+                        AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
73
                         break;
74
                     }
75
 
76
@@ -1469,7 +1486,7 @@
77
                     OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
78
                 ogs_expect(r == OGS_OK);
79
                 ogs_assert(r != OGS_ERROR);
80
-                OGS_FSM_TRAN(s, gmm_state_exception);
81
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
82
                 break;
83
             }
84
 
85
@@ -1481,7 +1498,7 @@
86
                 r = nas_5gs_send_service_reject(ran_ue, amf_ue, gmm_cause);
87
                 ogs_expect(r == OGS_OK);
88
                 ogs_assert(r != OGS_ERROR);
89
-                OGS_FSM_TRAN(s, gmm_state_exception);
90
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
91
                 break;
92
             }
93
 
94
@@ -1491,7 +1508,7 @@
95
                     OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
96
                 ogs_expect(r == OGS_OK);
97
                 ogs_assert(r != OGS_ERROR);
98
-                OGS_FSM_TRAN(s, gmm_state_exception);
99
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
100
                 break;
101
             }
102
 
103
@@ -1501,7 +1518,7 @@
104
                     OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
105
                 ogs_expect(r == OGS_OK);
106
                 ogs_assert(r != OGS_ERROR);
107
-                OGS_FSM_TRAN(s, gmm_state_exception);
108
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
109
                 break;
110
             }
111
 
112
@@ -1520,7 +1537,7 @@
113
                 r = nas_5gs_send_service_reject(ran_ue, amf_ue, gmm_cause);
114
                 ogs_expect(r == OGS_OK);
115
                 ogs_assert(r != OGS_ERROR);
116
-                OGS_FSM_TRAN(s, gmm_state_exception);
117
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
118
                 break;
119
             }
120
 
121
@@ -1536,7 +1553,7 @@
122
                         NGAP_CauseProtocol_semantic_error);
123
                 ogs_expect(r == OGS_OK);
124
                 ogs_assert(r != OGS_ERROR);
125
-                OGS_FSM_TRAN(s, gmm_state_exception);
126
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
127
                 break;
128
             }
129
 
130
@@ -1552,7 +1569,7 @@
131
                 r = nas_5gs_send_gmm_reject(ran_ue, amf_ue, gmm_cause);
132
                 ogs_expect(r == OGS_OK);
133
                 ogs_assert(r != OGS_ERROR);
134
-                OGS_FSM_TRAN(s, gmm_state_exception);
135
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
136
                 break;
137
             }
138
 
139
@@ -1561,7 +1578,7 @@
140
                 r = nas_5gs_send_gmm_reject(ran_ue, amf_ue, gmm_cause);
141
                 ogs_expect(r == OGS_OK);
142
                 ogs_assert(r != OGS_ERROR);
143
-                OGS_FSM_TRAN(s, gmm_state_exception);
144
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
145
                 break;
146
             }
147
 
148
@@ -1591,7 +1608,7 @@
149
 
150
             if (!h.integrity_protected || !SECURITY_CONTEXT_IS_VALID(amf_ue)) {
151
                 ogs_error("No Security Context");
152
-                OGS_FSM_TRAN(s, gmm_state_exception);
153
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
154
                 break;
155
             }
156
 
157
@@ -1660,7 +1677,7 @@
158
         case OGS_NAS_5GS_UL_NAS_TRANSPORT:
159
             if (!h.integrity_protected || !SECURITY_CONTEXT_IS_VALID(amf_ue)) {
160
                 ogs_error("No Security Context");
161
-                OGS_FSM_TRAN(s, gmm_state_exception);
162
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
163
                 break;
164
             }
165
 
166
@@ -1740,7 +1757,8 @@
167
                 r = nas_5gs_send_authentication_reject(amf_ue);
168
                 ogs_expect(r == OGS_OK);
169
                 ogs_assert(r != OGS_ERROR);
170
-                goto cleanup;
171
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
172
+                break;
173
             }
174
             break;
175
 
176
@@ -1804,7 +1822,8 @@
177
             r = nas_5gs_send_authentication_reject(amf_ue);
178
             ogs_expect(r == OGS_OK);
179
             ogs_assert(r != OGS_ERROR);
180
-            goto cleanup;
181
+            AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
182
+            break;
183
 
184
         case OGS_NAS_5GS_REGISTRATION_REQUEST:
185
             ogs_warn("Registration request");
186
@@ -1817,7 +1836,8 @@
187
                 r = nas_5gs_send_registration_reject(ran_ue, amf_ue, gmm_cause);
188
                 ogs_expect(r == OGS_OK);
189
                 ogs_assert(r != OGS_ERROR);
190
-                goto cleanup;
191
+                AMF_RESTORE_CONTEXT_ON_FAILURE(amf_ue, s);
192
+                break;
193
             }
194
 
195
             r = amf_ue_sbi_discover_and_send(
196
@@ -1855,7 +1875,8 @@
197
                 r = nas_5gs_send_authentication_reject(amf_ue);
198
                 ogs_expect(r == OGS_OK);
199
                 ogs_assert(r != OGS_ERROR);
200
-                goto cleanup;
201
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/src/mme/emm-sm.c -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/src/mme/emm-sm.c Changed
201
 
1
@@ -37,6 +37,24 @@
2
 #undef OGS_LOG_DOMAIN
3
 #define OGS_LOG_DOMAIN __emm_log_domain
4
 
5
+#define MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s) do {                  \
6
+    if ((mme_ue)->can_restore_context) {                                \
7
+        /* Restore context if allowed */                                \
8
+        mme_ue_restore_memento((mme_ue), &((mme_ue)->memento));         \
9
+        (mme_ue)->security_context_available = 1;                       \
10
+        (mme_ue)->mac_failed = 0;                                       \
11
+        if (!OGS_FSM_CHECK(&mme_ue->sm, emm_state_registered))          \
12
+            OGS_FSM_TRAN((s), &emm_state_registered);                   \
13
+        ogs_warn("%s Failure in transaction; restoring context and "  \
14
+                 "transitioning to REGISTERED.", (mme_ue)->imsi_bcd);   \
15
+    } else {                                                            \
16
+        /* Transition to exception state if not allowed */              \
17
+        OGS_FSM_TRAN((s), &emm_state_exception);                        \
18
+        ogs_warn("%s Failure in transaction; no context "             \
19
+                 "restoration.", (mme_ue)->imsi_bcd);                   \
20
+    }                                                                   \
21
+} while (0)
22
+
23
 typedef enum {
24
     EMM_COMMON_STATE_DEREGISTERED,
25
     EMM_COMMON_STATE_REGISTERED,
26
@@ -45,7 +63,6 @@
27
 static void common_register_state(ogs_fsm_t *s, mme_event_t *e,
28
         emm_common_state_e state);
29
 
30
-
31
 void emm_state_initial(ogs_fsm_t *s, mme_event_t *e)
32
 {
33
     ogs_assert(s);
34
@@ -306,11 +323,11 @@
35
 
36
     /* If transition is from REGISTERED, allow restoration */
37
     if (state == EMM_COMMON_STATE_REGISTERED) {
38
-        mme_ue->can_restore_security_context = 1;
39
-        mme_backup_security_context(mme_ue, &mme_ue->sec_backup);
40
+        mme_ue->can_restore_context = 1;
41
+        mme_ue_save_memento(mme_ue, &mme_ue->memento);
42
     } else if (state == EMM_COMMON_STATE_DEREGISTERED) {
43
         /* Transition from de-registered: do not restore */
44
-        mme_ue->can_restore_security_context = 0;
45
+        mme_ue->can_restore_context = 0;
46
     }
47
 
48
     switch (e->id) {
49
@@ -346,7 +363,7 @@
50
                     OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
51
                 ogs_expect(r == OGS_OK);
52
                 ogs_assert(r != OGS_ERROR);
53
-                OGS_FSM_TRAN(s, &emm_state_exception);
54
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
55
                 break;
56
             }
57
 
58
@@ -354,7 +371,7 @@
59
                     enb_ue, mme_ue, &message->emm.service_request);
60
             if (rv != OGS_OK) {
61
                 ogs_error("emm_handle_service_request() failed");
62
-                OGS_FSM_TRAN(s, emm_state_exception);
63
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
64
                 break;
65
             }
66
 
67
@@ -364,7 +381,7 @@
68
                     OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
69
                 ogs_expect(r == OGS_OK);
70
                 ogs_assert(r != OGS_ERROR);
71
-                OGS_FSM_TRAN(s, &emm_state_exception);
72
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
73
                 break;
74
             }
75
 
76
@@ -374,7 +391,7 @@
77
                     OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
78
                 ogs_expect(r == OGS_OK);
79
                 ogs_assert(r != OGS_ERROR);
80
-                OGS_FSM_TRAN(s, &emm_state_exception);
81
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
82
                 break;
83
             }
84
 
85
@@ -384,7 +401,7 @@
86
                     OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
87
                 ogs_expect(r == OGS_OK);
88
                 ogs_assert(r != OGS_ERROR);
89
-                OGS_FSM_TRAN(s, &emm_state_exception);
90
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
91
                 break;
92
             }
93
 
94
@@ -394,7 +411,7 @@
95
                         OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED);
96
                 ogs_expect(r == OGS_OK);
97
                 ogs_assert(r != OGS_ERROR);
98
-                OGS_FSM_TRAN(s, &emm_state_exception);
99
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
100
                 break;
101
             }
102
 
103
@@ -420,7 +437,7 @@
104
                     S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
105
                 ogs_expect(r == OGS_OK);
106
                 ogs_assert(r != OGS_ERROR);
107
-                OGS_FSM_TRAN(s, emm_state_exception);
108
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
109
                 break;
110
             }
111
 
112
@@ -431,13 +448,13 @@
113
                     &message->emm.identity_response);
114
             if (rv != OGS_OK) {
115
                 ogs_error("emm_handle_identity_response() failed");
116
-                OGS_FSM_TRAN(s, emm_state_exception);
117
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
118
                 break;
119
             }
120
 
121
             if (!MME_UE_HAVE_IMSI(mme_ue)) {
122
                 ogs_error("No IMSI");
123
-                OGS_FSM_TRAN(s, emm_state_exception);
124
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
125
                 break;
126
             }
127
 
128
@@ -459,7 +476,7 @@
129
                     enb_ue, mme_ue, &message->emm.attach_request, e->pkbuf);
130
             if (rv != OGS_OK) {
131
                 ogs_error("emm_handle_attach_request() failed");
132
-                OGS_FSM_TRAN(s, emm_state_exception);
133
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
134
                 break;
135
             }
136
 
137
@@ -494,7 +511,7 @@
138
                                 OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
139
                         ogs_expect(r == OGS_OK);
140
                         ogs_assert(r != OGS_ERROR);
141
-                        OGS_FSM_TRAN(s, &emm_state_exception);
142
+                        MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
143
                         break;
144
                     }
145
                 }
146
@@ -522,7 +539,7 @@
147
                     &message->emm.tracking_area_update_request, e->pkbuf);
148
             if (rv != OGS_OK) {
149
                 ogs_error("emm_handle_tau_request() failed");
150
-                OGS_FSM_TRAN(s, emm_state_exception);
151
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
152
                 break;
153
             }
154
 
155
@@ -540,7 +557,7 @@
156
                     OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
157
                     ogs_expect(r == OGS_OK);
158
                     ogs_assert(r != OGS_ERROR);
159
-                    OGS_FSM_TRAN(s, &emm_state_exception);
160
+                    MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
161
                     break;
162
                 }
163
                 if (message->emm.tracking_area_update_request.presencemask & OGS_NAS_EPS_TRACKING_AREA_UPDATE_REQUEST_OLD_P_TMSI_SIGNATURE_TYPE)
164
@@ -556,7 +573,7 @@
165
                     OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
166
                 ogs_expect(r == OGS_OK);
167
                 ogs_assert(r != OGS_ERROR);
168
-                OGS_FSM_TRAN(s, &emm_state_exception);
169
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
170
                 break;
171
             }
172
 
173
@@ -566,7 +583,7 @@
174
                     OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
175
                 ogs_expect(r == OGS_OK);
176
                 ogs_assert(r != OGS_ERROR);
177
-                OGS_FSM_TRAN(s, emm_state_exception);
178
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
179
                 break;
180
             }
181
 
182
@@ -576,7 +593,7 @@
183
                         OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED);
184
                 ogs_expect(r == OGS_OK);
185
                 ogs_assert(r != OGS_ERROR);
186
-                OGS_FSM_TRAN(s, &emm_state_exception);
187
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
188
                 break;
189
             }
190
 
191
@@ -761,7 +778,7 @@
192
                     enb_ue, mme_ue, &message->emm.extended_service_request);
193
             if (rv != OGS_OK) {
194
                 ogs_error("emm_handle_extended_service_request() failed");
195
-                OGS_FSM_TRAN(s, emm_state_exception);
196
+                MME_RESTORE_CONTEXT_ON_FAILURE(mme_ue, s);
197
                 break;
198
             }
199
 
200
@@ -771,7 +788,7 @@
201
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/src/mme/mme-context.c -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/src/mme/mme-context.c Changed
201
 
1
@@ -4200,20 +4200,36 @@
2
 
3
         ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
4
                 source_ue->target_ue_id <= OGS_MAX_POOL_ID);
5
-        ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
6
-                target_ue->source_ue_id <= OGS_MAX_POOL_ID);
7
         source_ue->target_ue_id = OGS_INVALID_POOL_ID;
8
-        target_ue->source_ue_id = OGS_INVALID_POOL_ID;
9
+
10
+        if (target_ue) {
11
+            ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
12
+                    target_ue->source_ue_id <= OGS_MAX_POOL_ID);
13
+            target_ue->source_ue_id = OGS_INVALID_POOL_ID;
14
+        } else
15
+            ogs_error("Target-UE-ID %d has already been removed "
16
+                    "(ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d)",
17
+                    source_ue->target_ue_id,
18
+                    source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
19
+
20
+
21
     } else if (enb_ue->source_ue_id >= OGS_MIN_POOL_ID &&
22
                 enb_ue->source_ue_id <= OGS_MAX_POOL_ID) {
23
         target_ue = enb_ue;
24
         source_ue = enb_ue_find_by_id(enb_ue->source_ue_id);
25
 
26
-        ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
27
-                source_ue->target_ue_id <= OGS_MAX_POOL_ID);
28
+        if (source_ue) {
29
+            ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
30
+                    source_ue->target_ue_id <= OGS_MAX_POOL_ID);
31
+            source_ue->target_ue_id = OGS_INVALID_POOL_ID;
32
+        } else
33
+            ogs_error("Source-UE-ID %d has already been removed "
34
+                    "(ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d)",
35
+                    target_ue->source_ue_id,
36
+                    target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
37
+
38
         ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
39
                 target_ue->source_ue_id <= OGS_MAX_POOL_ID);
40
-        source_ue->target_ue_id = OGS_INVALID_POOL_ID;
41
         target_ue->source_ue_id = OGS_INVALID_POOL_ID;
42
     }
43
 }
44
@@ -4253,6 +4269,7 @@
45
 {
46
     sgw_ue_t *source_ue = NULL;
47
     sgw_ue_t *target_ue = NULL;
48
+
49
     ogs_assert(sgw_ue);
50
 
51
     if (sgw_ue->target_ue_id >= OGS_MIN_POOL_ID &&
52
@@ -4262,20 +4279,33 @@
53
 
54
         ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
55
                 source_ue->target_ue_id <= OGS_MAX_POOL_ID);
56
-        ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
57
-                target_ue->source_ue_id <= OGS_MAX_POOL_ID);
58
         source_ue->target_ue_id = OGS_INVALID_POOL_ID;
59
-        target_ue->source_ue_id = OGS_INVALID_POOL_ID;
60
+
61
+        if (target_ue) {
62
+            ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
63
+                    target_ue->source_ue_id <= OGS_MAX_POOL_ID);
64
+            target_ue->source_ue_id = OGS_INVALID_POOL_ID;
65
+        } else
66
+            ogs_error("Target-UE-ID %d has already been removed "
67
+                    "(SGW-S11-TEID%d)",
68
+                    source_ue->target_ue_id, source_ue->sgw_s11_teid);
69
+
70
     } else if (sgw_ue->source_ue_id >= OGS_MIN_POOL_ID &&
71
                 sgw_ue->source_ue_id <= OGS_MAX_POOL_ID) {
72
         target_ue = sgw_ue;
73
         source_ue = sgw_ue_find_by_id(sgw_ue->source_ue_id);
74
 
75
-        ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
76
-                source_ue->target_ue_id <= OGS_MAX_POOL_ID);
77
+        if (source_ue) {
78
+            ogs_assert(source_ue->target_ue_id >= OGS_MIN_POOL_ID &&
79
+                    source_ue->target_ue_id <= OGS_MAX_POOL_ID);
80
+            source_ue->target_ue_id = OGS_INVALID_POOL_ID;
81
+        } else
82
+            ogs_error("Source-UE-ID %d has already been removed "
83
+                    "(SGW-S11-TEID%d)",
84
+                    target_ue->source_ue_id, target_ue->sgw_s11_teid);
85
+
86
         ogs_assert(target_ue->source_ue_id >= OGS_MIN_POOL_ID &&
87
                 target_ue->source_ue_id <= OGS_MAX_POOL_ID);
88
-        source_ue->target_ue_id = OGS_INVALID_POOL_ID;
89
         target_ue->source_ue_id = OGS_INVALID_POOL_ID;
90
     }
91
 }
92
@@ -5030,80 +5060,81 @@
93
     return 0;
94
 }
95
 
96
-/* Backup the sensitive security context fields from the UE context */
97
-void mme_backup_security_context(
98
-        mme_ue_t *mme_ue, mme_security_context_t *backup)
99
+/*
100
+ * Save the sensitive (partial) context fields
101
+ * from the UE context into the memento
102
+ */
103
+void mme_ue_save_memento(mme_ue_t *mme_ue, mme_ue_memento_t *memento)
104
 {
105
     ogs_assert(mme_ue);
106
-    ogs_assert(backup);
107
+    ogs_assert(memento);
108
 
109
-    memcpy(&backup->ue_network_capability,
110
+    memcpy(&memento->ue_network_capability,
111
             &mme_ue->ue_network_capability,
112
-            sizeof(backup->ue_network_capability));
113
-    memcpy(&backup->ms_network_capability,
114
+            sizeof(memento->ue_network_capability));
115
+    memcpy(&memento->ms_network_capability,
116
             &mme_ue->ms_network_capability,
117
-            sizeof(backup->ms_network_capability));
118
-    memcpy(&backup->ue_additional_security_capability,
119
+            sizeof(memento->ms_network_capability));
120
+    memcpy(&memento->ue_additional_security_capability,
121
             &mme_ue->ue_additional_security_capability,
122
-            sizeof(backup->ue_additional_security_capability));
123
-    memcpy(backup->xres, mme_ue->xres, OGS_MAX_RES_LEN);
124
-    backup->xres_len = mme_ue->xres_len;
125
-    memcpy(backup->kasme, mme_ue->kasme, OGS_SHA256_DIGEST_SIZE);
126
-    memcpy(backup->rand, mme_ue->rand, OGS_RAND_LEN);
127
-    memcpy(backup->autn, mme_ue->autn, OGS_AUTN_LEN);
128
-    memcpy(backup->knas_int, mme_ue->knas_int,
129
+            sizeof(memento->ue_additional_security_capability));
130
+    memcpy(memento->xres, mme_ue->xres, OGS_MAX_RES_LEN);
131
+    memento->xres_len = mme_ue->xres_len;
132
+    memcpy(memento->kasme, mme_ue->kasme, OGS_SHA256_DIGEST_SIZE);
133
+    memcpy(memento->rand, mme_ue->rand, OGS_RAND_LEN);
134
+    memcpy(memento->autn, mme_ue->autn, OGS_AUTN_LEN);
135
+    memcpy(memento->knas_int, mme_ue->knas_int,
136
            OGS_SHA256_DIGEST_SIZE / 2);
137
-    memcpy(backup->knas_enc, mme_ue->knas_enc,
138
+    memcpy(memento->knas_enc, mme_ue->knas_enc,
139
            OGS_SHA256_DIGEST_SIZE / 2);
140
-    backup->dl_count = mme_ue->dl_count;
141
-    backup->ul_count = mme_ue->ul_count.i32;
142
-    memcpy(backup->kenb, mme_ue->kenb, OGS_SHA256_DIGEST_SIZE);
143
-    memcpy(backup->hash_mme, mme_ue->hash_mme, OGS_HASH_MME_LEN);
144
-    backup->nonceue = mme_ue->nonceue;
145
-    backup->noncemme = mme_ue->noncemme;
146
-    backup->gprs_ciphering_key_sequence_number =
147
+    memento->dl_count = mme_ue->dl_count;
148
+    memento->ul_count = mme_ue->ul_count.i32;
149
+    memcpy(memento->kenb, mme_ue->kenb, OGS_SHA256_DIGEST_SIZE);
150
+    memcpy(memento->hash_mme, mme_ue->hash_mme, OGS_HASH_MME_LEN);
151
+    memento->nonceue = mme_ue->nonceue;
152
+    memento->noncemme = mme_ue->noncemme;
153
+    memento->gprs_ciphering_key_sequence_number =
154
         mme_ue->gprs_ciphering_key_sequence_number;
155
-    memcpy(backup->nh, mme_ue->nh, OGS_SHA256_DIGEST_SIZE);
156
-    backup->selected_enc_algorithm = mme_ue->selected_enc_algorithm;
157
-    backup->selected_int_algorithm = mme_ue->selected_int_algorithm;
158
+    memcpy(memento->nh, mme_ue->nh, OGS_SHA256_DIGEST_SIZE);
159
+    memento->selected_enc_algorithm = mme_ue->selected_enc_algorithm;
160
+    memento->selected_int_algorithm = mme_ue->selected_int_algorithm;
161
 }
162
 
163
-/* Restore the sensitive security context fields into the UE context */
164
-void mme_restore_security_context(
165
-        mme_ue_t *mme_ue, const mme_security_context_t *backup)
166
+/* Restore the sensitive context fields into the UE context */
167
+void mme_ue_restore_memento(mme_ue_t *mme_ue, const mme_ue_memento_t *memento)
168
 {
169
     ogs_assert(mme_ue);
170
-    ogs_assert(backup);
171
+    ogs_assert(memento);
172
 
173
     memcpy(&mme_ue->ue_network_capability,
174
-            &backup->ue_network_capability,
175
+            &memento->ue_network_capability,
176
             sizeof(mme_ue->ue_network_capability));
177
     memcpy(&mme_ue->ms_network_capability,
178
-            &backup->ms_network_capability,
179
+            &memento->ms_network_capability,
180
             sizeof(mme_ue->ms_network_capability));
181
     memcpy(&mme_ue->ue_additional_security_capability,
182
-            &backup->ue_additional_security_capability,
183
+            &memento->ue_additional_security_capability,
184
             sizeof(mme_ue->ue_additional_security_capability));
185
-    memcpy(mme_ue->xres, backup->xres, OGS_MAX_RES_LEN);
186
-    mme_ue->xres_len = backup->xres_len;
187
-    memcpy(mme_ue->kasme, backup->kasme, OGS_SHA256_DIGEST_SIZE);
188
-    memcpy(mme_ue->rand, backup->rand, OGS_RAND_LEN);
189
-    memcpy(mme_ue->autn, backup->autn, OGS_AUTN_LEN);
190
-    memcpy(mme_ue->knas_int, backup->knas_int,
191
+    memcpy(mme_ue->xres, memento->xres, OGS_MAX_RES_LEN);
192
+    mme_ue->xres_len = memento->xres_len;
193
+    memcpy(mme_ue->kasme, memento->kasme, OGS_SHA256_DIGEST_SIZE);
194
+    memcpy(mme_ue->rand, memento->rand, OGS_RAND_LEN);
195
+    memcpy(mme_ue->autn, memento->autn, OGS_AUTN_LEN);
196
+    memcpy(mme_ue->knas_int, memento->knas_int,
197
            OGS_SHA256_DIGEST_SIZE / 2);
198
-    memcpy(mme_ue->knas_enc, backup->knas_enc,
199
+    memcpy(mme_ue->knas_enc, memento->knas_enc,
200
            OGS_SHA256_DIGEST_SIZE / 2);
201
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/src/mme/mme-context.h -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/src/mme/mme-context.h Changed
48
 
1
@@ -342,7 +342,7 @@
2
     ogs_pool_id_t mme_ue_id;
3
 };
4
 
5
-typedef struct mme_security_context_s {
6
+typedef struct mme_ue_memento_s {
7
     /* UE network capability info: supported network features. */
8
     ogs_nas_ue_network_capability_t ue_network_capability;
9
     /* MS network capability info: supported network features. */
10
@@ -403,7 +403,7 @@
11
     /* Selected algorithms (set by HSS/subscription) */
12
     uint8_t selected_enc_algorithm;
13
     uint8_t selected_int_algorithm;
14
-} mme_security_context_t;
15
+} mme_ue_memento_t;
16
 
17
 struct mme_ue_s {
18
     ogs_lnode_t     lnode;
19
@@ -525,11 +525,11 @@
20
     int             security_context_available;
21
     int             mac_failed;
22
 
23
-    /* flag: 1 = allow restoration of security context, 0 = disallow */
24
-    bool            can_restore_security_context;
25
+    /* flag: 1 = allow restoration of context, 0 = disallow */
26
+    bool            can_restore_context;
27
 
28
-    /* Backup of security context fields */
29
-    mme_security_context_t sec_backup;
30
+    /* Memento of context fields */
31
+    mme_ue_memento_t memento;
32
 
33
     /* Security Context */
34
     ogs_nas_ue_network_capability_t ue_network_capability;
35
@@ -1215,10 +1215,8 @@
36
 uint8_t mme_selected_int_algorithm(mme_ue_t *mme_ue);
37
 uint8_t mme_selected_enc_algorithm(mme_ue_t *mme_ue);
38
 
39
-void mme_backup_security_context(
40
-        mme_ue_t *mme_ue, mme_security_context_t *backup);
41
-void mme_restore_security_context(
42
-        mme_ue_t *mme_ue, const mme_security_context_t *backup);
43
+void mme_ue_save_memento(mme_ue_t *mme_ue, mme_ue_memento_t *memento);
44
+void mme_ue_restore_memento(mme_ue_t *mme_ue, const mme_ue_memento_t *memento);
45
 
46
 #ifdef __cplusplus
47
 }
48
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/tests/attach/crash-test.c -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/tests/attach/crash-test.c Changed
56
 
1
@@ -103,6 +103,7 @@
2
 }
3
 #endif
4
 
5
+#if 0
6
 static void test4_func(abts_case *tc, void *data)
7
 {
8
     int rv;
9
@@ -405,6 +406,7 @@
10
 
11
     test_ue_remove(test_ue);
12
 }
13
+#endif
14
 
15
 static void test5_func(abts_case *tc, void *data)
16
 {
17
@@ -449,7 +451,38 @@
18
 #if 0 /* Commenting to suppress error messages */
19
     abts_run_test(suite, test3_func, NULL);
20
 #endif
21
+
22
+/*
23
+Assume the UE has attached, the session has been created, and is in the
24
+IDLE state with the UEContextRelease process. This may lead to the following
25
+call flow:
26
+1. TAU request without integrity protection
27
+2. Authentication request/response
28
+3. Security-mode command/complete
29
+
30
+The MME may be processed concurrently by the HSS (S6A) and the UE (S1AP)
31
+as follows:
32
+   - Update-Location-Request
33
+   - Service request
34
+   - Service reject
35
+   - Delete Session Request
36
+   - Delete Session Response
37
+   - Update-Location-Answer
38
+   - UEContextReleaseCommand for Service reject
39
+   - TAU reject
40
+   - UEContextReleaseCommand for TAU reject
41
+   - UEContextReleaseComplete (for Service reject)
42
+   - UEContextReleaseComplete (for TAU reject)
43
+
44
+If the Update-Location-Answer is received before the Delete Session Response,
45
+the session still exists, and a TAU accept may be received. This causes the
46
+test procedure to wait indefinitely. Due to this issue, the test code has
47
+been commented out.
48
+*/
49
+#if 0
50
     abts_run_test(suite, test4_func, NULL);
51
+#endif
52
+
53
     abts_run_test(suite, test5_func, NULL);
54
 
55
     return suite;
56
open5gs_2.7.2.4636.10b1.202503202026.tar.xz/tests/unit/nas-message-test.c -> open5gs_2.7.2.4639.a551.202503212026.tar.xz/tests/unit/nas-message-test.c Changed
13
 
1
@@ -410,9 +410,9 @@
2
     ABTS_INT_EQUAL(tc, OGS_ERROR, rv);
3
     rv = ogs_nas_gprs_timer_3_from_sec(&gprs_timer, 60*2);
4
     ABTS_INT_EQUAL(tc, OGS_OK, rv);
5
-    ABTS_INT_EQUAL(tc, OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_1_MM,
6
+    ABTS_INT_EQUAL(tc, OGS_NAS_GPRS_TIMER_3_UNIT_MULTIPLES_OF_30_SS,
7
             gprs_timer.unit);
8
-    ABTS_INT_EQUAL(tc, 2, gprs_timer.value);
9
+    ABTS_INT_EQUAL(tc, 4, gprs_timer.value);
10
     rv = ogs_nas_gprs_timer_3_from_sec(&gprs_timer, 60*2+1);
11
     ABTS_INT_EQUAL(tc, OGS_ERROR, rv);
12
     rv = ogs_nas_gprs_timer_3_from_sec(&gprs_timer, 60*30);
13