Error getting diff: tar:

Changes of Revision 115

commit_689574a2d9ce9f10d9a5b861a1b5953171eed095.txt Added
commit_a8f83989f4fdd55a176de3f159aa026750a5c5a8.txt Deleted
open5gs_2.5.5.100.a8f8.dsc -> open5gs_2.5.5.101.6895.dsc Changed
x
 
1
@@ -2,7 +2,7 @@
2
 Source: open5gs
3
 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
4
 Architecture: any
5
-Version: 2.5.5.100.a8f8
6
+Version: 2.5.5.101.6895
7
 Maintainer: Harald Welte <laforge@gnumonks.org>
8
 Uploaders: Sukchan Lee <acetcom@gmail.com>
9
 Homepage: https://open5gs.org
10
@@ -31,8 +31,8 @@
11
  open5gs-udr deb net optional arch=any
12
  open5gs-upf deb net optional arch=any
13
 Checksums-Sha1:
14
- e395a7378bf13b85fe3b229b74e70007e5583fc7 13611620 open5gs_2.5.5.100.a8f8.tar.xz
15
+ 5d87a89ff215cddb2a6c415bdf79a1b643c34ee7 13611540 open5gs_2.5.5.101.6895.tar.xz
16
 Checksums-Sha256:
17
- 84d699461e4bb14e733633f9a8d6ccb10b6ae49441a357fe973e8cf04b8b0193 13611620 open5gs_2.5.5.100.a8f8.tar.xz
18
+ 1b3c16c42512e82be1572559054333fc8829a5f7f9e3700cf0e5768038fb630a 13611540 open5gs_2.5.5.101.6895.tar.xz
19
 Files:
20
- f9e06dfc04435d7b6f142689b0bd6ce4 13611620 open5gs_2.5.5.100.a8f8.tar.xz
21
+ 8a5ca2672687a98d4cdf0727e8146c1f 13611540 open5gs_2.5.5.101.6895.tar.xz
22
open5gs_2.5.5.100.a8f8.tar.xz/.tarball-version -> open5gs_2.5.5.101.6895.tar.xz/.tarball-version Changed
4
 
1
@@ -1 +1 @@
2
-2.5.5.100-a8f8
3
+2.5.5.101-6895
4
open5gs_2.5.5.100.a8f8.tar.xz/debian/changelog -> open5gs_2.5.5.101.6895.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-open5gs (2.5.5.100.a8f8) unstable; urgency=medium
3
+open5gs (2.5.5.101.6895) unstable; urgency=medium
4
 
5
   * Automatically generated changelog entry for building the Osmocom master feed
6
 
7
- -- Osmocom OBS scripts <info@osmocom.org>  Mon, 23 Jan 2023 00:34:51 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org>  Mon, 23 Jan 2023 02:03:42 +0000
9
 
10
 open5gs (2.5.6) unstable; urgency=medium
11
 
12
open5gs_2.5.5.100.a8f8.tar.xz/lib/core/ogs-errno.h -> open5gs_2.5.5.101.6895.tar.xz/lib/core/ogs-errno.h Changed
19
 
1
@@ -74,11 +74,12 @@
2
 
3
 #endif
4
 
5
-#define OGS_OK       0
6
-#define OGS_ERROR   -1
7
-#define OGS_RETRY   -2
8
-#define OGS_TIMEUP  -3
9
-#define OGS_DONE    -4
10
+#define OGS_OK           0
11
+#define OGS_ERROR       -1
12
+#define OGS_RETRY       -2
13
+#define OGS_TIMEUP      -3
14
+#define OGS_DONE        -4
15
+#define OGS_NOTFOUND    -5
16
 
17
 char *ogs_strerror(ogs_err_t err, char *buf, size_t size);
18
 
19
open5gs_2.5.5.100.a8f8.tar.xz/lib/core/ogs-pkbuf.c -> open5gs_2.5.5.101.6895.tar.xz/lib/core/ogs-pkbuf.c Changed
17
 
1
@@ -318,6 +318,7 @@
2
     newbuf = ogs_pkbuf_alloc_debug(NULL, size, file_line);
3
     if (!newbuf) {
4
         ogs_error("ogs_pkbuf_alloc() failed size=%d", size);
5
+        ogs_pkbuf_free(pkbuf);
6
         return NULL;
7
     }
8
 
9
@@ -344,6 +345,7 @@
10
     ogs_pool_alloc(&pool->pkbuf, &newbuf);
11
     if (!newbuf) {
12
         ogs_error("ogs_pkbuf_copy() failed");
13
+        ogs_pkbuf_free(pkbuf);
14
         ogs_thread_mutex_unlock(&pool->mutex);
15
         return NULL;
16
     }
17
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/amf-sm.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/amf-sm.c Changed
107
 
1
@@ -45,7 +45,7 @@
2
 
3
 void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
4
 {
5
-    int rv;
6
+    int r, rv;
7
     char bufOGS_ADDRSTRLEN;
8
     const char *api_version = NULL;
9
 
10
@@ -621,9 +621,10 @@
11
                 }
12
 
13
                 ogs_error("%s Cannot receive SBI message", amf_ue->suci);
14
-                ogs_expect(OGS_OK ==
15
-                    nas_5gs_send_gmm_reject_from_sbi(amf_ue,
16
-                        OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
17
+                r = nas_5gs_send_gmm_reject_from_sbi(amf_ue,
18
+                        OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
19
+                ogs_expect(r == OGS_OK);
20
+                ogs_assert(r != OGS_ERROR);
21
                 break;
22
 
23
             case OGS_SBI_OBJ_SESS_TYPE:
24
@@ -638,16 +639,17 @@
25
                 ogs_error("%d:%d Cannot receive SBI message",
26
                         sess->psi, sess->pti);
27
                 if (sess->payload_container_type) {
28
-                    ogs_expect(OGS_OK ==
29
-                        nas_5gs_send_back_gsm_message(sess,
30
+                    r = nas_5gs_send_back_gsm_message(sess,
31
                             OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
32
-                            AMF_NAS_BACKOFF_TIME));
33
+                            AMF_NAS_BACKOFF_TIME);
34
+                    ogs_expect(r == OGS_OK);
35
+                    ogs_assert(r != OGS_ERROR);
36
                 } else {
37
-                    ogs_expect(OGS_OK ==
38
-                        ngap_send_error_indication2(amf_ue,
39
+                    r = ngap_send_error_indication2(amf_ue,
40
                             NGAP_Cause_PR_transport,
41
-                            NGAP_CauseTransport_transport_resource_unavailable)
42
-                    );
43
+                            NGAP_CauseTransport_transport_resource_unavailable);
44
+                    ogs_expect(r == OGS_OK);
45
+                    ogs_assert(r != OGS_ERROR);
46
                 }
47
                 break;
48
 
49
@@ -755,10 +757,11 @@
50
             ogs_fsm_dispatch(&gnb->sm, e);
51
         } else {
52
             ogs_error("Cannot decode NGAP message");
53
-            ogs_assert(OGS_OK ==
54
-                ngap_send_error_indication(
55
+            r = ngap_send_error_indication(
56
                     gnb, NULL, NULL, NGAP_Cause_PR_protocol, 
57
-                    NGAP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
58
+                    NGAP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
59
+            ogs_expect(r == OGS_OK);
60
+            ogs_assert(r != OGS_ERROR);
61
         }
62
 
63
         ogs_ngap_free(&ngap_message);
64
@@ -776,7 +779,9 @@
65
             pkbuf = e->pkbuf;
66
             ogs_assert(pkbuf);
67
 
68
-            ogs_expect(OGS_OK == ngap_send_to_ran_ue(ran_ue, pkbuf));
69
+            r = ngap_send_to_ran_ue(ran_ue, pkbuf);
70
+            ogs_expect(r == OGS_OK);
71
+            ogs_assert(r != OGS_ERROR);
72
             ogs_timer_delete(e->timer);
73
             break;
74
         case AMF_TIMER_NG_HOLDING:
75
@@ -811,11 +816,13 @@
76
             if (!amf_ue) {
77
                 amf_ue = amf_ue_add(ran_ue);
78
                 if (amf_ue == NULL) {
79
-                    ogs_expect(OGS_OK ==
80
-                        ngap_send_ran_ue_context_release_command(ran_ue,
81
+                    r = ngap_send_ran_ue_context_release_command(
82
+                            ran_ue,
83
                             NGAP_Cause_PR_misc,
84
                             NGAP_CauseMisc_control_processing_overload,
85
-                            NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
86
+                            NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
87
+                    ogs_expect(r == OGS_OK);
88
+                    ogs_assert(r != OGS_ERROR);
89
                     ogs_pkbuf_free(pkbuf);
90
                     return;
91
                 }
92
@@ -871,10 +878,11 @@
93
                 /* De-associate NG with NAS/EMM */
94
                 ran_ue_deassociate(amf_ue->ran_ue);
95
 
96
-                ogs_expect(OGS_OK ==
97
-                    ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
98
+                r = ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
99
                         NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
100
-                        NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
101
+                        NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
102
+                ogs_expect(r == OGS_OK);
103
+                ogs_assert(r != OGS_ERROR);
104
             }
105
             amf_ue_associate_ran_ue(amf_ue, ran_ue);
106
 
107
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/gmm-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/gmm-handler.c Changed
190
 
1
@@ -548,7 +548,7 @@
2
 {
3
     amf_sess_t *sess = NULL;
4
     uint16_t psimask = 0;
5
-    int xact_count = 0;
6
+    int xact_count = 0, r;
7
 
8
     ogs_nas_uplink_data_status_t *uplink_data_status = NULL;
9
     ogs_nas_pdu_session_status_t *pdu_session_status = NULL;
10
@@ -634,9 +634,11 @@
11
         }
12
     }
13
 
14
-    if (amf_sess_xact_count(amf_ue) == xact_count)
15
-        ogs_assert(OGS_OK ==
16
-            nas_5gs_send_service_accept(amf_ue));
17
+    if (amf_sess_xact_count(amf_ue) == xact_count) {
18
+        r = nas_5gs_send_service_accept(amf_ue);
19
+        ogs_expect(r == OGS_OK);
20
+        ogs_assert(r != OGS_ERROR);
21
+    }
22
 
23
     return OGS_5GMM_CAUSE_REQUEST_ACCEPTED;
24
 }
25
@@ -644,6 +646,7 @@
26
 int gmm_handle_deregistration_request(amf_ue_t *amf_ue,
27
         ogs_nas_5gs_deregistration_request_from_ue_t *deregistration_request)
28
 {
29
+    int r;
30
     ogs_nas_de_registration_type_t *de_registration_type = NULL;
31
 
32
     ogs_assert(amf_ue);
33
@@ -690,9 +693,11 @@
34
     amf_sbi_send_release_all_sessions(
35
             amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
36
 
37
-    if (ogs_list_count(&amf_ue->sess_list) == 0)
38
-        ogs_assert(OGS_OK ==
39
-            nas_5gs_send_de_registration_accept(amf_ue));
40
+    if (ogs_list_count(&amf_ue->sess_list) == 0) {
41
+        r = nas_5gs_send_de_registration_accept(amf_ue);
42
+        ogs_expect(r == OGS_OK);
43
+        ogs_assert(r != OGS_ERROR);
44
+    }
45
 
46
     return OGS_OK;
47
 }
48
@@ -885,6 +890,7 @@
49
 int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
50
         ogs_nas_5gs_ul_nas_transport_t *ul_nas_transport)
51
 {
52
+    int r;
53
     ogs_slice_data_t *selected_slice = NULL;
54
     amf_sess_t *sess = NULL;
55
     amf_nsmf_pdusession_sm_context_param_t param;
56
@@ -906,34 +912,38 @@
57
 
58
     if (!payload_container_type->value) {
59
         ogs_error("%s No Payload container type", amf_ue->supi);
60
-        ogs_assert(OGS_OK ==
61
-            nas_5gs_send_gmm_status(
62
-                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
63
+        r = nas_5gs_send_gmm_status(
64
+                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
65
+        ogs_expect(r == OGS_OK);
66
+        ogs_assert(r != OGS_ERROR);
67
         return OGS_ERROR;
68
     }
69
 
70
     if (!payload_container->length) {
71
         ogs_error("%s No Payload container length", amf_ue->supi);
72
-        ogs_assert(OGS_OK ==
73
-            nas_5gs_send_gmm_status(
74
-                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
75
+        r = nas_5gs_send_gmm_status(
76
+                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
77
+        ogs_expect(r == OGS_OK);
78
+        ogs_assert(r != OGS_ERROR);
79
         return OGS_ERROR;
80
     }
81
 
82
     if (!payload_container->buffer) {
83
         ogs_error("%s No Payload container buffer", amf_ue->supi);
84
-        ogs_assert(OGS_OK ==
85
-            nas_5gs_send_gmm_status(
86
-                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
87
+        r = nas_5gs_send_gmm_status(
88
+                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
89
+        ogs_expect(r == OGS_OK);
90
+        ogs_assert(r != OGS_ERROR);
91
         return OGS_ERROR;
92
     }
93
 
94
     if ((ul_nas_transport->presencemask &
95
         OGS_NAS_5GS_UL_NAS_TRANSPORT_PDU_SESSION_ID_PRESENT) == 0) {
96
         ogs_error("%s No PDU session ID", amf_ue->supi);
97
-        ogs_assert(OGS_OK ==
98
-            nas_5gs_send_gmm_status(
99
-                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
100
+        r = nas_5gs_send_gmm_status(
101
+                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
102
+        ogs_expect(r == OGS_OK);
103
+        ogs_assert(r != OGS_ERROR);
104
         return OGS_ERROR;
105
     }
106
 
107
@@ -941,9 +951,10 @@
108
     if (*pdu_session_id == OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
109
         ogs_error("%s PDU session identity is unassigned",
110
                 amf_ue->supi);
111
-        ogs_assert(OGS_OK ==
112
-            nas_5gs_send_gmm_status(
113
-                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION));
114
+        r = nas_5gs_send_gmm_status(
115
+                amf_ue, OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION);
116
+        ogs_expect(r == OGS_OK);
117
+        ogs_assert(r != OGS_ERROR);
118
         return OGS_ERROR;
119
     }
120
 
121
@@ -964,9 +975,10 @@
122
             if (!sess) {
123
                 ogs_error("%s No Session Context %d",
124
                     amf_ue->supi, gsm_header->message_type);
125
-                ogs_assert(OGS_OK ==
126
-                    nas_5gs_send_gmm_status(amf_ue,
127
-                    OGS_5GMM_CAUSE_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION));
128
+                r = nas_5gs_send_gmm_status(amf_ue,
129
+                    OGS_5GMM_CAUSE_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION);
130
+                ogs_expect(r == OGS_OK);
131
+                ogs_assert(r != OGS_ERROR);
132
                 return OGS_ERROR;
133
             }
134
         }
135
@@ -1072,8 +1084,10 @@
136
             if (!selected_slice || !sess->dnn) {
137
                 ogs_warn("%s DNN Not Supported OR "
138
                             "Not Subscribed in the Slice", amf_ue->supi);
139
-                ogs_assert(OGS_OK ==
140
-                    nas_5gs_send_gmm_status(amf_ue, OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE));
141
+                r = nas_5gs_send_gmm_status(amf_ue,
142
+                        OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE);
143
+                ogs_expect(r == OGS_OK);
144
+                ogs_assert(r != OGS_ERROR);
145
                 return OGS_ERROR;
146
             }
147
 
148
@@ -1137,9 +1151,10 @@
149
             if (!SESSION_CONTEXT_IN_SMF(sess)) {
150
                 ogs_error("%s:%d Session Context is not in SMF %d",
151
                     amf_ue->supi, sess->psi, gsm_header->message_type);
152
-                ogs_assert(OGS_OK ==
153
-                    nas_5gs_send_back_gsm_message(sess,
154
-                        OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE, 0));
155
+                r = nas_5gs_send_back_gsm_message(sess,
156
+                        OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE, 0);
157
+                ogs_expect(r == OGS_OK);
158
+                ogs_assert(r != OGS_ERROR);
159
                 return OGS_ERROR;
160
             }
161
 
162
@@ -1192,9 +1207,10 @@
163
                     memset(&param, 0, sizeof(param));
164
                     param.acknowledgement_requested = 1;
165
                     param.guti = 1;
166
-                    ogs_assert(OGS_OK ==
167
-                        nas_5gs_send_configuration_update_command(
168
-                            amf_ue, &param));
169
+                    r = nas_5gs_send_configuration_update_command(
170
+                            amf_ue, &param);
171
+                    ogs_expect(r == OGS_OK);
172
+                    ogs_assert(r != OGS_ERROR);
173
 
174
                     AMF_UE_CLEAR_PAGING_INFO(amf_ue);
175
                 }
176
@@ -1212,9 +1228,10 @@
177
     default:
178
         ogs_error("%s Unknown Payload container type %d",
179
             amf_ue->supi, payload_container_type->value);
180
-        ogs_assert(OGS_OK ==
181
-            nas_5gs_send_gmm_status(amf_ue,
182
-                OGS_5GMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED));
183
+        r = nas_5gs_send_gmm_status(amf_ue,
184
+                OGS_5GMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED);
185
+        ogs_expect(r == OGS_OK);
186
+        ogs_assert(r != OGS_ERROR);
187
         return OGS_ERROR;
188
     }
189
 
190
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/gmm-sm.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/gmm-sm.c Changed
607
 
1
@@ -58,7 +58,7 @@
2
 
3
     ogs_sbi_message_t *sbi_message = NULL;
4
 
5
-    int state = 0;
6
+    int r, state = 0;
7
 
8
     ogs_assert(e);
9
 
10
@@ -96,8 +96,9 @@
11
                 OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
12
             } else {
13
                 amf_ue->t3570.retry_count++;
14
-                ogs_assert(OGS_OK ==
15
-                    nas_5gs_send_identity_request(amf_ue));
16
+                r = nas_5gs_send_identity_request(amf_ue);
17
+                ogs_expect(r == OGS_OK);
18
+                ogs_assert(r != OGS_ERROR);
19
             }
20
             break;
21
 
22
@@ -110,9 +111,10 @@
23
                 OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
24
             } else {
25
                 amf_ue->t3522.retry_count++;
26
-                ogs_assert(OGS_OK ==
27
-                    nas_5gs_send_de_registration_request(amf_ue,
28
-                        OpenAPI_deregistration_reason_NULL));
29
+                r = nas_5gs_send_de_registration_request(amf_ue,
30
+                        OpenAPI_deregistration_reason_NULL);
31
+                ogs_expect(r == OGS_OK);
32
+                ogs_assert(r != OGS_ERROR);
33
             }
34
             break;
35
 
36
@@ -287,9 +289,11 @@
37
                     break;
38
 
39
                 CASE(OGS_SBI_HTTP_METHOD_DELETE)
40
-                    if (state != AMF_NETWORK_INITIATED_DE_REGISTERED)
41
-                        ogs_assert(OGS_OK ==
42
-                            nas_5gs_send_de_registration_accept(amf_ue));
43
+                    if (state != AMF_NETWORK_INITIATED_DE_REGISTERED) {
44
+                        r = nas_5gs_send_de_registration_accept(amf_ue);
45
+                        ogs_expect(r == OGS_OK);
46
+                        ogs_assert(r != OGS_ERROR);
47
+                    }
48
 
49
                     PCF_AM_POLICY_CLEAR(amf_ue);
50
                     break;
51
@@ -320,7 +324,7 @@
52
 
53
 void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
54
 {
55
-    int i;
56
+    int i, r;
57
 
58
     amf_ue_t *amf_ue = NULL;
59
     amf_sess_t *sess = NULL;
60
@@ -389,7 +393,9 @@
61
             } else {
62
                 amf_ue->t3513.retry_count++;
63
                 /* If t3513 is timeout, the saved pkbuf is used.  */
64
-                ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
65
+                r = ngap_send_paging(amf_ue);
66
+                ogs_expect(r == OGS_OK);
67
+                ogs_assert(r != OGS_ERROR);
68
             }
69
             break;
70
 
71
@@ -408,8 +414,9 @@
72
                  * If t3555 is timeout, the saved pkbuf is used.
73
                  * In this case, ack should be set to 1 for timer expiration
74
                  */
75
-                ogs_assert(OGS_OK ==
76
-                    nas_5gs_send_configuration_update_command(amf_ue, NULL));
77
+                r = nas_5gs_send_configuration_update_command(amf_ue, NULL);
78
+                ogs_expect(r == OGS_OK);
79
+                ogs_assert(r != OGS_ERROR);
80
             }
81
             break;
82
 
83
@@ -422,8 +429,9 @@
84
                 OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
85
             } else {
86
                 amf_ue->t3570.retry_count++;
87
-                ogs_assert(OGS_OK ==
88
-                    nas_5gs_send_identity_request(amf_ue));
89
+                r = nas_5gs_send_identity_request(amf_ue);
90
+                ogs_expect(r == OGS_OK);
91
+                ogs_assert(r != OGS_ERROR);
92
             }
93
             break;
94
 
95
@@ -507,7 +515,7 @@
96
 
97
 static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
98
 {
99
-    int rv, xact_count = 0;
100
+    int r, rv, xact_count = 0;
101
     ogs_nas_5gmm_cause_t gmm_cause;
102
 
103
     amf_ue_t *amf_ue = NULL;
104
@@ -548,16 +556,18 @@
105
             if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
106
                 ogs_error("gmm_handle_registration_request() failed %d",
107
                             gmm_cause);
108
-                ogs_assert(OGS_OK ==
109
-                    nas_5gs_send_registration_reject(amf_ue, gmm_cause));
110
+                r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
111
+                ogs_expect(r == OGS_OK);
112
+                ogs_assert(r != OGS_ERROR);
113
                 OGS_FSM_TRAN(s, gmm_state_exception);
114
                 break;
115
             }
116
 
117
             if (!AMF_UE_HAVE_SUCI(amf_ue)) {
118
                 CLEAR_AMF_UE_TIMER(amf_ue->t3570);
119
-                ogs_assert(OGS_OK ==
120
-                    nas_5gs_send_identity_request(amf_ue));
121
+                r = nas_5gs_send_identity_request(amf_ue);
122
+                ogs_expect(r == OGS_OK);
123
+                ogs_assert(r != OGS_ERROR);
124
                 break;
125
             }
126
 
127
@@ -568,8 +578,9 @@
128
                 if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
129
                     ogs_error("%s gmm_handle_registration_update() "
130
                                 "failed %d", amf_ue->suci, gmm_cause);
131
-                    ogs_assert(OGS_OK ==
132
-                        nas_5gs_send_registration_reject(amf_ue, gmm_cause));
133
+                    r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
134
+                    ogs_expect(r == OGS_OK);
135
+                    ogs_assert(r != OGS_ERROR);
136
                     OGS_FSM_TRAN(s, gmm_state_exception);
137
                     break;
138
                 }
139
@@ -595,8 +606,9 @@
140
                     }
141
 
142
                     CLEAR_AMF_UE_TIMER(amf_ue->t3550);
143
-                    ogs_assert(OGS_OK ==
144
-                        nas_5gs_send_registration_accept(amf_ue));
145
+                    r = nas_5gs_send_registration_accept(amf_ue);
146
+                    ogs_expect(r == OGS_OK);
147
+                    ogs_assert(r != OGS_ERROR);
148
                 }
149
 
150
                 if (amf_ue->next.m_tmsi)
151
@@ -628,28 +640,29 @@
152
             if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
153
                 ogs_error("%s gmm_handle_service_request() failed %d",
154
                             amf_ue->suci, gmm_cause);
155
-                ogs_assert(OGS_OK ==
156
-                    nas_5gs_send_service_reject(amf_ue, gmm_cause));
157
+                r = nas_5gs_send_service_reject(amf_ue, gmm_cause);
158
+                ogs_expect(r == OGS_OK);
159
+                ogs_assert(r != OGS_ERROR);
160
                 OGS_FSM_TRAN(s, gmm_state_exception);
161
                 break;
162
             }
163
 
164
             if (!AMF_UE_HAVE_SUCI(amf_ue)) {
165
                 ogs_info("Service request : Unknown UE");
166
-                ogs_assert(OGS_OK ==
167
-                    nas_5gs_send_service_reject(amf_ue,
168
-                    OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
169
-                );
170
+                r = nas_5gs_send_service_reject(amf_ue,
171
+                    OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
172
+                ogs_expect(r == OGS_OK);
173
+                ogs_assert(r != OGS_ERROR);
174
                 OGS_FSM_TRAN(s, gmm_state_exception);
175
                 break;
176
             }
177
 
178
             if (!h.integrity_protected || !SECURITY_CONTEXT_IS_VALID(amf_ue)) {
179
                 ogs_error("No Security Context");
180
-                ogs_assert(OGS_OK ==
181
-                    nas_5gs_send_service_reject(amf_ue,
182
-                    OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
183
-                );
184
+                r = nas_5gs_send_service_reject(amf_ue,
185
+                    OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
186
+                ogs_expect(r == OGS_OK);
187
+                ogs_assert(r != OGS_ERROR);
188
                 OGS_FSM_TRAN(s, gmm_state_exception);
189
                 break;
190
             }
191
@@ -659,8 +672,9 @@
192
             if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
193
                 ogs_error("%s gmm_handle_service_update() failed %d",
194
                             amf_ue->suci, gmm_cause);
195
-                ogs_assert(OGS_OK ==
196
-                    nas_5gs_send_service_reject(amf_ue, gmm_cause));
197
+                r = nas_5gs_send_service_reject(amf_ue, gmm_cause);
198
+                ogs_expect(r == OGS_OK);
199
+                ogs_assert(r != OGS_ERROR);
200
                 OGS_FSM_TRAN(s, gmm_state_exception);
201
             }
202
 
203
@@ -719,10 +733,11 @@
204
             /* De-associate NG with NAS/EMM */
205
             ran_ue_deassociate(amf_ue->ran_ue);
206
 
207
-            ogs_assert(OGS_OK ==
208
-                ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
209
+            r = ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
210
                     NGAP_Cause_PR_misc, NGAP_CauseMisc_om_intervention,
211
-                    NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
212
+                    NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
213
+            ogs_expect(r == OGS_OK);
214
+            ogs_assert(r != OGS_ERROR);
215
 
216
             OGS_FSM_TRAN(s, &gmm_state_de_registered);
217
             break;
218
@@ -789,7 +804,7 @@
219
 
220
 void gmm_state_authentication(ogs_fsm_t *s, amf_event_t *e)
221
 {
222
-    int rv;
223
+    int r, rv;
224
     ogs_nas_5gmm_cause_t gmm_cause;
225
 
226
     amf_ue_t *amf_ue = NULL;
227
@@ -835,8 +850,9 @@
228
                     amf_ue, &nas_message->gmm.authentication_response);
229
 
230
             if (rv != OGS_OK) {
231
-                ogs_assert(OGS_OK ==
232
-                    nas_5gs_send_authentication_reject(amf_ue));
233
+                r = nas_5gs_send_authentication_reject(amf_ue);
234
+                ogs_expect(r == OGS_OK);
235
+                ogs_assert(r != OGS_ERROR);
236
                 OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
237
             }
238
             break;
239
@@ -893,8 +909,9 @@
240
                 break;
241
             }
242
 
243
-            ogs_assert(OGS_OK ==
244
-                nas_5gs_send_authentication_reject(amf_ue));
245
+            r = nas_5gs_send_authentication_reject(amf_ue);
246
+            ogs_expect(r == OGS_OK);
247
+            ogs_assert(r != OGS_ERROR);
248
             OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
249
 
250
             break;
251
@@ -906,8 +923,9 @@
252
             if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
253
                 ogs_error("%s gmm_handle_registration_request() failed %d",
254
                             amf_ue->suci, gmm_cause);
255
-                ogs_assert(OGS_OK ==
256
-                    nas_5gs_send_registration_reject(amf_ue, gmm_cause));
257
+                r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
258
+                ogs_expect(r == OGS_OK);
259
+                ogs_assert(r != OGS_ERROR);
260
                 OGS_FSM_TRAN(s, gmm_state_exception);
261
                 break;
262
             }
263
@@ -944,17 +962,15 @@
264
                     amf_timer_cfg(AMF_TIMER_T3560)->max_count) {
265
                 ogs_warn("%s Retransmission failed. Stop retransmission",
266
                         amf_ue->suci);
267
-                ogs_assert(OGS_OK ==
268
-                    nas_5gs_send_authentication_reject(amf_ue));
269
+                r = nas_5gs_send_authentication_reject(amf_ue);
270
+                ogs_expect(r == OGS_OK);
271
+                ogs_assert(r != OGS_ERROR);
272
                 OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
273
             } else {
274
-                rv = nas_5gs_send_authentication_request(amf_ue);
275
-                if (rv == OGS_OK) {
276
-                    amf_ue->t3560.retry_count++;
277
-                } else {
278
-                    ogs_error("nas_5gs_send_authentication_request() failed");
279
-                    OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
280
-                }
281
+                amf_ue->t3560.retry_count++;
282
+                r = nas_5gs_send_authentication_request(amf_ue);
283
+                ogs_expect(r == OGS_OK);
284
+                ogs_assert(r != OGS_ERROR);
285
             }
286
             break;
287
         default:
288
@@ -982,9 +998,10 @@
289
                         ogs_error("%s HTTP response error %d",
290
                             amf_ue->suci, sbi_message->res_status);
291
                     }
292
-                    ogs_assert(OGS_OK ==
293
-                        nas_5gs_send_gmm_reject_from_sbi(
294
-                            amf_ue, sbi_message->res_status));
295
+                    r = nas_5gs_send_gmm_reject_from_sbi(
296
+                            amf_ue, sbi_message->res_status);
297
+                    ogs_expect(r == OGS_OK);
298
+                    ogs_assert(r != OGS_ERROR);
299
                     OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
300
                     break;
301
                 }
302
@@ -996,8 +1013,9 @@
303
                     if (rv != OGS_OK) {
304
                         ogs_error("%s Cannot handle SBI message",
305
                                 amf_ue->suci);
306
-                        ogs_assert(OGS_OK ==
307
-                            nas_5gs_send_authentication_reject(amf_ue));
308
+                        r = nas_5gs_send_authentication_reject(amf_ue);
309
+                        ogs_expect(r == OGS_OK);
310
+                        ogs_assert(r != OGS_ERROR);
311
                         OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
312
                     }
313
                     break;
314
@@ -1007,8 +1025,9 @@
315
                     if (rv != OGS_OK) {
316
                         ogs_error("%s Cannot handle SBI message",
317
                                 amf_ue->suci);
318
-                        ogs_assert(OGS_OK ==
319
-                            nas_5gs_send_authentication_reject(amf_ue));
320
+                        r = nas_5gs_send_authentication_reject(amf_ue);
321
+                        ogs_expect(r == OGS_OK);
322
+                        ogs_assert(r != OGS_ERROR);
323
                         OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
324
                     } else {
325
                         OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_security_mode);
326
@@ -1042,7 +1061,7 @@
327
 
328
 void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
329
 {
330
-    int rv;
331
+    int r;
332
     ogs_nas_5gmm_cause_t gmm_cause;
333
     amf_ue_t *amf_ue = NULL;
334
     ogs_nas_5gs_message_t *nas_message = NULL;
335
@@ -1059,8 +1078,9 @@
336
     switch (e->h.id) {
337
     case OGS_FSM_ENTRY_SIG:
338
         CLEAR_AMF_UE_TIMER(amf_ue->t3560);
339
-        ogs_assert(OGS_OK ==
340
-            nas_5gs_send_security_mode_command(amf_ue));
341
+        r = nas_5gs_send_security_mode_command(amf_ue);
342
+        ogs_expect(r == OGS_OK);
343
+        ogs_assert(r != OGS_ERROR);
344
         break;
345
     case OGS_FSM_EXIT_SIG:
346
         break;
347
@@ -1109,8 +1129,9 @@
348
                 ogs_error("%s gmm_handle_security_mode_complete() "
349
                             "failed %d in type %d",
350
                             amf_ue->suci, gmm_cause, amf_ue->nas.message_type);
351
-                ogs_assert(OGS_OK ==
352
-                    nas_5gs_send_gmm_reject(amf_ue, gmm_cause));
353
+                r = nas_5gs_send_gmm_reject(amf_ue, gmm_cause);
354
+                ogs_expect(r == OGS_OK);
355
+                ogs_assert(r != OGS_ERROR);
356
                 OGS_FSM_TRAN(s, gmm_state_exception);
357
                 break;
358
             }
359
@@ -1151,8 +1172,9 @@
360
             if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
361
                 ogs_error("%s gmm_handle_registration_request() failed %d",
362
                             amf_ue->suci, gmm_cause);
363
-                ogs_assert(OGS_OK ==
364
-                    nas_5gs_send_registration_reject(amf_ue, gmm_cause));
365
+                r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
366
+                ogs_expect(r == OGS_OK);
367
+                ogs_assert(r != OGS_ERROR);
368
                 OGS_FSM_TRAN(s, gmm_state_exception);
369
                 break;
370
             }
371
@@ -1167,10 +1189,10 @@
372
 
373
         case OGS_NAS_5GS_SERVICE_REQUEST:
374
             ogs_info("%s Service request", amf_ue->supi);
375
-            ogs_assert(OGS_OK ==
376
-                nas_5gs_send_service_reject(amf_ue,
377
-                    OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
378
-            );
379
+            r = nas_5gs_send_service_reject(amf_ue,
380
+                    OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
381
+            ogs_expect(r == OGS_OK);
382
+            ogs_assert(r != OGS_ERROR);
383
             OGS_FSM_TRAN(s, &gmm_state_exception);
384
             break;
385
 
386
@@ -1199,18 +1221,16 @@
387
             if (amf_ue->t3560.retry_count >=
388
                     amf_timer_cfg(AMF_TIMER_T3560)->max_count) {
389
                 ogs_warn("%s Retransmission failed. Stop", amf_ue->supi);
390
-                ogs_assert(OGS_OK ==
391
-                    nas_5gs_send_gmm_reject(amf_ue,
392
-                        OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
393
+                r = nas_5gs_send_gmm_reject(amf_ue,
394
+                        OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED);
395
+                ogs_expect(r == OGS_OK);
396
+                ogs_assert(r != OGS_ERROR);
397
                 OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
398
             } else {
399
-                rv = nas_5gs_send_security_mode_command(amf_ue);
400
-                if (rv == OGS_OK) {
401
-                    amf_ue->t3560.retry_count++;
402
-                } else {
403
-                    ogs_error("nas_5gs_send_security_mode_command() failed");
404
-                    OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
405
-                }
406
+                amf_ue->t3560.retry_count++;
407
+                r = nas_5gs_send_security_mode_command(amf_ue);
408
+                ogs_expect(r == OGS_OK);
409
+                ogs_assert(r != OGS_ERROR);
410
             }
411
             break;
412
         default:
413
@@ -1227,7 +1247,7 @@
414
 
415
 void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
416
 {
417
-    int rv, state, xact_count = 0;
418
+    int rv, r, state, xact_count = 0;
419
     ogs_nas_5gmm_cause_t gmm_cause;
420
 
421
     amf_ue_t *amf_ue = NULL;
422
@@ -1274,9 +1294,10 @@
423
                     sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) {
424
                     ogs_error("%s HTTP response error %d",
425
                             amf_ue->supi, sbi_message->res_status);
426
-                    ogs_assert(OGS_OK ==
427
-                        nas_5gs_send_gmm_reject(
428
-                            amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED));
429
+                    r = nas_5gs_send_gmm_reject(
430
+                            amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
431
+                    ogs_expect(r == OGS_OK);
432
+                    ogs_assert(r != OGS_ERROR);
433
                     OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
434
                     break;
435
                 }
436
@@ -1316,9 +1337,10 @@
437
                     (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED)) {
438
                     ogs_error("%s HTTP response error %d",
439
                             amf_ue->supi, sbi_message->res_status);
440
-                    ogs_assert(OGS_OK ==
441
-                        nas_5gs_send_gmm_reject(
442
-                            amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED));
443
+                    r = nas_5gs_send_gmm_reject(
444
+                            amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
445
+                    ogs_expect(r == OGS_OK);
446
+                    ogs_assert(r != OGS_ERROR);
447
                     OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
448
                     break;
449
                 }
450
@@ -1328,9 +1350,10 @@
451
                 if (rv != OGS_OK) {
452
                     ogs_error("%s amf_nudm_sdm_handle_provisioned(%s) failed",
453
                             amf_ue->supi, sbi_message->h.resource.component1);
454
-                    ogs_assert(OGS_OK ==
455
-                        nas_5gs_send_gmm_reject(
456
-                            amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED));
457
+                    r = nas_5gs_send_gmm_reject(
458
+                            amf_ue, OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
459
+                    ogs_expect(r == OGS_OK);
460
+                    ogs_assert(r != OGS_ERROR);
461
                     OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
462
                     break;
463
                 }
464
@@ -1360,8 +1383,9 @@
465
                     ogs_assert(amf_ue->nas.message_type ==
466
                             OGS_NAS_5GS_REGISTRATION_REQUEST);
467
                     CLEAR_AMF_UE_TIMER(amf_ue->t3550);
468
-                    ogs_assert(OGS_OK ==
469
-                            nas_5gs_send_registration_accept(amf_ue));
470
+                    r = nas_5gs_send_registration_accept(amf_ue);
471
+                    ogs_expect(r == OGS_OK);
472
+                    ogs_assert(r != OGS_ERROR);
473
 
474
                     /* In nsmf-handler.c
475
                      *
476
@@ -1465,8 +1489,9 @@
477
              */
478
             memset(&param, 0, sizeof(param));
479
             param.nitz = 1;
480
-            ogs_assert(OGS_OK ==
481
-                nas_5gs_send_configuration_update_command(amf_ue, &param));
482
+            r = nas_5gs_send_configuration_update_command(amf_ue, &param);
483
+            ogs_expect(r == OGS_OK);
484
+            ogs_assert(r != OGS_ERROR);
485
 
486
             OGS_FSM_TRAN(s, &gmm_state_registered);
487
             break;
488
@@ -1479,8 +1504,9 @@
489
             if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
490
                 ogs_error("%s gmm_handle_registration_request() failed %d",
491
                             amf_ue->suci, gmm_cause);
492
-                ogs_assert(OGS_OK ==
493
-                    nas_5gs_send_registration_reject(amf_ue, gmm_cause));
494
+                r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
495
+                ogs_expect(r == OGS_OK);
496
+                ogs_assert(r != OGS_ERROR);
497
                 OGS_FSM_TRAN(s, gmm_state_exception);
498
                 break;
499
             }
500
@@ -1499,10 +1525,10 @@
501
 
502
         case OGS_NAS_5GS_SERVICE_REQUEST:
503
             ogs_info("%s Service request", amf_ue->supi);
504
-            ogs_assert(OGS_OK ==
505
-                nas_5gs_send_service_reject(amf_ue,
506
-                    OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
507
-            );
508
+            r = nas_5gs_send_service_reject(amf_ue,
509
+                OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
510
+            ogs_expect(r == OGS_OK);
511
+            ogs_assert(r != OGS_ERROR);
512
             OGS_FSM_TRAN(s, &gmm_state_exception);
513
             break;
514
 
515
@@ -1534,13 +1560,10 @@
516
                         amf_ue->suci);
517
                 OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
518
             } else {
519
-                rv = nas_5gs_send_registration_accept(amf_ue);
520
-                if (rv == OGS_OK) {
521
-                    amf_ue->t3550.retry_count++;
522
-                } else {
523
-                    ogs_error("nas_5gs_send_registration_accept() failed");
524
-                    OGS_FSM_TRAN(&amf_ue->sm, &gmm_state_exception);
525
-                }
526
+                amf_ue->t3550.retry_count++;
527
+                r = nas_5gs_send_registration_accept(amf_ue);
528
+                ogs_expect(r == OGS_OK);
529
+                ogs_assert(r != OGS_ERROR);
530
             }
531
             break;
532
         default:
533
@@ -1557,7 +1580,7 @@
534
 
535
 void gmm_state_exception(ogs_fsm_t *s, amf_event_t *e)
536
 {
537
-    int xact_count = 0;
538
+    int xact_count = 0, r;
539
     ogs_nas_5gmm_cause_t gmm_cause;
540
 
541
     amf_ue_t *amf_ue = NULL;
542
@@ -1588,11 +1611,13 @@
543
         amf_sbi_send_release_all_sessions(
544
                 amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
545
 
546
-        if (ogs_list_count(&amf_ue->sess_list) == 0)
547
-            ogs_assert(OGS_OK ==
548
-                ngap_send_amf_ue_context_release_command(amf_ue,
549
+        if (ogs_list_count(&amf_ue->sess_list) == 0) {
550
+            r = ngap_send_amf_ue_context_release_command(amf_ue,
551
                     NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
552
-                    NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
553
+                    NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
554
+            ogs_expect(r == OGS_OK);
555
+            ogs_assert(r != OGS_ERROR);
556
+        }
557
         break;
558
     case OGS_FSM_EXIT_SIG:
559
         break;
560
@@ -1617,16 +1642,18 @@
561
             if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
562
                 ogs_error("gmm_handle_registration_request() failed %d",
563
                             gmm_cause);
564
-                ogs_assert(OGS_OK ==
565
-                    nas_5gs_send_registration_reject(amf_ue, gmm_cause));
566
+                r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
567
+                ogs_expect(r == OGS_OK);
568
+                ogs_assert(r != OGS_ERROR);
569
                 OGS_FSM_TRAN(s, gmm_state_exception);
570
                 break;
571
             }
572
 
573
             if (!AMF_UE_HAVE_SUCI(amf_ue)) {
574
                 CLEAR_AMF_UE_TIMER(amf_ue->t3570);
575
-                ogs_assert(OGS_OK ==
576
-                    nas_5gs_send_identity_request(amf_ue));
577
+                r = nas_5gs_send_identity_request(amf_ue);
578
+                ogs_expect(r == OGS_OK);
579
+                ogs_assert(r != OGS_ERROR);
580
 
581
                 OGS_FSM_TRAN(s, &gmm_state_de_registered);
582
                 break;
583
@@ -1639,8 +1666,9 @@
584
                 if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
585
                     ogs_error("%s gmm_handle_registration_update() "
586
                                 "failed %d", amf_ue->suci, gmm_cause);
587
-                    ogs_assert(OGS_OK ==
588
-                        nas_5gs_send_registration_reject(amf_ue, gmm_cause));
589
+                    r = nas_5gs_send_registration_reject(amf_ue, gmm_cause);
590
+                    ogs_expect(r == OGS_OK);
591
+                    ogs_assert(r != OGS_ERROR);
592
                     OGS_FSM_TRAN(s, gmm_state_exception);
593
                     break;
594
                 }
595
@@ -1664,8 +1692,9 @@
596
                     }
597
 
598
                     CLEAR_AMF_UE_TIMER(amf_ue->t3550);
599
-                    ogs_assert(OGS_OK ==
600
-                        nas_5gs_send_registration_accept(amf_ue));
601
+                    r = nas_5gs_send_registration_accept(amf_ue);
602
+                    ogs_expect(r == OGS_OK);
603
+                    ogs_assert(r != OGS_ERROR);
604
                 }
605
 
606
                 if (amf_ue->next.m_tmsi)
607
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/namf-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/namf-handler.c Changed
107
 
1
@@ -27,7 +27,7 @@
2
 int amf_namf_comm_handle_n1_n2_message_transfer(
3
         ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
4
 {
5
-    int status;
6
+    int status, r;
7
 
8
     amf_ue_t *amf_ue = NULL;
9
     ran_ue_t *ran_ue = NULL;
10
@@ -206,7 +206,9 @@
11
                  * sm-context-ref is created in 1-CLIENT.
12
                  * So, the PDU session establishment accpet can be transmitted.
13
                  */
14
-                    ogs_expect(OGS_OK == ngap_send_to_ran_ue(ran_ue, ngapbuf));
15
+                    r = ngap_send_to_ran_ue(ran_ue, ngapbuf);
16
+                    ogs_expect(r == OGS_OK);
17
+                    ogs_assert(r != OGS_ERROR);
18
                 } else {
19
                     sess->pdu_session_establishment_accept = ngapbuf;
20
                 }
21
@@ -285,12 +287,15 @@
22
                     AMF_SESS_STORE_N2_TRANSFER(
23
                             sess, pdu_session_resource_setup_request, n2buf);
24
 
25
-                    ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
26
+                    r = ngap_send_paging(amf_ue);
27
+                    ogs_expect(r == OGS_OK);
28
+                    ogs_assert(r != OGS_ERROR);
29
                 }
30
 
31
             } else if (CM_CONNECTED(amf_ue)) {
32
-                ogs_assert(OGS_OK ==
33
-                    nas_send_pdu_session_setup_request(sess, NULL, n2buf));
34
+                r = nas_send_pdu_session_setup_request(sess, NULL, n2buf);
35
+                ogs_expect(r == OGS_OK);
36
+                ogs_assert(r != OGS_ERROR);
37
 
38
             } else {
39
 
40
@@ -349,12 +354,15 @@
41
                         OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND,
42
                         n1buf, n2buf);
43
 
44
-                ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
45
+                r = ngap_send_paging(amf_ue);
46
+                ogs_expect(r == OGS_OK);
47
+                ogs_assert(r != OGS_ERROR);
48
             }
49
 
50
         } else if (CM_CONNECTED(amf_ue)) {
51
-            ogs_expect(OGS_OK ==
52
-                nas_send_pdu_session_modification_command(sess, n1buf, n2buf));
53
+            r = nas_send_pdu_session_modification_command(sess, n1buf, n2buf);
54
+            ogs_expect(r == OGS_OK);
55
+            ogs_assert(r != OGS_ERROR);
56
 
57
         } else {
58
             ogs_fatal("%s Invalid AMF-UE state", amf_ue->supi);
59
@@ -386,8 +394,9 @@
60
             }
61
 
62
         } else if (CM_CONNECTED(amf_ue)) {
63
-            ogs_expect(OGS_OK ==
64
-                nas_send_pdu_session_release_command(sess, NULL, n2buf));
65
+            r = nas_send_pdu_session_release_command(sess, NULL, n2buf);
66
+            ogs_expect(r == OGS_OK);
67
+            ogs_assert(r != OGS_ERROR);
68
         } else {
69
             ogs_fatal("%s Invalid AMF-UE state", amf_ue->supi);
70
             ogs_assert_if_reached();
71
@@ -512,11 +521,13 @@
72
 static int do_network_initiated_de_register(
73
         amf_ue_t *amf_ue, OpenAPI_deregistration_reason_e dereg_reason)
74
 {
75
+    int r;
76
     if ((CM_CONNECTED(amf_ue)) &&
77
         (OGS_FSM_CHECK(&amf_ue->sm, gmm_state_registered))) {
78
 
79
-        ogs_assert(OGS_OK ==
80
-            nas_5gs_send_de_registration_request(amf_ue, dereg_reason));
81
+        r = nas_5gs_send_de_registration_request(amf_ue, dereg_reason);
82
+        ogs_expect(r == OGS_OK);
83
+        ogs_assert(r != OGS_ERROR);
84
 
85
         amf_sbi_send_release_all_sessions(
86
             amf_ue, AMF_NETWORK_INITIATED_DE_REGISTERED);
87
@@ -809,6 +820,7 @@
88
         ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
89
 {
90
     int status = OGS_SBI_HTTP_STATUS_NO_CONTENT;
91
+    int r;
92
 
93
     amf_ue_t *amf_ue = NULL;
94
 
95
@@ -905,8 +917,9 @@
96
         ngapbuf = ngap_build_ue_context_modification_request(amf_ue);
97
         ogs_assert(ngapbuf);
98
 
99
-        if (nas_5gs_send_to_gnb(amf_ue, ngapbuf) != OGS_OK)
100
-            ogs_error("nas_5gs_send_to_gnb() failed");
101
+        r = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
102
+        ogs_expect(r == OGS_OK);
103
+        ogs_assert(r != OGS_ERROR);
104
     }
105
 
106
 cleanup:
107
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/nas-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/nas-path.c Changed
553
 
1
@@ -24,16 +24,20 @@
2
 
3
 int nas_5gs_send_to_gnb(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf)
4
 {
5
+    int rv;
6
     ogs_assert(pkbuf);
7
 
8
     amf_ue = amf_ue_cycle(amf_ue);
9
     if (!amf_ue) {
10
-        ogs_warn("UE(amf-ue) context has already been removed");
11
+        ogs_error("UE(amf-ue) context has already been removed");
12
         ogs_pkbuf_free(pkbuf);
13
-        return OGS_ERROR;
14
+        return OGS_NOTFOUND;
15
     }
16
 
17
-    return ngap_send_to_ran_ue(amf_ue->ran_ue, pkbuf);
18
+    rv = ngap_send_to_ran_ue(amf_ue->ran_ue, pkbuf);
19
+    ogs_expect(rv == OGS_OK);
20
+
21
+    return rv;
22
 }
23
 
24
 int nas_5gs_send_to_downlink_nas_transport(amf_ue_t *amf_ue, ogs_pkbuf_t *pkbuf)
25
@@ -46,21 +50,24 @@
26
 
27
     amf_ue = amf_ue_cycle(amf_ue);
28
     if (!amf_ue) {
29
-        ogs_warn("UE(amf-ue) context has already been removed");
30
+        ogs_error("UE(amf-ue) context has already been removed");
31
         ogs_pkbuf_free(pkbuf);
32
-        return OGS_ERROR;
33
+        return OGS_NOTFOUND;
34
     }
35
 
36
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
37
     if (!ran_ue) {
38
-        ogs_warn("NG context has already been removed");
39
+        ogs_error("NG context has already been removed");
40
         ogs_pkbuf_free(pkbuf);
41
-        return OGS_ERROR;
42
+        return OGS_NOTFOUND;
43
     }
44
 
45
     ngapbuf = ngap_build_downlink_nas_transport(
46
             ran_ue, pkbuf, false, false);
47
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
48
+    if (!ngapbuf) {
49
+        ogs_error("ngap_build_downlink_nas_transport() failed");
50
+        return OGS_ERROR;
51
+    }
52
 
53
     rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
54
     ogs_expect(rv == OGS_OK);
55
@@ -80,26 +87,37 @@
56
 
57
     ogs_assert(amf_ue);
58
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
59
-    ogs_expect_or_return_val(ran_ue, OGS_ERROR);
60
+    if (!ran_ue) {
61
+        ogs_error("NG context has already been removed");
62
+        return OGS_NOTFOUND;
63
+    }
64
 
65
     ogs_debug("%s Registration accept", amf_ue->supi);
66
 
67
     if (amf_ue->next.m_tmsi) {
68
         if (amf_ue->t3550.pkbuf) {
69
             gmmbuf = amf_ue->t3550.pkbuf;
70
-            ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
71
         } else {
72
             gmmbuf = gmm_build_registration_accept(amf_ue);
73
-            ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
74
+            if (!gmmbuf) {
75
+                ogs_error("gmm_build_registration_accept() failed");
76
+                return OGS_ERROR;
77
+            }
78
         }
79
 
80
         amf_ue->t3550.pkbuf = ogs_pkbuf_copy(gmmbuf);
81
-        ogs_expect_or_return_val(amf_ue->t3550.pkbuf, OGS_ERROR);
82
+        if (!amf_ue->t3550.pkbuf) {
83
+            ogs_error("ogs_pkbuf_copy(amf_ue->t3550.pkbuf) failed");
84
+            return OGS_ERROR;
85
+        }
86
         ogs_timer_start(amf_ue->t3550.timer,
87
                 amf_timer_cfg(AMF_TIMER_T3550)->duration);
88
     } else {
89
         gmmbuf = gmm_build_registration_accept(amf_ue);
90
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
91
+        if (!gmmbuf) {
92
+            ogs_error("gmm_build_registration_accept() failed");
93
+            return OGS_ERROR;
94
+        }
95
     }
96
 
97
     /*
98
@@ -125,31 +143,41 @@
99
     if (ran_ue->initial_context_setup_request_sent == false &&
100
         (ran_ue->ue_context_requested == true || transfer_needed == true)) {
101
         ngapbuf = ngap_ue_build_initial_context_setup_request(amf_ue, gmmbuf);
102
-        ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
103
+        if (!ngapbuf) {
104
+            ogs_error("ngap_ue_build_initial_context_setup_request() failed");
105
+            return OGS_ERROR;
106
+        }
107
 
108
         rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
109
-        ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
110
+        ogs_expect(rv == OGS_OK);
111
 
112
         ran_ue->initial_context_setup_request_sent = true;
113
     } else {
114
         if (transfer_needed == true) {
115
             ngapbuf = ngap_ue_build_pdu_session_resource_setup_request(
116
                     amf_ue, gmmbuf);
117
-            ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
118
+            if (!ngapbuf) {
119
+                ogs_error("ngap_ue_build_pdu_session_resource_setup_request()"
120
+                        " failed");
121
+                return OGS_ERROR;
122
+            }
123
 
124
             rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
125
-            ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
126
+            ogs_expect(rv == OGS_OK);
127
         } else {
128
             ngapbuf = ngap_build_downlink_nas_transport(
129
                     ran_ue, gmmbuf, true, true);
130
-            ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
131
+            if (!ngapbuf) {
132
+                ogs_error("ngap_build_downlink_nas_transport() failed");
133
+                return OGS_ERROR;
134
+            }
135
 
136
             rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
137
-            ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
138
+            ogs_expect(rv == OGS_OK);
139
         }
140
     }
141
 
142
-    return OGS_OK;
143
+    return rv;
144
 }
145
 
146
 int nas_5gs_send_registration_reject(
147
@@ -165,7 +193,10 @@
148
     ogs_warn("%s Registration reject %d", amf_ue->suci, gmm_cause);
149
 
150
     gmmbuf = gmm_build_registration_reject(gmm_cause);
151
-    ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
152
+    if (!gmmbuf) {
153
+        ogs_error("gmm_build_registration_reject() failed");
154
+        return OGS_ERROR;
155
+    }
156
 
157
     rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
158
     ogs_expect(rv == OGS_OK);
159
@@ -184,12 +215,18 @@
160
 
161
     ogs_assert(amf_ue);
162
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
163
-    ogs_expect_or_return_val(ran_ue, OGS_ERROR);
164
+    if (!ran_ue) {
165
+        ogs_error("NG context has already been removed");
166
+        return OGS_NOTFOUND;
167
+    }
168
 
169
     ogs_debug("%s Service accept", amf_ue->supi);
170
 
171
     gmmbuf = gmm_build_service_accept(amf_ue);
172
-    ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
173
+    if (!gmmbuf) {
174
+        ogs_error("gmm_build_registration_reject() failed");
175
+        return OGS_ERROR;
176
+    }
177
 
178
     /*
179
      * Previously, AMF would sends PDUSessionResourceSetupRequest
180
@@ -214,27 +251,34 @@
181
     if (ran_ue->initial_context_setup_request_sent == false &&
182
         (ran_ue->ue_context_requested == true || transfer_needed == true)) {
183
         ngapbuf = ngap_ue_build_initial_context_setup_request(amf_ue, gmmbuf);
184
-        ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
185
+        if (!ngapbuf) {
186
+            ogs_error("ngap_ue_build_initial_context_setup_request() failed");
187
+            return OGS_ERROR;
188
+        }
189
 
190
         rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
191
-        ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
192
+        ogs_expect(rv == OGS_OK);
193
 
194
         ran_ue->initial_context_setup_request_sent = true;
195
     } else {
196
         if (transfer_needed == true) {
197
             ngapbuf = ngap_ue_build_pdu_session_resource_setup_request(
198
                     amf_ue, gmmbuf);
199
-            ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
200
+            if (!ngapbuf) {
201
+                ogs_error("ngap_ue_build_pdu_session_resource_setup_request()"
202
+                        " failed");
203
+                return OGS_ERROR;
204
+            }
205
 
206
             rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
207
-            ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
208
+            ogs_expect(rv == OGS_OK);
209
         } else {
210
             rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
211
-            ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
212
+            ogs_expect(rv == OGS_OK);
213
         }
214
     }
215
 
216
-    return OGS_OK;
217
+    return rv;
218
 }
219
 
220
 int nas_5gs_send_service_reject(
221
@@ -248,7 +292,10 @@
222
     ogs_debug("%s Service reject", amf_ue->supi);
223
 
224
     gmmbuf = gmm_build_service_reject(amf_ue, gmm_cause);
225
-    ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
226
+    if (!gmmbuf) {
227
+        ogs_error("gmm_build_registration_reject() failed");
228
+        return OGS_ERROR;
229
+    }
230
 
231
     rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
232
     ogs_expect(rv == OGS_OK);
233
@@ -265,7 +312,10 @@
234
 
235
     ogs_assert(amf_ue);
236
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
237
-    ogs_expect_or_return_val(ran_ue, OGS_ERROR);
238
+    if (!ran_ue) {
239
+        ogs_error("NG context has already been removed");
240
+        return OGS_NOTFOUND;
241
+    }
242
 
243
     ogs_debug("%s De-registration accept", amf_ue->supi);
244
 
245
@@ -273,10 +323,16 @@
246
         int rv;
247
 
248
         gmmbuf = gmm_build_de_registration_accept(amf_ue);
249
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
250
+        if (!gmmbuf) {
251
+            ogs_error("gmm_build_registration_reject() failed");
252
+            return OGS_ERROR;
253
+        }
254
 
255
         rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
256
-        ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
257
+        if (rv != OGS_OK) {
258
+            ogs_error("nas_5gs_send_to_downlink_nas_transport() failed");
259
+            return rv;
260
+        }
261
     }
262
 
263
     rv = ngap_send_ran_ue_context_release_command(ran_ue,
264
@@ -297,25 +353,33 @@
265
 
266
     ogs_assert(amf_ue);
267
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
268
-    ogs_expect_or_return_val(ran_ue, OGS_ERROR);
269
+    if (!ran_ue) {
270
+        ogs_error("NG context has already been removed");
271
+        return OGS_NOTFOUND;
272
+    }
273
 
274
     ogs_debug("%s De-registration request", amf_ue->supi);
275
 
276
     if (amf_ue->t3522.pkbuf) {
277
         gmmbuf = amf_ue->t3522.pkbuf;
278
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
279
     } else {
280
         gmmbuf = gmm_build_de_registration_request(amf_ue, dereg_reason);
281
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
282
+        if (!gmmbuf) {
283
+            ogs_error("gmm_build_de_registration_request() failed");
284
+            return OGS_ERROR;
285
+        }
286
     }
287
 
288
     amf_ue->t3522.pkbuf = ogs_pkbuf_copy(gmmbuf);
289
-    ogs_expect_or_return_val(amf_ue->t3522.pkbuf, OGS_ERROR);
290
+    if (!amf_ue->t3522.pkbuf) {
291
+        ogs_error("ogs_pkbuf_copy(amf_ue->t3522.pkbuf) failed");
292
+        return OGS_ERROR;
293
+    }
294
     ogs_timer_start(amf_ue->t3522.timer,
295
             amf_timer_cfg(AMF_TIMER_T3522)->duration);
296
 
297
     rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
298
-    ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
299
+    ogs_expect(rv == OGS_OK);
300
 
301
     return rv;
302
 }
303
@@ -331,14 +395,19 @@
304
 
305
     if (amf_ue->t3570.pkbuf) {
306
         gmmbuf = amf_ue->t3570.pkbuf;
307
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
308
     } else {
309
         gmmbuf = gmm_build_identity_request(amf_ue);
310
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
311
+        if (!gmmbuf) {
312
+            ogs_error("gmm_build_identity_request() failed");
313
+            return OGS_ERROR;
314
+        }
315
     }
316
 
317
     amf_ue->t3570.pkbuf = ogs_pkbuf_copy(gmmbuf);
318
-    ogs_expect_or_return_val(amf_ue->t3570.pkbuf, OGS_ERROR);
319
+    if (!amf_ue->t3570.pkbuf) {
320
+        ogs_error("ogs_pkbuf_copy(amf_ue->t3570.pkbuf) failed");
321
+        return OGS_ERROR;
322
+    }
323
     ogs_timer_start(amf_ue->t3570.timer,
324
             amf_timer_cfg(AMF_TIMER_T3570)->duration);
325
 
326
@@ -359,14 +428,19 @@
327
 
328
     if (amf_ue->t3560.pkbuf) {
329
         gmmbuf = amf_ue->t3560.pkbuf;
330
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
331
     } else {
332
         gmmbuf = gmm_build_authentication_request(amf_ue);
333
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
334
+        if (!gmmbuf) {
335
+            ogs_error("gmm_build_authentication_request() failed");
336
+            return OGS_ERROR;
337
+        }
338
     }
339
 
340
     amf_ue->t3560.pkbuf = ogs_pkbuf_copy(gmmbuf);
341
-    ogs_expect_or_return_val(amf_ue->t3560.pkbuf, OGS_ERROR);
342
+    if (!amf_ue->t3560.pkbuf) {
343
+        ogs_error("ogs_pkbuf_copy(amf_ue->t3560.pkbuf) failed");
344
+        return OGS_ERROR;
345
+    }
346
     ogs_timer_start(amf_ue->t3560.timer,
347
             amf_timer_cfg(AMF_TIMER_T3560)->duration);
348
 
349
@@ -388,7 +462,10 @@
350
     ogs_warn("%s Authentication reject", amf_ue->suci);
351
 
352
     gmmbuf = gmm_build_authentication_reject();
353
-    ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
354
+    if (!gmmbuf) {
355
+        ogs_error("gmm_build_authentication_reject() failed");
356
+        return OGS_ERROR;
357
+    }
358
 
359
     rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
360
     ogs_expect(rv == OGS_OK);
361
@@ -407,14 +484,19 @@
362
 
363
     if (amf_ue->t3560.pkbuf) {
364
         gmmbuf = amf_ue->t3560.pkbuf;
365
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
366
     } else {
367
         gmmbuf = gmm_build_security_mode_command(amf_ue);
368
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
369
+        if (!gmmbuf) {
370
+            ogs_error("gmm_build_security_mode_command() failed");
371
+            return OGS_ERROR;
372
+        }
373
     }
374
 
375
     amf_ue->t3560.pkbuf = ogs_pkbuf_copy(gmmbuf);
376
-    ogs_expect_or_return_val(amf_ue->t3560.pkbuf, OGS_ERROR);
377
+    if (!amf_ue->t3560.pkbuf) {
378
+        ogs_error("ogs_pkbuf_copy(amf_ue->t3560.pkbuf) failed");
379
+        return OGS_ERROR;
380
+    }
381
     ogs_timer_start(amf_ue->t3560.timer,
382
             amf_timer_cfg(AMF_TIMER_T3560)->duration);
383
 
384
@@ -436,21 +518,32 @@
385
 
386
     if (amf_ue->t3555.pkbuf) {
387
         gmmbuf = amf_ue->t3555.pkbuf;
388
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
389
 
390
         amf_ue->t3555.pkbuf = ogs_pkbuf_copy(gmmbuf);
391
-        ogs_expect_or_return_val(amf_ue->t3555.pkbuf, OGS_ERROR);
392
+        if (!amf_ue->t3555.pkbuf) {
393
+            ogs_error("ogs_pkbuf_copy(amf_ue->t3555.pkbuf) failed");
394
+            return OGS_ERROR;
395
+        }
396
         ogs_timer_start(amf_ue->t3555.timer,
397
                 amf_timer_cfg(AMF_TIMER_T3555)->duration);
398
 
399
     } else {
400
-        ogs_expect_or_return_val(param, OGS_ERROR);
401
+        if (!param) {
402
+            ogs_error("No param");
403
+            return OGS_ERROR;
404
+        }
405
         gmmbuf = gmm_build_configuration_update_command(amf_ue, param);
406
-        ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
407
+        if (!gmmbuf) {
408
+            ogs_error("gmm_build_configuration_update_command() failed");
409
+            return OGS_ERROR;
410
+        }
411
 
412
         if (param->acknowledgement_requested) {
413
             amf_ue->t3555.pkbuf = ogs_pkbuf_copy(gmmbuf);
414
-            ogs_expect_or_return_val(amf_ue->t3555.pkbuf, OGS_ERROR);
415
+            if (!amf_ue->t3555.pkbuf) {
416
+                ogs_error("ogs_pkbuf_copy(amf_ue->t3555.pkbuf) failed");
417
+                return OGS_ERROR;
418
+            }
419
             ogs_timer_start(amf_ue->t3555.timer,
420
                     amf_timer_cfg(AMF_TIMER_T3555)->duration);
421
         }
422
@@ -476,17 +569,17 @@
423
     ogs_assert(sess);
424
     amf_ue = amf_ue_cycle(sess->amf_ue);
425
     if (!amf_ue) {
426
-        ogs_warn("UE(amf-ue) context has already been removed");
427
+        ogs_error("UE(amf-ue) context has already been removed");
428
         if (n1smbuf) ogs_pkbuf_free(n1smbuf);
429
         ogs_pkbuf_free(n2smbuf);
430
-        return OGS_ERROR;
431
+        return OGS_NOTFOUND;
432
     }
433
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
434
     if (!ran_ue) {
435
         ogs_warn("NG context has already been removed");
436
         if (n1smbuf) ogs_pkbuf_free(n1smbuf);
437
         ogs_pkbuf_free(n2smbuf);
438
-        return OGS_ERROR;
439
+        return OGS_NOTFOUND;
440
     }
441
 
442
     if (n1smbuf) {
443
@@ -508,10 +601,7 @@
444
         }
445
 
446
         rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
447
-        if (rv != OGS_OK) {
448
-            ogs_error("nas_5gs_send_to_gnb() failed");
449
-            return OGS_ERROR;
450
-        }
451
+        ogs_expect(rv == OGS_OK);
452
 
453
         ran_ue->initial_context_setup_request_sent = true;
454
     } else {
455
@@ -523,10 +613,7 @@
456
         }
457
 
458
         rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
459
-        if (rv != OGS_OK) {
460
-            ogs_error("nas_5gs_send_to_gnb() failed");
461
-            return OGS_ERROR;
462
-        }
463
+        ogs_expect(rv == OGS_OK);
464
     }
465
 
466
     return rv;
467
@@ -546,17 +633,17 @@
468
     ogs_assert(sess);
469
     amf_ue = amf_ue_cycle(sess->amf_ue);
470
     if (!amf_ue) {
471
-        ogs_warn("UE(amf-ue) context has already been removed");
472
+        ogs_error("UE(amf-ue) context has already been removed");
473
         if (n1smbuf) ogs_pkbuf_free(n1smbuf);
474
         ogs_pkbuf_free(n2smbuf);
475
-        return OGS_ERROR;
476
+        return OGS_NOTFOUND;
477
     }
478
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
479
     if (!ran_ue) {
480
         ogs_warn("NG context has already been removed");
481
         if (n1smbuf) ogs_pkbuf_free(n1smbuf);
482
         ogs_pkbuf_free(n2smbuf);
483
-        return OGS_ERROR;
484
+        return OGS_NOTFOUND;
485
     }
486
 
487
     if (n1smbuf) {
488
@@ -607,17 +694,17 @@
489
     ogs_assert(sess);
490
     amf_ue = amf_ue_cycle(sess->amf_ue);
491
     if (!amf_ue) {
492
-        ogs_warn("UE(amf-ue) context has already been removed");
493
+        ogs_error("UE(amf-ue) context has already been removed");
494
         if (n1smbuf) ogs_pkbuf_free(n1smbuf);
495
         ogs_pkbuf_free(n2smbuf);
496
-        return OGS_ERROR;
497
+        return OGS_NOTFOUND;
498
     }
499
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
500
     if (!ran_ue) {
501
         ogs_warn("NG context has already been removed");
502
         if (n1smbuf) ogs_pkbuf_free(n1smbuf);
503
         ogs_pkbuf_free(n2smbuf);
504
-        return OGS_ERROR;
505
+        return OGS_NOTFOUND;
506
     }
507
 
508
     if (n1smbuf) {
509
@@ -689,7 +776,10 @@
510
     ogs_debug("%s 5GMM status", amf_ue->supi);
511
 
512
     gmmbuf = gmm_build_status(amf_ue, cause);
513
-    ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
514
+    if (!gmmbuf) {
515
+        ogs_error("gmm_build_status() failed");
516
+        return OGS_ERROR;
517
+    }
518
 
519
     rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
520
     ogs_expect(rv == OGS_OK);
521
@@ -776,9 +866,12 @@
522
 
523
     gmmbuf = gmm_build_dl_nas_transport(sess,
524
             payload_container_type, payload_container, cause, backoff_time);
525
-    ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
526
+    if (!gmmbuf) {
527
+        ogs_error("gmm_build_dl_nas_transport() failed");
528
+        return OGS_ERROR;
529
+    }
530
     rv = nas_5gs_send_to_downlink_nas_transport(amf_ue, gmmbuf);
531
-    ogs_expect_or_return_val(rv == OGS_OK, OGS_ERROR);
532
+    ogs_expect(rv == OGS_OK);
533
 
534
     return rv;
535
 }
536
@@ -823,10 +916,13 @@
537
     ogs_assert(sess->payload_container);
538
 
539
     pbuf = ogs_pkbuf_copy(sess->payload_container);
540
-    ogs_expect_or_return_val(pbuf, OGS_ERROR);
541
+    if (!pbuf) {
542
+        ogs_error("ogs_pkbuf_copy(pbuf) failed");
543
+        return OGS_ERROR;
544
+    }
545
 
546
-    rv = nas_5gs_send_dl_nas_transport(sess, sess->payload_container_type, pbuf,
547
-            cause, backoff_time);
548
+    rv = nas_5gs_send_dl_nas_transport(
549
+            sess, sess->payload_container_type, pbuf, cause, backoff_time);
550
     ogs_expect(rv == OGS_OK);
551
 
552
     return rv;
553
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/nausf-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/nausf-handler.c Changed
21
 
1
@@ -23,6 +23,7 @@
2
 int amf_nausf_auth_handle_authenticate(
3
         amf_ue_t *amf_ue, ogs_sbi_message_t *message)
4
 {
5
+    int r;
6
     OpenAPI_ue_authentication_ctx_t *UeAuthenticationCtx = NULL;
7
     OpenAPI_av5g_aka_t *AV5G_AKA = NULL;
8
     OpenAPI_links_value_schema_t *LinksValueSchemeValue = NULL;
9
@@ -111,8 +112,9 @@
10
 
11
     amf_ue->nas.ue.ksi = amf_ue->nas.amf.ksi;
12
 
13
-    ogs_assert(OGS_OK ==
14
-        nas_5gs_send_authentication_request(amf_ue));
15
+    r = nas_5gs_send_authentication_request(amf_ue);
16
+    ogs_expect(r == OGS_OK);
17
+    ogs_assert(r != OGS_ERROR);
18
 
19
     return OGS_OK;
20
 }
21
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/ngap-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/ngap-handler.c Changed
2856
 
1
@@ -100,7 +100,7 @@
2
 void ngap_handle_ng_setup_request(amf_gnb_t *gnb, ogs_ngap_message_t *message)
3
 {
4
     char bufOGS_ADDRSTRLEN;
5
-    int i, j, k;
6
+    int i, j, k, r;
7
 
8
     NGAP_InitiatingMessage_t *initiatingMessage = NULL;
9
     NGAP_NGSetupRequest_t *NGSetupRequest = NULL;
10
@@ -148,8 +148,9 @@
11
         ogs_error("No GlobalRANNodeID");
12
         group = NGAP_Cause_PR_protocol;
13
         cause = NGAP_CauseProtocol_semantic_error;
14
-        ogs_assert(OGS_OK ==
15
-            ngap_send_ng_setup_failure(gnb, group, cause));
16
+        r = ngap_send_ng_setup_failure(gnb, group, cause);
17
+        ogs_expect(r == OGS_OK);
18
+        ogs_assert(r != OGS_ERROR);
19
         return;
20
     }
21
 
22
@@ -158,8 +159,9 @@
23
         ogs_error("No globalGNB_ID");
24
         group = NGAP_Cause_PR_protocol;
25
         cause = NGAP_CauseProtocol_semantic_error;
26
-        ogs_assert(OGS_OK ==
27
-            ngap_send_ng_setup_failure(gnb, group, cause));
28
+        r = ngap_send_ng_setup_failure(gnb, group, cause);
29
+        ogs_expect(r == OGS_OK);
30
+        ogs_assert(r != OGS_ERROR);
31
         return;
32
     }
33
 
34
@@ -167,8 +169,9 @@
35
         ogs_error("No SupportedTAList");
36
         group = NGAP_Cause_PR_protocol;
37
         cause = NGAP_CauseProtocol_semantic_error;
38
-        ogs_assert(OGS_OK ==
39
-            ngap_send_ng_setup_failure(gnb, group, cause));
40
+        r = ngap_send_ng_setup_failure(gnb, group, cause);
41
+        ogs_expect(r == OGS_OK);
42
+        ogs_assert(r != OGS_ERROR);
43
         return;
44
     }
45
 
46
@@ -191,8 +194,9 @@
47
             ogs_error("No SupportedTAItem");
48
             group = NGAP_Cause_PR_protocol;
49
             cause = NGAP_CauseProtocol_semantic_error;
50
-            ogs_assert(OGS_OK ==
51
-                ngap_send_ng_setup_failure(gnb, group, cause));
52
+            r = ngap_send_ng_setup_failure(gnb, group, cause);
53
+            ogs_expect(r == OGS_OK);
54
+            ogs_assert(r != OGS_ERROR);
55
             return;
56
         }
57
 
58
@@ -216,8 +220,9 @@
59
                 ogs_error("No BroadcastPLMNItem");
60
                 group = NGAP_Cause_PR_protocol;
61
                 cause = NGAP_CauseProtocol_semantic_error;
62
-                ogs_assert(OGS_OK ==
63
-                    ngap_send_ng_setup_failure(gnb, group, cause));
64
+                r = ngap_send_ng_setup_failure(gnb, group, cause);
65
+                ogs_expect(r == OGS_OK);
66
+                ogs_assert(r != OGS_ERROR);
67
                 return;
68
             }
69
 
70
@@ -248,8 +253,9 @@
71
                     ogs_error("No SliceSupportItem");
72
                     group = NGAP_Cause_PR_protocol;
73
                     cause = NGAP_CauseProtocol_semantic_error;
74
-                    ogs_assert(OGS_OK ==
75
-                        ngap_send_ng_setup_failure(gnb, group, cause));
76
+                    r = ngap_send_ng_setup_failure(gnb, group, cause);
77
+                    ogs_expect(r == OGS_OK);
78
+                    ogs_assert(r != OGS_ERROR);
79
                     return;
80
                 }
81
 
82
@@ -285,8 +291,9 @@
83
         group = NGAP_Cause_PR_misc;
84
         cause = NGAP_CauseMisc_control_processing_overload;
85
 
86
-        ogs_assert(OGS_OK ==
87
-            ngap_send_ng_setup_failure(gnb, group, cause));
88
+        r = ngap_send_ng_setup_failure(gnb, group, cause);
89
+        ogs_expect(r == OGS_OK);
90
+        ogs_assert(r != OGS_ERROR);
91
         return;
92
     }
93
 
94
@@ -296,8 +303,9 @@
95
         group = NGAP_Cause_PR_protocol;
96
         cause = NGAP_CauseProtocol_message_not_compatible_with_receiver_state;
97
 
98
-        ogs_assert(OGS_OK ==
99
-            ngap_send_ng_setup_failure(gnb, group, cause));
100
+        r = ngap_send_ng_setup_failure(gnb, group, cause);
101
+        ogs_expect(r == OGS_OK);
102
+        ogs_assert(r != OGS_ERROR);
103
         return;
104
     }
105
 
106
@@ -307,8 +315,9 @@
107
         group = NGAP_Cause_PR_misc;
108
         cause = NGAP_CauseMisc_unknown_PLMN_or_SNPN;
109
 
110
-        ogs_assert(OGS_OK ==
111
-            ngap_send_ng_setup_failure(gnb, group, cause));
112
+        r = ngap_send_ng_setup_failure(gnb, group, cause);
113
+        ogs_expect(r == OGS_OK);
114
+        ogs_assert(r != OGS_ERROR);
115
         return;
116
     }
117
 
118
@@ -319,21 +328,23 @@
119
         group = NGAP_Cause_PR_radioNetwork;
120
         cause = NGAP_CauseRadioNetwork_slice_not_supported;
121
 
122
-        ogs_assert(OGS_OK ==
123
-            ngap_send_ng_setup_failure(gnb, group, cause));
124
+        r = ngap_send_ng_setup_failure(gnb, group, cause);
125
+        ogs_expect(r == OGS_OK);
126
+        ogs_assert(r != OGS_ERROR);
127
         return;
128
     }
129
 
130
     amf_gnb_set_gnb_id(gnb, gnb_id);
131
 
132
     gnb->state.ng_setup_success = true;
133
-    ogs_assert(OGS_OK ==
134
-        ngap_send_ng_setup_response(gnb));
135
+    r = ngap_send_ng_setup_response(gnb);
136
+    ogs_expect(r == OGS_OK);
137
+    ogs_assert(r != OGS_ERROR);
138
 }
139
 
140
 void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message)
141
 {
142
-    int i;
143
+    int i, r;
144
     char bufOGS_ADDRSTRLEN;
145
 
146
     ran_ue_t *ran_ue = NULL;
147
@@ -389,9 +400,10 @@
148
 
149
     if (!RAN_UE_NGAP_ID) {
150
         ogs_error("No RAN_UE_NGAP_ID");
151
-        ogs_assert(OGS_OK ==
152
-            ngap_send_error_indication(gnb, NULL, NULL,
153
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
154
+        r = ngap_send_error_indication(gnb, NULL, NULL,
155
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
156
+        ogs_expect(r == OGS_OK);
157
+        ogs_assert(r != OGS_ERROR);
158
         return;
159
     }
160
 
161
@@ -399,10 +411,11 @@
162
     if (!ran_ue) {
163
         ran_ue = ran_ue_add(gnb, *RAN_UE_NGAP_ID);
164
         if (ran_ue == NULL) {
165
-            ogs_assert(OGS_OK ==
166
-                ngap_send_error_indication(gnb, NULL, NULL,
167
+            r = ngap_send_error_indication(gnb, NULL, NULL,
168
                     NGAP_Cause_PR_misc,
169
-                    NGAP_CauseMisc_control_processing_overload));
170
+                    NGAP_CauseMisc_control_processing_overload);
171
+            ogs_expect(r == OGS_OK);
172
+            ogs_assert(r != OGS_ERROR);
173
             return;
174
         }
175
 
176
@@ -456,10 +469,12 @@
177
                     /* De-associate NG with NAS/EMM */
178
                     ran_ue_deassociate(amf_ue->ran_ue);
179
 
180
-                    ogs_assert(OGS_OK ==
181
-                        ngap_send_ran_ue_context_release_command(amf_ue->ran_ue,
182
+                    r = ngap_send_ran_ue_context_release_command(
183
+                            amf_ue->ran_ue,
184
                             NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
185
-                            NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
186
+                            NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
187
+                    ogs_expect(r == OGS_OK);
188
+                    ogs_assert(r != OGS_ERROR);
189
                 }
190
                 amf_ue_associate_ran_ue(amf_ue, ran_ue);
191
 
192
@@ -480,9 +495,10 @@
193
 
194
     if (!UserLocationInformation) {
195
         ogs_error("No UserLocationInformation");
196
-        ogs_assert(OGS_OK ==
197
-            ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
198
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
199
+        r = ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
200
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
201
+        ogs_expect(r == OGS_OK);
202
+        ogs_assert(r != OGS_ERROR);
203
         return;
204
     }
205
 
206
@@ -490,17 +506,19 @@
207
             NGAP_UserLocationInformation_PR_userLocationInformationNR) {
208
         ogs_error("Not implemented UserLocationInformation%d",
209
                 UserLocationInformation->present);
210
-        ogs_assert(OGS_OK ==
211
-            ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
212
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified));
213
+        r = ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
214
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified);
215
+        ogs_expect(r == OGS_OK);
216
+        ogs_assert(r != OGS_ERROR);
217
         return;
218
     }
219
 
220
     if (!NAS_PDU) {
221
         ogs_error("No NAS_PDU");
222
-        ogs_assert(OGS_OK ==
223
-            ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
224
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
225
+        r = ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
226
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
227
+        ogs_expect(r == OGS_OK);
228
+        ogs_assert(r != OGS_ERROR);
229
         return;
230
     }
231
 
232
@@ -523,14 +541,15 @@
233
         }
234
     }
235
 
236
-    ngap_send_to_nas(ran_ue, NGAP_ProcedureCode_id_InitialUEMessage, NAS_PDU);
237
+    ogs_expect(OGS_OK == ngap_send_to_nas(
238
+                ran_ue, NGAP_ProcedureCode_id_InitialUEMessage, NAS_PDU));
239
 }
240
 
241
 void ngap_handle_uplink_nas_transport(
242
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
243
 {
244
     char bufOGS_ADDRSTRLEN;
245
-    int i;
246
+    int i, r;
247
 
248
     amf_ue_t *amf_ue = NULL;
249
     ran_ue_t *ran_ue = NULL;
250
@@ -582,18 +601,20 @@
251
 
252
     if (!AMF_UE_NGAP_ID) {
253
         ogs_error("No AMF_UE_NGAP_ID");
254
-        ogs_assert(OGS_OK ==
255
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
256
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
257
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
258
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
259
+        ogs_expect(r == OGS_OK);
260
+        ogs_assert(r != OGS_ERROR);
261
         return;
262
     }
263
 
264
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
265
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
266
         ogs_error("Invalid AMF_UE_NGAP_ID");
267
-        ogs_assert(OGS_OK ==
268
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
269
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
270
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
271
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
272
+        ogs_expect(r == OGS_OK);
273
+        ogs_assert(r != OGS_ERROR);
274
         return;
275
     }
276
 
277
@@ -601,11 +622,12 @@
278
     if (!ran_ue) {
279
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
280
                 (long long)amf_ue_ngap_id);
281
-        ogs_assert(OGS_OK ==
282
-            ngap_send_error_indication(
283
+        r = ngap_send_error_indication(
284
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
285
                 NGAP_Cause_PR_radioNetwork,
286
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
287
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
288
+        ogs_expect(r == OGS_OK);
289
+        ogs_assert(r != OGS_ERROR);
290
         return;
291
     }
292
 
293
@@ -613,19 +635,21 @@
294
     if (!amf_ue) {
295
         ogs_error("Cannot find AMF-UE Context %lld",
296
                 (long long)amf_ue_ngap_id);
297
-        ogs_assert(OGS_OK ==
298
-            ngap_send_error_indication(
299
+        r = ngap_send_error_indication(
300
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
301
                 NGAP_Cause_PR_radioNetwork,
302
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
303
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
304
+        ogs_expect(r == OGS_OK);
305
+        ogs_assert(r != OGS_ERROR);
306
         return;
307
     }
308
 
309
     if (!UserLocationInformation) {
310
         ogs_error("No UserLocationInformation");
311
-        ogs_assert(OGS_OK ==
312
-            ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
313
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
314
+        r = ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
315
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
316
+        ogs_expect(r == OGS_OK);
317
+        ogs_assert(r != OGS_ERROR);
318
         return;
319
     }
320
 
321
@@ -633,18 +657,20 @@
322
             NGAP_UserLocationInformation_PR_userLocationInformationNR) {
323
         ogs_error("Not implemented UserLocationInformation%d",
324
                 UserLocationInformation->present);
325
-        ogs_assert(OGS_OK ==
326
-            ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
327
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified));
328
+        r = ngap_send_error_indication(gnb, &ran_ue->ran_ue_ngap_id, NULL,
329
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified);
330
+        ogs_expect(r == OGS_OK);
331
+        ogs_assert(r != OGS_ERROR);
332
         return;
333
     }
334
 
335
     if (!NAS_PDU) {
336
         ogs_error("No NAS_PDU");
337
-        ogs_assert(OGS_OK ==
338
-            ngap_send_error_indication(
339
+        r = ngap_send_error_indication(
340
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
341
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
342
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
343
+        ogs_expect(r == OGS_OK);
344
+        ogs_assert(r != OGS_ERROR);
345
         return;
346
     }
347
 
348
@@ -665,14 +691,15 @@
349
     memcpy(&amf_ue->nr_tai, &ran_ue->saved.nr_tai, sizeof(ogs_5gs_tai_t));
350
     memcpy(&amf_ue->nr_cgi, &ran_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t));
351
 
352
-    ngap_send_to_nas(ran_ue, NGAP_ProcedureCode_id_UplinkNASTransport, NAS_PDU);
353
+    ogs_expect(OGS_OK == ngap_send_to_nas(
354
+                ran_ue, NGAP_ProcedureCode_id_UplinkNASTransport, NAS_PDU));
355
 }
356
 
357
 void ngap_handle_ue_radio_capability_info_indication(
358
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
359
 {
360
     char bufOGS_ADDRSTRLEN;
361
-    int i;
362
+    int i, r;
363
 
364
     ran_ue_t *ran_ue = NULL;
365
     uint64_t amf_ue_ngap_id;
366
@@ -721,18 +748,20 @@
367
 
368
     if (!AMF_UE_NGAP_ID) {
369
         ogs_error("No AMF_UE_NGAP_ID");
370
-        ogs_assert(OGS_OK ==
371
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
372
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
373
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
374
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
375
+        ogs_expect(r == OGS_OK);
376
+        ogs_assert(r != OGS_ERROR);
377
         return;
378
     }
379
 
380
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
381
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
382
         ogs_error("Invalid AMF_UE_NGAP_ID");
383
-        ogs_assert(OGS_OK ==
384
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
385
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
386
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
387
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
388
+        ogs_expect(r == OGS_OK);
389
+        ogs_assert(r != OGS_ERROR);
390
         return;
391
     }
392
 
393
@@ -740,11 +769,12 @@
394
     if (!ran_ue) {
395
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
396
                 (long long)amf_ue_ngap_id);
397
-        ogs_assert(OGS_OK ==
398
-            ngap_send_error_indication(
399
+        r = ngap_send_error_indication(
400
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
401
                 NGAP_Cause_PR_radioNetwork,
402
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
403
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
404
+        ogs_expect(r == OGS_OK);
405
+        ogs_assert(r != OGS_ERROR);
406
         return;
407
     }
408
 
409
@@ -753,10 +783,11 @@
410
 
411
     if (!UERadioCapability) {
412
         ogs_error("No UERadioCapability");
413
-        ogs_assert(OGS_OK ==
414
-            ngap_send_error_indication(
415
+        r = ngap_send_error_indication(
416
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
417
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
418
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
419
+        ogs_expect(r == OGS_OK);
420
+        ogs_assert(r != OGS_ERROR);
421
         return;
422
     }
423
 
424
@@ -769,7 +800,7 @@
425
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
426
 {
427
     char bufOGS_ADDRSTRLEN;
428
-    int i;
429
+    int i, r;
430
 
431
     amf_ue_t *amf_ue = NULL;
432
     ran_ue_t *ran_ue = NULL;
433
@@ -822,18 +853,20 @@
434
 
435
     if (!AMF_UE_NGAP_ID) {
436
         ogs_error("No AMF_UE_NGAP_ID");
437
-        ogs_assert(OGS_OK ==
438
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
439
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
440
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
441
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
442
+        ogs_expect(r == OGS_OK);
443
+        ogs_assert(r != OGS_ERROR);
444
         return;
445
     }
446
 
447
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
448
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
449
         ogs_error("Invalid AMF_UE_NGAP_ID");
450
-        ogs_assert(OGS_OK ==
451
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
452
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
453
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
454
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
455
+        ogs_expect(r == OGS_OK);
456
+        ogs_assert(r != OGS_ERROR);
457
         return;
458
     }
459
 
460
@@ -841,11 +874,12 @@
461
     if (!ran_ue) {
462
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
463
                 (long long)amf_ue_ngap_id);
464
-        ogs_assert(OGS_OK ==
465
-            ngap_send_error_indication(
466
+        r = ngap_send_error_indication(
467
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
468
                 NGAP_Cause_PR_radioNetwork,
469
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
470
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
471
+        ogs_expect(r == OGS_OK);
472
+        ogs_assert(r != OGS_ERROR);
473
         return;
474
     }
475
 
476
@@ -856,11 +890,12 @@
477
     if (!amf_ue) {
478
         ogs_error("Cannot find AMF-UE Context %lld",
479
                 (long long)amf_ue_ngap_id);
480
-        ogs_assert(OGS_OK ==
481
-            ngap_send_error_indication(
482
+        r = ngap_send_error_indication(
483
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
484
                 NGAP_Cause_PR_radioNetwork,
485
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
486
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
487
+        ogs_expect(r == OGS_OK);
488
+        ogs_assert(r != OGS_ERROR);
489
         return;
490
     }
491
 
492
@@ -870,27 +905,30 @@
493
 
494
         if (!PDUSessionItem) {
495
             ogs_error("No PDUSessionResourceSetupItemCxtRes");
496
-            ogs_assert(OGS_OK ==
497
-                ngap_send_error_indication2(amf_ue,
498
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
499
+            r = ngap_send_error_indication2(amf_ue,
500
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
501
+            ogs_expect(r == OGS_OK);
502
+            ogs_assert(r != OGS_ERROR);
503
             return;
504
         }
505
 
506
         transfer = &PDUSessionItem->pDUSessionResourceSetupResponseTransfer;
507
         if (!transfer) {
508
             ogs_error("No PDUSessionResourceSetupResponseTransfer");
509
-            ogs_assert(OGS_OK ==
510
-                ngap_send_error_indication2(amf_ue,
511
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
512
+            r = ngap_send_error_indication2(amf_ue,
513
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
514
+            ogs_expect(r == OGS_OK);
515
+            ogs_assert(r != OGS_ERROR);
516
             return;
517
         }
518
 
519
         if (PDUSessionItem->pDUSessionID ==
520
                 OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
521
             ogs_error("PDU Session Identity is unassigned");
522
-            ogs_assert(OGS_OK ==
523
-                ngap_send_error_indication2(amf_ue,
524
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
525
+            r = ngap_send_error_indication2(amf_ue,
526
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
527
+            ogs_expect(r == OGS_OK);
528
+            ogs_assert(r != OGS_ERROR);
529
             return;
530
         }
531
 
532
@@ -898,20 +936,22 @@
533
         if (!sess) {
534
             ogs_error("Cannot find PDU Session ID %d",
535
                     (int)PDUSessionItem->pDUSessionID);
536
-            ogs_assert(OGS_OK ==
537
-                ngap_send_error_indication2(amf_ue,
538
+            r = ngap_send_error_indication2(amf_ue,
539
                     NGAP_Cause_PR_radioNetwork,
540
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
541
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
542
+            ogs_expect(r == OGS_OK);
543
+            ogs_assert(r != OGS_ERROR);
544
             return;
545
         }
546
 
547
         if (!SESSION_CONTEXT_IN_SMF(sess)) {
548
             ogs_error("Session Context is not in SMF %d",
549
                     (int)PDUSessionItem->pDUSessionID);
550
-            ogs_assert(OGS_OK ==
551
-                ngap_send_error_indication2(amf_ue,
552
+            r = ngap_send_error_indication2(amf_ue,
553
                     NGAP_Cause_PR_radioNetwork,
554
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
555
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
556
+            ogs_expect(r == OGS_OK);
557
+            ogs_assert(r != OGS_ERROR);
558
             return;
559
         }
560
 
561
@@ -963,9 +1003,10 @@
562
 
563
             switch (sess->gsm_message.type) {
564
             case OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND:
565
-                ogs_expect(OGS_OK ==
566
-                        nas_send_pdu_session_modification_command(sess,
567
-                            sess->gsm_message.n1buf, sess->gsm_message.n2buf));
568
+                r = nas_send_pdu_session_modification_command(sess,
569
+                            sess->gsm_message.n1buf, sess->gsm_message.n2buf);
570
+                ogs_expect(r == OGS_OK);
571
+                ogs_assert(r != OGS_ERROR);
572
 
573
                 /* n1buf is de-allocated
574
                  * in gmm_build_dl_nas_transport() */
575
@@ -1012,8 +1053,9 @@
576
         memset(&param, 0, sizeof(param));
577
         param.acknowledgement_requested = 1;
578
         param.guti = 1;
579
-        ogs_assert(OGS_OK ==
580
-            nas_5gs_send_configuration_update_command(amf_ue, &param));
581
+        r = nas_5gs_send_configuration_update_command(amf_ue, &param);
582
+        ogs_expect(r == OGS_OK);
583
+        ogs_assert(r != OGS_ERROR);
584
 
585
         AMF_UE_CLEAR_PAGING_INFO(amf_ue);
586
     }
587
@@ -1023,7 +1065,7 @@
588
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
589
 {
590
     char bufOGS_ADDRSTRLEN;
591
-    int i, old_xact_count = 0, new_xact_count = 0;
592
+    int i, r, old_xact_count = 0, new_xact_count = 0;
593
 
594
     ran_ue_t *ran_ue = NULL;
595
     amf_ue_t *amf_ue = NULL;
596
@@ -1071,18 +1113,20 @@
597
 
598
     if (!AMF_UE_NGAP_ID) {
599
         ogs_error("No AMF_UE_NGAP_ID");
600
-        ogs_assert(OGS_OK ==
601
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
602
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
603
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
604
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
605
+        ogs_expect(r == OGS_OK);
606
+        ogs_assert(r != OGS_ERROR);
607
         return;
608
     }
609
 
610
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
611
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
612
         ogs_error("Invalid AMF_UE_NGAP_ID");
613
-        ogs_assert(OGS_OK ==
614
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
615
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
616
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
617
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
618
+        ogs_expect(r == OGS_OK);
619
+        ogs_assert(r != OGS_ERROR);
620
         return;
621
     }
622
 
623
@@ -1090,11 +1134,12 @@
624
     if (!ran_ue) {
625
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
626
                 (long long)amf_ue_ngap_id);
627
-        ogs_assert(OGS_OK ==
628
-            ngap_send_error_indication(
629
+        r = ngap_send_error_indication(
630
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
631
                 NGAP_Cause_PR_radioNetwork,
632
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
633
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
634
+        ogs_expect(r == OGS_OK);
635
+        ogs_assert(r != OGS_ERROR);
636
         return;
637
     }
638
 
639
@@ -1103,10 +1148,11 @@
640
 
641
     if (!Cause) {
642
         ogs_error("No Cause");
643
-        ogs_assert(OGS_OK ==
644
-            ngap_send_error_indication(
645
+        r = ngap_send_error_indication(
646
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
647
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
648
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
649
+        ogs_expect(r == OGS_OK);
650
+        ogs_assert(r != OGS_ERROR);
651
         return;
652
     }
653
     ogs_debug("    CauseGroup:%d Cause:%d",
654
@@ -1143,10 +1189,11 @@
655
     }
656
 
657
     if (old_xact_count == new_xact_count) {
658
-        ogs_assert(OGS_OK ==
659
-            ngap_send_ran_ue_context_release_command(ran_ue,
660
+        r = ngap_send_ran_ue_context_release_command(ran_ue,
661
                 NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
662
-                NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
663
+                NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
664
+        ogs_expect(r == OGS_OK);
665
+        ogs_assert(r != OGS_ERROR);
666
     }
667
 }
668
 
669
@@ -1307,7 +1354,7 @@
670
 void ngap_handle_ue_context_release_request(
671
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
672
 {
673
-    int i;
674
+    int i, r;
675
     char bufOGS_ADDRSTRLEN;
676
     uint64_t amf_ue_ngap_id;
677
 
678
@@ -1362,18 +1409,20 @@
679
 
680
     if (!AMF_UE_NGAP_ID) {
681
         ogs_error("No AMF_UE_NGAP_ID");
682
-        ogs_assert(OGS_OK ==
683
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
684
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
685
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
686
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
687
+        ogs_expect(r == OGS_OK);
688
+        ogs_assert(r != OGS_ERROR);
689
         return;
690
     }
691
 
692
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
693
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
694
         ogs_error("Invalid AMF_UE_NGAP_ID");
695
-        ogs_assert(OGS_OK ==
696
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
697
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
698
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
699
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
700
+        ogs_expect(r == OGS_OK);
701
+        ogs_assert(r != OGS_ERROR);
702
         return;
703
     }
704
 
705
@@ -1381,11 +1430,12 @@
706
     if (!ran_ue) {
707
         ogs_warn("No RAN UE Context : AMF_UE_NGAP_ID%lld",
708
                 (long long)amf_ue_ngap_id);
709
-        ogs_assert(OGS_OK ==
710
-            ngap_send_error_indication(
711
+        r = ngap_send_error_indication(
712
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
713
                 NGAP_Cause_PR_radioNetwork,
714
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
715
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
716
+        ogs_expect(r == OGS_OK);
717
+        ogs_assert(r != OGS_ERROR);
718
         return;
719
     }
720
 
721
@@ -1394,10 +1444,11 @@
722
 
723
     if (!Cause) {
724
         ogs_error("No Cause");
725
-        ogs_assert(OGS_OK ==
726
-            ngap_send_error_indication(
727
+        r = ngap_send_error_indication(
728
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
729
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
730
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
731
+        ogs_expect(r == OGS_OK);
732
+        ogs_assert(r != OGS_ERROR);
733
         return;
734
     }
735
 
736
@@ -1422,10 +1473,11 @@
737
     if (!amf_ue) {
738
         ogs_error("Cannot find AMF-UE Context %lld",
739
                 (long long)amf_ue_ngap_id);
740
-        ogs_assert(OGS_OK ==
741
-            ngap_send_ran_ue_context_release_command(ran_ue,
742
+        r = ngap_send_ran_ue_context_release_command(ran_ue,
743
                 Cause->present, (int)Cause->choice.radioNetwork,
744
-                NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
745
+                NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
746
+        ogs_expect(r == OGS_OK);
747
+        ogs_assert(r != OGS_ERROR);
748
     } else {
749
         int xact_count = amf_sess_xact_count(amf_ue);
750
 
751
@@ -1443,20 +1495,22 @@
752
 
753
                 if (!PDUSessionItem) {
754
                     ogs_error("No PDUSessionResourceSetupItemSURes");
755
-                    ogs_assert(OGS_OK ==
756
-                        ngap_send_error_indication2(
757
+                    r = ngap_send_error_indication2(
758
                             amf_ue, NGAP_Cause_PR_protocol,
759
-                            NGAP_CauseProtocol_semantic_error));
760
+                            NGAP_CauseProtocol_semantic_error);
761
+                    ogs_expect(r == OGS_OK);
762
+                    ogs_assert(r != OGS_ERROR);
763
                     return;
764
                 }
765
 
766
                 if (PDUSessionItem->pDUSessionID ==
767
                         OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
768
                     ogs_error("PDU Session Identity is unassigned");
769
-                    ogs_assert(OGS_OK ==
770
-                        ngap_send_error_indication2(
771
+                    r = ngap_send_error_indication2(
772
                             amf_ue, NGAP_Cause_PR_protocol,
773
-                            NGAP_CauseProtocol_semantic_error));
774
+                            NGAP_CauseProtocol_semantic_error);
775
+                    ogs_expect(r == OGS_OK);
776
+                    ogs_assert(r != OGS_ERROR);
777
                     return;
778
                 }
779
 
780
@@ -1469,19 +1523,21 @@
781
                 }
782
             }
783
         }
784
-
785
-        if (amf_sess_xact_count(amf_ue) == xact_count)
786
-            ogs_assert(OGS_OK ==
787
-                ngap_send_amf_ue_context_release_command(amf_ue,
788
+ 
789
+        if (amf_sess_xact_count(amf_ue) == xact_count) {
790
+            r = ngap_send_amf_ue_context_release_command(amf_ue,
791
                     Cause->present, (int)Cause->choice.radioNetwork,
792
-                    NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0));
793
+                    NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0);
794
+            ogs_expect(r == OGS_OK);
795
+            ogs_assert(r != OGS_ERROR);
796
+        }
797
     }
798
 }
799
 
800
 void ngap_handle_ue_context_release_complete(
801
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
802
 {
803
-    int i;
804
+    int i, r;
805
     char bufOGS_ADDRSTRLEN;
806
     uint64_t amf_ue_ngap_id;
807
 
808
@@ -1525,18 +1581,20 @@
809
 
810
     if (!AMF_UE_NGAP_ID) {
811
         ogs_error("No AMF_UE_NGAP_ID");
812
-        ogs_assert(OGS_OK ==
813
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
814
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
815
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
816
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
817
+        ogs_expect(r == OGS_OK);
818
+        ogs_assert(r != OGS_ERROR);
819
         return;
820
     }
821
 
822
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
823
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
824
         ogs_error("Invalid AMF_UE_NGAP_ID");
825
-        ogs_assert(OGS_OK ==
826
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
827
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
828
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
829
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
830
+        ogs_expect(r == OGS_OK);
831
+        ogs_assert(r != OGS_ERROR);
832
         return;
833
     }
834
 
835
@@ -1544,11 +1602,12 @@
836
     if (!ran_ue) {
837
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
838
                 (long long)amf_ue_ngap_id);
839
-        ogs_assert(OGS_OK ==
840
-            ngap_send_error_indication(
841
+        r = ngap_send_error_indication(
842
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
843
                 NGAP_Cause_PR_radioNetwork,
844
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
845
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
846
+        ogs_expect(r == OGS_OK);
847
+        ogs_assert(r != OGS_ERROR);
848
         return;
849
     }
850
 
851
@@ -1557,6 +1616,7 @@
852
 
853
 void ngap_handle_ue_context_release_action(ran_ue_t *ran_ue)
854
 {
855
+    int r;
856
     amf_ue_t *amf_ue = NULL;
857
 
858
     ogs_assert(ran_ue);
859
@@ -1619,13 +1679,19 @@
860
     case NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK:
861
         ogs_debug("    Action: NG normal release");
862
         ran_ue_remove(ran_ue);
863
-        ogs_expect_or_return(amf_ue);
864
+        if (!amf_ue) {
865
+            ogs_error("No UE(amf-ue) Context");
866
+            return;
867
+        }
868
         amf_ue_deassociate(amf_ue);
869
         break;
870
     case NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE:
871
         ogs_debug("    Action: UE context remove");
872
         ran_ue_remove(ran_ue);
873
-        ogs_expect_or_return(amf_ue);
874
+        if (!amf_ue) {
875
+            ogs_error("No UE(amf-ue) context");
876
+            return;
877
+        }
878
         amf_ue_remove(amf_ue);
879
         break;
880
     case NGAP_UE_CTX_REL_NG_HANDOVER_COMPLETE:
881
@@ -1634,7 +1700,10 @@
882
         source_ue_deassociate_target_ue(ran_ue);
883
         ran_ue_remove(ran_ue);
884
 
885
-        ogs_expect_or_return(amf_ue);
886
+        if (!amf_ue) {
887
+            ogs_error("No UE(amf-ue) context");
888
+            return;
889
+        }
890
         break;
891
     case NGAP_UE_CTX_REL_NG_HANDOVER_CANCEL:
892
         ogs_warn("    Action: NG handover cancel");
893
@@ -1642,11 +1711,18 @@
894
         source_ue_deassociate_target_ue(ran_ue);
895
         ran_ue_remove(ran_ue);
896
 
897
-        ogs_expect_or_return(amf_ue);
898
-        ogs_expect_or_return(amf_ue->ran_ue);
899
+        if (!amf_ue) {
900
+            ogs_error("No UE(amf-ue) context");
901
+            return;
902
+        }
903
+        if (!amf_ue->ran_ue) {
904
+            ogs_error("No NG context");
905
+            return;
906
+        }
907
 
908
-        ogs_assert(OGS_OK ==
909
-            ngap_send_handover_cancel_ack(amf_ue->ran_ue));
910
+        r = ngap_send_handover_cancel_ack(amf_ue->ran_ue);
911
+        ogs_expect(r == OGS_OK);
912
+        ogs_assert(r != OGS_ERROR);
913
         break;
914
     case NGAP_UE_CTX_REL_NG_HANDOVER_FAILURE:
915
         ogs_warn("    Action: NG handover failure");
916
@@ -1654,7 +1730,10 @@
917
         source_ue_deassociate_target_ue(ran_ue);
918
         ran_ue_remove(ran_ue);
919
 
920
-        ogs_expect_or_return(amf_ue);
921
+        if (!amf_ue) {
922
+            ogs_error("No UE(amf-ue) context");
923
+            return;
924
+        }
925
         break;
926
     default:
927
         ogs_error("Invalid Action%d", ran_ue->ue_ctx_rel_action);
928
@@ -1666,7 +1745,7 @@
929
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
930
 {
931
     char bufOGS_ADDRSTRLEN;
932
-    int i;
933
+    int i, r;
934
 
935
     amf_ue_t *amf_ue = NULL;
936
     ran_ue_t *ran_ue = NULL;
937
@@ -1727,18 +1806,20 @@
938
 
939
     if (!AMF_UE_NGAP_ID) {
940
         ogs_error("No AMF_UE_NGAP_ID");
941
-        ogs_assert(OGS_OK ==
942
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
943
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
944
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
945
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
946
+        ogs_expect(r == OGS_OK);
947
+        ogs_assert(r != OGS_ERROR);
948
         return;
949
     }
950
 
951
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
952
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
953
         ogs_error("Invalid AMF_UE_NGAP_ID");
954
-        ogs_assert(OGS_OK ==
955
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
956
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
957
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
958
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
959
+        ogs_expect(r == OGS_OK);
960
+        ogs_assert(r != OGS_ERROR);
961
         return;
962
     }
963
 
964
@@ -1746,11 +1827,12 @@
965
     if (!ran_ue) {
966
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
967
                 (long long)amf_ue_ngap_id);
968
-        ogs_assert(OGS_OK ==
969
-            ngap_send_error_indication(
970
+        r = ngap_send_error_indication(
971
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
972
                 NGAP_Cause_PR_radioNetwork,
973
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
974
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
975
+        ogs_expect(r == OGS_OK);
976
+        ogs_assert(r != OGS_ERROR);
977
         return;
978
     }
979
 
980
@@ -1761,11 +1843,12 @@
981
     if (!amf_ue) {
982
         ogs_error("Cannot find AMF-UE Context %lld",
983
                 (long long)amf_ue_ngap_id);
984
-        ogs_assert(OGS_OK ==
985
-            ngap_send_error_indication(
986
+        r = ngap_send_error_indication(
987
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
988
                 NGAP_Cause_PR_radioNetwork,
989
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
990
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
991
+        ogs_expect(r == OGS_OK);
992
+        ogs_assert(r != OGS_ERROR);
993
         return;
994
     }
995
 
996
@@ -1777,33 +1860,36 @@
997
 
998
             if (!PDUSessionItem) {
999
                 ogs_error("No PDUSessionResourceSetupItemSURes");
1000
-                ogs_assert(OGS_OK ==
1001
-                    ngap_send_error_indication2(
1002
+                r = ngap_send_error_indication2(
1003
                         amf_ue,
1004
                         NGAP_Cause_PR_protocol,
1005
-                        NGAP_CauseProtocol_semantic_error));
1006
+                        NGAP_CauseProtocol_semantic_error);
1007
+                ogs_expect(r == OGS_OK);
1008
+                ogs_assert(r != OGS_ERROR);
1009
                 return;
1010
             }
1011
 
1012
             transfer = &PDUSessionItem->pDUSessionResourceSetupResponseTransfer;
1013
             if (!transfer) {
1014
                 ogs_error("No PDUSessionResourceSetupResponseTransfer");
1015
-                ogs_assert(OGS_OK ==
1016
-                    ngap_send_error_indication2(
1017
+                r = ngap_send_error_indication2(
1018
                         amf_ue,
1019
                         NGAP_Cause_PR_protocol,
1020
-                        NGAP_CauseProtocol_semantic_error));
1021
+                        NGAP_CauseProtocol_semantic_error);
1022
+                ogs_expect(r == OGS_OK);
1023
+                ogs_assert(r != OGS_ERROR);
1024
                 return;
1025
             }
1026
 
1027
             if (PDUSessionItem->pDUSessionID ==
1028
                     OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
1029
                 ogs_error("PDU Session Identity is unassigned");
1030
-                ogs_assert(OGS_OK ==
1031
-                    ngap_send_error_indication2(
1032
+                r = ngap_send_error_indication2(
1033
                         amf_ue,
1034
                         NGAP_Cause_PR_protocol,
1035
-                        NGAP_CauseProtocol_semantic_error));
1036
+                        NGAP_CauseProtocol_semantic_error);
1037
+                ogs_expect(r == OGS_OK);
1038
+                ogs_assert(r != OGS_ERROR);
1039
                 return;
1040
             }
1041
 
1042
@@ -1811,20 +1897,22 @@
1043
             if (!sess) {
1044
                 ogs_error("Cannot find PDU Session ID %d",
1045
                         (int)PDUSessionItem->pDUSessionID);
1046
-                ogs_assert(OGS_OK ==
1047
-                    ngap_send_error_indication2(amf_ue,
1048
+                r = ngap_send_error_indication2(amf_ue,
1049
                         NGAP_Cause_PR_radioNetwork,
1050
-                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1051
+                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1052
+                ogs_expect(r == OGS_OK);
1053
+                ogs_assert(r != OGS_ERROR);
1054
                 return;
1055
             }
1056
 
1057
             if (!SESSION_CONTEXT_IN_SMF(sess)) {
1058
                 ogs_error("Session Context is not in SMF %d",
1059
                         (int)PDUSessionItem->pDUSessionID);
1060
-                ogs_assert(OGS_OK ==
1061
-                    ngap_send_error_indication2(amf_ue,
1062
+                r = ngap_send_error_indication2(amf_ue,
1063
                         NGAP_Cause_PR_radioNetwork,
1064
-                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1065
+                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1066
+                ogs_expect(r == OGS_OK);
1067
+                ogs_assert(r != OGS_ERROR);
1068
                 return;
1069
             }
1070
 
1071
@@ -1856,11 +1944,12 @@
1072
 
1073
             if (!PDUSessionFailedItem) {
1074
                 ogs_error("No PDUSessionResourceFailedToSetupItemSURes");
1075
-                ogs_assert(OGS_OK ==
1076
-                    ngap_send_error_indication2(
1077
+                r = ngap_send_error_indication2(
1078
                         amf_ue,
1079
                         NGAP_Cause_PR_protocol,
1080
-                        NGAP_CauseProtocol_semantic_error));
1081
+                        NGAP_CauseProtocol_semantic_error);
1082
+                ogs_expect(r == OGS_OK);
1083
+                ogs_assert(r != OGS_ERROR);
1084
                 return;
1085
             }
1086
 
1087
@@ -1869,22 +1958,24 @@
1088
                     pDUSessionResourceSetupUnsuccessfulTransfer;
1089
             if (!transfer) {
1090
                 ogs_error("No PDUSessionResourceSetupUnsuccessfulTransfer");
1091
-                ogs_assert(OGS_OK ==
1092
-                    ngap_send_error_indication2(
1093
+                r = ngap_send_error_indication2(
1094
                         amf_ue,
1095
                         NGAP_Cause_PR_protocol,
1096
-                        NGAP_CauseProtocol_semantic_error));
1097
+                        NGAP_CauseProtocol_semantic_error);
1098
+                ogs_expect(r == OGS_OK);
1099
+                ogs_assert(r != OGS_ERROR);
1100
                 return;
1101
             }
1102
 
1103
             if (PDUSessionFailedItem->pDUSessionID ==
1104
                     OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
1105
                 ogs_error("PDU Session Identity is unassigned");
1106
-                ogs_assert(OGS_OK ==
1107
-                    ngap_send_error_indication2(
1108
+                r = ngap_send_error_indication2(
1109
                         amf_ue,
1110
                         NGAP_Cause_PR_protocol,
1111
-                        NGAP_CauseProtocol_semantic_error));
1112
+                        NGAP_CauseProtocol_semantic_error);
1113
+                ogs_expect(r == OGS_OK);
1114
+                ogs_assert(r != OGS_ERROR);
1115
                 return;
1116
             }
1117
 
1118
@@ -1893,21 +1984,23 @@
1119
             if (!sess) {
1120
                 ogs_error("Cannot find PDU Session ID %d",
1121
                         (int)PDUSessionFailedItem->pDUSessionID);
1122
-                ogs_assert(OGS_OK ==
1123
-                    ngap_send_error_indication2(
1124
+                r = ngap_send_error_indication2(
1125
                         amf_ue,
1126
                         NGAP_Cause_PR_radioNetwork,
1127
-                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1128
+                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1129
+                ogs_expect(r == OGS_OK);
1130
+                ogs_assert(r != OGS_ERROR);
1131
                 return;
1132
             }
1133
 
1134
             if (!SESSION_CONTEXT_IN_SMF(sess)) {
1135
                 ogs_error("Session Context is not in SMF %d",
1136
                         (int)PDUSessionFailedItem->pDUSessionID);
1137
-                ogs_assert(OGS_OK ==
1138
-                    ngap_send_error_indication2(amf_ue,
1139
+                r = ngap_send_error_indication2(amf_ue,
1140
                         NGAP_Cause_PR_radioNetwork,
1141
-                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1142
+                        NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1143
+                ogs_expect(r == OGS_OK);
1144
+                ogs_assert(r != OGS_ERROR);
1145
                 return;
1146
             }
1147
 
1148
@@ -1969,9 +2062,10 @@
1149
         }
1150
     } else {
1151
         ogs_error("No PDUSessionResourceList");
1152
-        ogs_assert(OGS_OK ==
1153
-            ngap_send_error_indication2(amf_ue,
1154
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1155
+        r = ngap_send_error_indication2(amf_ue,
1156
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1157
+        ogs_expect(r == OGS_OK);
1158
+        ogs_assert(r != OGS_ERROR);
1159
     }
1160
 }
1161
 
1162
@@ -1979,7 +2073,7 @@
1163
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
1164
 {
1165
     char bufOGS_ADDRSTRLEN;
1166
-    int i;
1167
+    int i, r;
1168
 
1169
     amf_ue_t *amf_ue = NULL;
1170
     ran_ue_t *ran_ue = NULL;
1171
@@ -2032,18 +2126,20 @@
1172
 
1173
     if (!AMF_UE_NGAP_ID) {
1174
         ogs_error("No AMF_UE_NGAP_ID");
1175
-        ogs_assert(OGS_OK ==
1176
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1177
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1178
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1179
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1180
+        ogs_expect(r == OGS_OK);
1181
+        ogs_assert(r != OGS_ERROR);
1182
         return;
1183
     }
1184
 
1185
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
1186
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
1187
         ogs_error("Invalid AMF_UE_NGAP_ID");
1188
-        ogs_assert(OGS_OK ==
1189
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1190
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1191
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1192
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1193
+        ogs_expect(r == OGS_OK);
1194
+        ogs_assert(r != OGS_ERROR);
1195
         return;
1196
     }
1197
 
1198
@@ -2051,11 +2147,12 @@
1199
     if (!ran_ue) {
1200
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
1201
                 (long long)amf_ue_ngap_id);
1202
-        ogs_assert(OGS_OK ==
1203
-            ngap_send_error_indication(
1204
+        r = ngap_send_error_indication(
1205
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
1206
                 NGAP_Cause_PR_radioNetwork,
1207
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1208
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1209
+        ogs_expect(r == OGS_OK);
1210
+        ogs_assert(r != OGS_ERROR);
1211
         return;
1212
     }
1213
 
1214
@@ -2066,19 +2163,21 @@
1215
     if (!amf_ue) {
1216
         ogs_error("Cannot find AMF-UE Context %lld",
1217
                 (long long)amf_ue_ngap_id);
1218
-        ogs_assert(OGS_OK ==
1219
-            ngap_send_error_indication(
1220
+        r = ngap_send_error_indication(
1221
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
1222
                 NGAP_Cause_PR_radioNetwork,
1223
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1224
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1225
+        ogs_expect(r == OGS_OK);
1226
+        ogs_assert(r != OGS_ERROR);
1227
         return;
1228
     }
1229
 
1230
     if (!PDUSessionList) {
1231
         ogs_error("No PDUSessionResourceModifyListModRes");
1232
-        ogs_assert(OGS_OK ==
1233
-            ngap_send_error_indication2(amf_ue,
1234
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1235
+        r = ngap_send_error_indication2(amf_ue,
1236
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1237
+        ogs_expect(r == OGS_OK);
1238
+        ogs_assert(r != OGS_ERROR);
1239
         return;
1240
     }
1241
 
1242
@@ -2089,27 +2188,30 @@
1243
 
1244
         if (!PDUSessionItem) {
1245
             ogs_error("No PDUSessionResourceModifyItemModRes");
1246
-            ogs_assert(OGS_OK ==
1247
-                ngap_send_error_indication2(amf_ue,
1248
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1249
+            r = ngap_send_error_indication2(amf_ue,
1250
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1251
+            ogs_expect(r == OGS_OK);
1252
+            ogs_assert(r != OGS_ERROR);
1253
             return;
1254
         }
1255
 
1256
         transfer = &PDUSessionItem->pDUSessionResourceModifyResponseTransfer;
1257
         if (!transfer) {
1258
             ogs_error("No PDUSessionResourceModifyResponseTransfer");
1259
-            ogs_assert(OGS_OK ==
1260
-                ngap_send_error_indication2(amf_ue,
1261
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1262
+            r = ngap_send_error_indication2(amf_ue,
1263
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1264
+            ogs_expect(r == OGS_OK);
1265
+            ogs_assert(r != OGS_ERROR);
1266
             return;
1267
         }
1268
 
1269
         if (PDUSessionItem->pDUSessionID ==
1270
                 OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
1271
             ogs_error("PDU Session Identity is unassigned");
1272
-            ogs_assert(OGS_OK ==
1273
-                ngap_send_error_indication2(amf_ue,
1274
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1275
+            r = ngap_send_error_indication2(amf_ue,
1276
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1277
+            ogs_expect(r == OGS_OK);
1278
+            ogs_assert(r != OGS_ERROR);
1279
             return;
1280
         }
1281
 
1282
@@ -2117,20 +2219,22 @@
1283
         if (!sess) {
1284
             ogs_error("Cannot find PDU Session ID %d",
1285
                     (int)PDUSessionItem->pDUSessionID);
1286
-            ogs_assert(OGS_OK ==
1287
-                ngap_send_error_indication2(amf_ue,
1288
+            r = ngap_send_error_indication2(amf_ue,
1289
                     NGAP_Cause_PR_radioNetwork,
1290
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1291
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1292
+            ogs_expect(r == OGS_OK);
1293
+            ogs_assert(r != OGS_ERROR);
1294
             return;
1295
         }
1296
 
1297
         if (!SESSION_CONTEXT_IN_SMF(sess)) {
1298
             ogs_error("Session Context is not in SMF %d",
1299
                     (int)PDUSessionItem->pDUSessionID);
1300
-            ogs_assert(OGS_OK ==
1301
-                ngap_send_error_indication2(amf_ue,
1302
+            r = ngap_send_error_indication2(amf_ue,
1303
                     NGAP_Cause_PR_radioNetwork,
1304
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1305
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1306
+            ogs_expect(r == OGS_OK);
1307
+            ogs_assert(r != OGS_ERROR);
1308
             return;
1309
         }
1310
 
1311
@@ -2154,7 +2258,7 @@
1312
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
1313
 {
1314
     char bufOGS_ADDRSTRLEN;
1315
-    int i;
1316
+    int i, r;
1317
 
1318
     amf_ue_t *amf_ue = NULL;
1319
     ran_ue_t *ran_ue = NULL;
1320
@@ -2208,18 +2312,20 @@
1321
 
1322
     if (!AMF_UE_NGAP_ID) {
1323
         ogs_error("No AMF_UE_NGAP_ID");
1324
-        ogs_assert(OGS_OK ==
1325
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1326
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1327
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1328
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1329
+        ogs_expect(r == OGS_OK);
1330
+        ogs_assert(r != OGS_ERROR);
1331
         return;
1332
     }
1333
 
1334
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
1335
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
1336
         ogs_error("Invalid AMF_UE_NGAP_ID");
1337
-        ogs_assert(OGS_OK ==
1338
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1339
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1340
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1341
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1342
+        ogs_expect(r == OGS_OK);
1343
+        ogs_assert(r != OGS_ERROR);
1344
         return;
1345
     }
1346
 
1347
@@ -2227,11 +2333,12 @@
1348
     if (!ran_ue) {
1349
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
1350
                 (long long)amf_ue_ngap_id);
1351
-        ogs_assert(OGS_OK ==
1352
-            ngap_send_error_indication(
1353
+        r = ngap_send_error_indication(
1354
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
1355
                 NGAP_Cause_PR_radioNetwork,
1356
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1357
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1358
+        ogs_expect(r == OGS_OK);
1359
+        ogs_assert(r != OGS_ERROR);
1360
         return;
1361
     }
1362
 
1363
@@ -2242,19 +2349,21 @@
1364
     if (!amf_ue) {
1365
         ogs_error("Cannot find AMF-UE Context %lld",
1366
                 (long long)amf_ue_ngap_id);
1367
-        ogs_assert(OGS_OK ==
1368
-            ngap_send_error_indication(
1369
+        r = ngap_send_error_indication(
1370
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
1371
                 NGAP_Cause_PR_radioNetwork,
1372
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1373
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1374
+        ogs_expect(r == OGS_OK);
1375
+        ogs_assert(r != OGS_ERROR);
1376
         return;
1377
     }
1378
 
1379
     if (!PDUSessionList) {
1380
         ogs_error("No PDUSessionResourceReleasedListRelRes");
1381
-        ogs_assert(OGS_OK ==
1382
-            ngap_send_error_indication2(amf_ue,
1383
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1384
+        r = ngap_send_error_indication2(amf_ue,
1385
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1386
+        ogs_expect(r == OGS_OK);
1387
+        ogs_assert(r != OGS_ERROR);
1388
         return;
1389
     }
1390
 
1391
@@ -2265,27 +2374,30 @@
1392
 
1393
         if (!PDUSessionItem) {
1394
             ogs_error("No PDUSessionResourceReleasedItemRelRes");
1395
-            ogs_assert(OGS_OK ==
1396
-                ngap_send_error_indication2(amf_ue,
1397
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1398
+            r = ngap_send_error_indication2(amf_ue,
1399
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1400
+            ogs_expect(r == OGS_OK);
1401
+            ogs_assert(r != OGS_ERROR);
1402
             return;
1403
         }
1404
 
1405
         transfer = &PDUSessionItem->pDUSessionResourceReleaseResponseTransfer;
1406
         if (!transfer) {
1407
             ogs_error("No PDUSessionResourceReleaseResponseTransfer");
1408
-            ogs_assert(OGS_OK ==
1409
-                ngap_send_error_indication2(amf_ue,
1410
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1411
+            r = ngap_send_error_indication2(amf_ue,
1412
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1413
+            ogs_expect(r == OGS_OK);
1414
+            ogs_assert(r != OGS_ERROR);
1415
             return;
1416
         }
1417
 
1418
         if (PDUSessionItem->pDUSessionID ==
1419
                 OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
1420
             ogs_error("PDU Session Identity is unassigned");
1421
-            ogs_assert(OGS_OK ==
1422
-                ngap_send_error_indication2(amf_ue,
1423
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1424
+            r = ngap_send_error_indication2(amf_ue,
1425
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1426
+            ogs_expect(r == OGS_OK);
1427
+            ogs_assert(r != OGS_ERROR);
1428
             return;
1429
         }
1430
 
1431
@@ -2293,20 +2405,22 @@
1432
         if (!sess) {
1433
             ogs_error("Cannot find PDU Session ID %d",
1434
                     (int)PDUSessionItem->pDUSessionID);
1435
-            ogs_assert(OGS_OK ==
1436
-                ngap_send_error_indication2(amf_ue,
1437
+            r = ngap_send_error_indication2(amf_ue,
1438
                     NGAP_Cause_PR_radioNetwork,
1439
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1440
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1441
+            ogs_expect(r == OGS_OK);
1442
+            ogs_assert(r != OGS_ERROR);
1443
             return;
1444
         }
1445
 
1446
         if (!SESSION_CONTEXT_IN_SMF(sess)) {
1447
             ogs_error("Session Context is not in SMF %d",
1448
                     (int)PDUSessionItem->pDUSessionID);
1449
-            ogs_assert(OGS_OK ==
1450
-                ngap_send_error_indication2(amf_ue,
1451
+            r = ngap_send_error_indication2(amf_ue,
1452
                     NGAP_Cause_PR_radioNetwork,
1453
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1454
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1455
+            ogs_expect(r == OGS_OK);
1456
+            ogs_assert(r != OGS_ERROR);
1457
             return;
1458
         }
1459
 
1460
@@ -2330,7 +2444,7 @@
1461
         amf_gnb_t *gnb, ogs_ngap_message_t *message, ogs_pkbuf_t *pkbuf)
1462
 {
1463
     char bufOGS_ADDRSTRLEN;
1464
-    int i;
1465
+    int i, r;
1466
 
1467
     NGAP_InitiatingMessage_t *initiatingMessage = NULL;
1468
     NGAP_UplinkRANConfigurationTransfer_t
1469
@@ -2385,18 +2499,20 @@
1470
                 NGAP_GlobalRANNodeID_PR_globalGNB_ID) {
1471
             ogs_error("Not implemented targetGlobalRANNodeID->present%d",
1472
                     targetGlobalRANNodeID->present);
1473
-            ogs_assert(OGS_OK ==
1474
-                ngap_send_error_indication(gnb, NULL, NULL,
1475
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1476
+            r = ngap_send_error_indication(gnb, NULL, NULL,
1477
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1478
+            ogs_expect(r == OGS_OK);
1479
+            ogs_assert(r != OGS_ERROR);
1480
             return;
1481
         }
1482
 
1483
         targetGlobalGNB_ID = targetGlobalRANNodeID->choice.globalGNB_ID;
1484
         if (!targetGlobalGNB_ID) {
1485
             ogs_error("No targetGlobalGNB_ID");
1486
-            ogs_assert(OGS_OK ==
1487
-                ngap_send_error_indication(gnb, NULL, NULL,
1488
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1489
+            r = ngap_send_error_indication(gnb, NULL, NULL,
1490
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1491
+            ogs_expect(r == OGS_OK);
1492
+            ogs_assert(r != OGS_ERROR);
1493
             return;
1494
         }
1495
 
1496
@@ -2410,18 +2526,20 @@
1497
                 NGAP_GlobalRANNodeID_PR_globalGNB_ID) {
1498
             ogs_error("Not implemented sourceGlobalRANNodeID->present%d",
1499
                     sourceGlobalRANNodeID->present);
1500
-            ogs_assert(OGS_OK ==
1501
-                ngap_send_error_indication(gnb, NULL, NULL,
1502
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1503
+            r = ngap_send_error_indication(gnb, NULL, NULL,
1504
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1505
+            ogs_expect(r == OGS_OK);
1506
+            ogs_assert(r != OGS_ERROR);
1507
             return;
1508
         }
1509
 
1510
         sourceGlobalGNB_ID = sourceGlobalRANNodeID->choice.globalGNB_ID;
1511
         if (!sourceGlobalGNB_ID) {
1512
             ogs_error("No sourceGlobalGNB_ID");
1513
-            ogs_assert(OGS_OK ==
1514
-                ngap_send_error_indication(gnb, NULL, NULL,
1515
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1516
+            r = ngap_send_error_indication(gnb, NULL, NULL,
1517
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1518
+            ogs_expect(r == OGS_OK);
1519
+            ogs_assert(r != OGS_ERROR);
1520
             return;
1521
         }
1522
 
1523
@@ -2437,15 +2555,17 @@
1524
         if (!target_gnb) {
1525
             ogs_error("Uplink RAN configuration transfer : "
1526
                     "cannot find target gNB-id0x%x", target_gnb_id);
1527
-            ogs_assert(OGS_OK ==
1528
-                ngap_send_error_indication(gnb, NULL, NULL,
1529
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1530
+            r = ngap_send_error_indication(gnb, NULL, NULL,
1531
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1532
+            ogs_expect(r == OGS_OK);
1533
+            ogs_assert(r != OGS_ERROR);
1534
             return;
1535
         }
1536
 
1537
-        ogs_assert(OGS_OK ==
1538
-            ngap_send_downlink_ran_configuration_transfer(
1539
-                target_gnb, SONConfigurationTransfer));
1540
+        r = ngap_send_downlink_ran_configuration_transfer(
1541
+                target_gnb, SONConfigurationTransfer);
1542
+        ogs_expect(r == OGS_OK);
1543
+        ogs_assert(r != OGS_ERROR);
1544
     }
1545
 }
1546
 
1547
@@ -2453,7 +2573,7 @@
1548
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
1549
 {
1550
     char bufOGS_ADDRSTRLEN;
1551
-    int i;
1552
+    int i, r;
1553
 
1554
     amf_ue_t *amf_ue = NULL;
1555
     ran_ue_t *ran_ue = NULL;
1556
@@ -2525,26 +2645,29 @@
1557
 
1558
     if (!RAN_UE_NGAP_ID) {
1559
         ogs_error("No RAN_UE_NGAP_ID");
1560
-        ogs_assert(OGS_OK ==
1561
-            ngap_send_error_indication(gnb, NULL, NULL,
1562
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1563
+        r = ngap_send_error_indication(gnb, NULL, NULL,
1564
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1565
+        ogs_expect(r == OGS_OK);
1566
+        ogs_assert(r != OGS_ERROR);
1567
         return;
1568
     }
1569
 
1570
     if (!AMF_UE_NGAP_ID) {
1571
         ogs_error("No AMF_UE_NGAP_ID");
1572
-        ogs_assert(OGS_OK ==
1573
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1574
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1575
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1576
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1577
+        ogs_expect(r == OGS_OK);
1578
+        ogs_assert(r != OGS_ERROR);
1579
         return;
1580
     }
1581
 
1582
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
1583
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
1584
         ogs_error("Invalid AMF_UE_NGAP_ID");
1585
-        ogs_assert(OGS_OK ==
1586
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1587
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1588
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1589
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1590
+        ogs_expect(r == OGS_OK);
1591
+        ogs_assert(r != OGS_ERROR);
1592
         return;
1593
     }
1594
 
1595
@@ -2552,11 +2675,12 @@
1596
     if (!ran_ue) {
1597
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
1598
                 (long long)amf_ue_ngap_id);
1599
-        ogs_assert(OGS_OK ==
1600
-            ngap_send_error_indication(
1601
+        r = ngap_send_error_indication(
1602
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
1603
                 NGAP_Cause_PR_radioNetwork,
1604
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1605
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1606
+        ogs_expect(r == OGS_OK);
1607
+        ogs_assert(r != OGS_ERROR);
1608
         return;
1609
     }
1610
 
1611
@@ -2564,11 +2688,12 @@
1612
     if (!amf_ue) {
1613
         ogs_error("Cannot find AMF-UE Context %lld",
1614
                 (long long)amf_ue_ngap_id);
1615
-        ogs_assert(OGS_OK ==
1616
-            ngap_send_error_indication(
1617
+        r = ngap_send_error_indication(
1618
                 gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
1619
                 NGAP_Cause_PR_radioNetwork,
1620
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1621
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1622
+        ogs_expect(r == OGS_OK);
1623
+        ogs_assert(r != OGS_ERROR);
1624
         return;
1625
     }
1626
 
1627
@@ -2585,9 +2710,10 @@
1628
 
1629
     if (!UserLocationInformation) {
1630
         ogs_error("No UserLocationInformation");
1631
-        ogs_assert(OGS_OK ==
1632
-            ngap_send_error_indication2(amf_ue,
1633
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1634
+        r = ngap_send_error_indication2(amf_ue,
1635
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1636
+        ogs_expect(r == OGS_OK);
1637
+        ogs_assert(r != OGS_ERROR);
1638
         return;
1639
     }
1640
 
1641
@@ -2595,33 +2721,37 @@
1642
             NGAP_UserLocationInformation_PR_userLocationInformationNR) {
1643
         ogs_error("Not implemented UserLocationInformation%d",
1644
                 UserLocationInformation->present);
1645
-        ogs_assert(OGS_OK ==
1646
-            ngap_send_error_indication2(amf_ue,
1647
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified));
1648
+        r = ngap_send_error_indication2(amf_ue,
1649
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified);
1650
+        ogs_expect(r == OGS_OK);
1651
+        ogs_assert(r != OGS_ERROR);
1652
         return;
1653
     }
1654
 
1655
     if (!UESecurityCapabilities) {
1656
         ogs_error("No UESecurityCapabilities");
1657
-        ogs_assert(OGS_OK ==
1658
-            ngap_send_error_indication2(amf_ue,
1659
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1660
+        r = ngap_send_error_indication2(amf_ue,
1661
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1662
+        ogs_expect(r == OGS_OK);
1663
+        ogs_assert(r != OGS_ERROR);
1664
         return;
1665
     }
1666
 
1667
     if (!PDUSessionResourceToBeSwitchedDLList) {
1668
         ogs_error("No PDUSessionResourceToBeSwitchedDLList");
1669
-        ogs_assert(OGS_OK ==
1670
-            ngap_send_error_indication2(amf_ue,
1671
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1672
+        r = ngap_send_error_indication2(amf_ue,
1673
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1674
+        ogs_expect(r == OGS_OK);
1675
+        ogs_assert(r != OGS_ERROR);
1676
         return;
1677
     }
1678
 
1679
     if (!SECURITY_CONTEXT_IS_VALID(amf_ue)) {
1680
         ogs_error("No Security Context");
1681
-        ogs_assert(OGS_OK ==
1682
-            ngap_send_error_indication2(amf_ue,
1683
-                NGAP_Cause_PR_nas, NGAP_CauseNas_authentication_failure));
1684
+        r = ngap_send_error_indication2(amf_ue,
1685
+                NGAP_Cause_PR_nas, NGAP_CauseNas_authentication_failure);
1686
+        ogs_expect(r == OGS_OK);
1687
+        ogs_assert(r != OGS_ERROR);
1688
         return;
1689
     }
1690
 
1691
@@ -2688,27 +2818,30 @@
1692
 
1693
         if (!PDUSessionItem) {
1694
             ogs_error("No NGAP_PDUSessionResourceToBeSwitchedDLItem");
1695
-            ogs_assert(OGS_OK ==
1696
-                ngap_send_error_indication2(amf_ue,
1697
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1698
+            r = ngap_send_error_indication2(amf_ue,
1699
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1700
+            ogs_expect(r == OGS_OK);
1701
+            ogs_assert(r != OGS_ERROR);
1702
             return;
1703
         }
1704
 
1705
         transfer = &PDUSessionItem->pathSwitchRequestTransfer;
1706
         if (!transfer) {
1707
             ogs_error("No PDUSessionResourceSetupResponseTransfer");
1708
-            ogs_assert(OGS_OK ==
1709
-                ngap_send_error_indication2(amf_ue,
1710
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1711
+            r = ngap_send_error_indication2(amf_ue,
1712
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1713
+            ogs_expect(r == OGS_OK);
1714
+            ogs_assert(r != OGS_ERROR);
1715
             return;
1716
         }
1717
 
1718
         if (PDUSessionItem->pDUSessionID ==
1719
                 OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
1720
             ogs_error("PDU Session Identity is unassigned");
1721
-            ogs_assert(OGS_OK ==
1722
-                ngap_send_error_indication2(amf_ue,
1723
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1724
+            r = ngap_send_error_indication2(amf_ue,
1725
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1726
+            ogs_expect(r == OGS_OK);
1727
+            ogs_assert(r != OGS_ERROR);
1728
             return;
1729
         }
1730
 
1731
@@ -2716,20 +2849,22 @@
1732
         if (!sess) {
1733
             ogs_error("Cannot find PDU Session ID %d",
1734
                     (int)PDUSessionItem->pDUSessionID);
1735
-            ogs_assert(OGS_OK ==
1736
-                ngap_send_error_indication2(amf_ue,
1737
+            r = ngap_send_error_indication2(amf_ue,
1738
                     NGAP_Cause_PR_radioNetwork,
1739
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1740
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1741
+            ogs_expect(r == OGS_OK);
1742
+            ogs_assert(r != OGS_ERROR);
1743
             return;
1744
         }
1745
 
1746
         if (!SESSION_CONTEXT_IN_SMF(sess)) {
1747
             ogs_error("Session Context is not in SMF %d",
1748
                     (int)PDUSessionItem->pDUSessionID);
1749
-            ogs_assert(OGS_OK ==
1750
-                ngap_send_error_indication2(amf_ue,
1751
+            r = ngap_send_error_indication2(amf_ue,
1752
                     NGAP_Cause_PR_radioNetwork,
1753
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
1754
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
1755
+            ogs_expect(r == OGS_OK);
1756
+            ogs_assert(r != OGS_ERROR);
1757
             return;
1758
         }
1759
 
1760
@@ -2753,7 +2888,7 @@
1761
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
1762
 {
1763
     char bufOGS_ADDRSTRLEN;
1764
-    int i;
1765
+    int i, r;
1766
 
1767
     amf_ue_t *amf_ue = NULL;
1768
     ran_ue_t *source_ue = NULL, *target_ue = NULL;
1769
@@ -2829,18 +2964,20 @@
1770
 
1771
     if (!AMF_UE_NGAP_ID) {
1772
         ogs_error("No AMF_UE_NGAP_ID");
1773
-        ogs_assert(OGS_OK ==
1774
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1775
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1776
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1777
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1778
+        ogs_expect(r == OGS_OK);
1779
+        ogs_assert(r != OGS_ERROR);
1780
         return;
1781
     }
1782
 
1783
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
1784
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
1785
         ogs_error("Invalid AMF_UE_NGAP_ID");
1786
-        ogs_assert(OGS_OK ==
1787
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1788
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1789
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
1790
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1791
+        ogs_expect(r == OGS_OK);
1792
+        ogs_assert(r != OGS_ERROR);
1793
         return;
1794
     }
1795
 
1796
@@ -2848,11 +2985,12 @@
1797
     if (!source_ue) {
1798
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
1799
                 (long long)amf_ue_ngap_id);
1800
-        ogs_assert(OGS_OK ==
1801
-            ngap_send_error_indication(
1802
+        r = ngap_send_error_indication(
1803
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
1804
                 NGAP_Cause_PR_radioNetwork,
1805
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1806
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1807
+        ogs_expect(r == OGS_OK);
1808
+        ogs_assert(r != OGS_ERROR);
1809
         return;
1810
     }
1811
 
1812
@@ -2863,51 +3001,57 @@
1813
     if (!amf_ue) {
1814
         ogs_error("Cannot find AMF-UE Context %lld",
1815
                 (long long)amf_ue_ngap_id);
1816
-        ogs_assert(OGS_OK ==
1817
-            ngap_send_error_indication(
1818
+        r = ngap_send_error_indication(
1819
                 gnb, &source_ue->ran_ue_ngap_id, &source_ue->amf_ue_ngap_id,
1820
                 NGAP_Cause_PR_radioNetwork,
1821
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
1822
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
1823
+        ogs_expect(r == OGS_OK);
1824
+        ogs_assert(r != OGS_ERROR);
1825
         return;
1826
     }
1827
 
1828
     if (!HandoverType) {
1829
         ogs_error("No HandoverType");
1830
-        ogs_assert(OGS_OK ==
1831
-            ngap_send_error_indication2(amf_ue,
1832
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1833
+        r = ngap_send_error_indication2(amf_ue,
1834
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1835
+        ogs_expect(r == OGS_OK);
1836
+        ogs_assert(r != OGS_ERROR);
1837
         return;
1838
     }
1839
 
1840
     if (!Cause) {
1841
         ogs_error("No Cause");
1842
-        ogs_assert(OGS_OK ==
1843
-            ngap_send_error_indication2(amf_ue,
1844
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1845
+        r = ngap_send_error_indication2(amf_ue,
1846
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1847
+        ogs_expect(r == OGS_OK);
1848
+        ogs_assert(r != OGS_ERROR);
1849
         return;
1850
     }
1851
 
1852
     if (!TargetID) {
1853
         ogs_error("No TargetID");
1854
-        ogs_assert(OGS_OK ==
1855
-            ngap_send_error_indication2(amf_ue,
1856
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1857
+        r = ngap_send_error_indication2(amf_ue,
1858
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1859
+        ogs_expect(r == OGS_OK);
1860
+        ogs_assert(r != OGS_ERROR);
1861
         return;
1862
     }
1863
 
1864
     if (TargetID->present != NGAP_TargetID_PR_targetRANNodeID) {
1865
         ogs_error("Not implemented TargetID%d", TargetID->present);
1866
-        ogs_assert(OGS_OK ==
1867
-            ngap_send_error_indication2(amf_ue,
1868
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1869
+        r = ngap_send_error_indication2(amf_ue,
1870
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1871
+        ogs_expect(r == OGS_OK);
1872
+        ogs_assert(r != OGS_ERROR);
1873
         return;
1874
     }
1875
     targetRANNodeID = TargetID->choice.targetRANNodeID;
1876
     if (!targetRANNodeID) {
1877
         ogs_error("No targetRANNodeID");
1878
-        ogs_assert(OGS_OK ==
1879
-            ngap_send_error_indication2(amf_ue,
1880
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1881
+        r = ngap_send_error_indication2(amf_ue,
1882
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1883
+        ogs_expect(r == OGS_OK);
1884
+        ogs_assert(r != OGS_ERROR);
1885
         return;
1886
     }
1887
 
1888
@@ -2915,18 +3059,20 @@
1889
     if (globalRANNodeID->present != NGAP_GlobalRANNodeID_PR_globalGNB_ID) {
1890
         ogs_error("Not implemented globalRANNodeID%d",
1891
                 globalRANNodeID->present);
1892
-        ogs_assert(OGS_OK ==
1893
-            ngap_send_error_indication2(amf_ue,
1894
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1895
+        r = ngap_send_error_indication2(amf_ue,
1896
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1897
+        ogs_expect(r == OGS_OK);
1898
+        ogs_assert(r != OGS_ERROR);
1899
         return;
1900
     }
1901
 
1902
     globalGNB_ID = globalRANNodeID->choice.globalGNB_ID;
1903
     if (!globalGNB_ID) {
1904
         ogs_error("No globalGNB_ID");
1905
-        ogs_assert(OGS_OK ==
1906
-            ngap_send_error_indication2(amf_ue,
1907
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1908
+        r = ngap_send_error_indication2(amf_ue,
1909
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1910
+        ogs_expect(r == OGS_OK);
1911
+        ogs_assert(r != OGS_ERROR);
1912
         return;
1913
     }
1914
 
1915
@@ -2935,42 +3081,47 @@
1916
     if (!target_gnb) {
1917
         ogs_error("Handover required : cannot find target gNB-id0x%x",
1918
                 target_gnb_id);
1919
-        ogs_assert(OGS_OK ==
1920
-            ngap_send_error_indication2(amf_ue,
1921
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1922
+        r = ngap_send_error_indication2(amf_ue,
1923
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1924
+        ogs_expect(r == OGS_OK);
1925
+        ogs_assert(r != OGS_ERROR);
1926
         return;
1927
     }
1928
 
1929
     if (!PDUSessionList) {
1930
         ogs_error("No PDUSessionList");
1931
-        ogs_assert(OGS_OK ==
1932
-            ngap_send_error_indication2(amf_ue,
1933
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1934
+        r = ngap_send_error_indication2(amf_ue,
1935
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1936
+        ogs_expect(r == OGS_OK);
1937
+        ogs_assert(r != OGS_ERROR);
1938
         return;
1939
     }
1940
 
1941
     if (!SourceToTarget_TransparentContainer) {
1942
         ogs_error("No SourceToTarget_TransparentContainer");
1943
-        ogs_assert(OGS_OK ==
1944
-            ngap_send_error_indication2(amf_ue,
1945
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1946
+        r = ngap_send_error_indication2(amf_ue,
1947
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1948
+        ogs_expect(r == OGS_OK);
1949
+        ogs_assert(r != OGS_ERROR);
1950
         return;
1951
     }
1952
 
1953
     if (!SECURITY_CONTEXT_IS_VALID(amf_ue)) {
1954
         ogs_error("No Security Context");
1955
-        ogs_assert(OGS_OK ==
1956
-            ngap_send_error_indication2(amf_ue,
1957
-                NGAP_Cause_PR_nas, NGAP_CauseNas_authentication_failure));
1958
+        r = ngap_send_error_indication2(amf_ue,
1959
+                NGAP_Cause_PR_nas, NGAP_CauseNas_authentication_failure);
1960
+        ogs_expect(r == OGS_OK);
1961
+        ogs_assert(r != OGS_ERROR);
1962
         return;
1963
     }
1964
 
1965
     /* Target UE */
1966
     target_ue = ran_ue_add(target_gnb, INVALID_UE_NGAP_ID);
1967
     if (target_ue == NULL) {
1968
-        ogs_assert(OGS_OK ==
1969
-            ngap_send_error_indication2(amf_ue, NGAP_Cause_PR_misc,
1970
-                NGAP_CauseMisc_control_processing_overload));
1971
+        r = ngap_send_error_indication2(amf_ue, NGAP_Cause_PR_misc,
1972
+                NGAP_CauseMisc_control_processing_overload);
1973
+        ogs_expect(r == OGS_OK);
1974
+        ogs_assert(r != OGS_ERROR);
1975
         return;
1976
     }
1977
 
1978
@@ -3007,27 +3158,30 @@
1979
 
1980
         if (!PDUSessionItem) {
1981
             ogs_error("No PDUSessionResourceItemHORqd");
1982
-            ogs_assert(OGS_OK ==
1983
-                ngap_send_error_indication2(amf_ue,
1984
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1985
+            r = ngap_send_error_indication2(amf_ue,
1986
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
1987
+            ogs_expect(r == OGS_OK);
1988
+            ogs_assert(r != OGS_ERROR);
1989
             return;
1990
         }
1991
 
1992
         transfer = &PDUSessionItem->handoverRequiredTransfer;
1993
         if (!transfer) {
1994
             ogs_error("No handoverRequiredTransfer");
1995
-            ogs_assert(OGS_OK ==
1996
-                ngap_send_error_indication2(amf_ue,
1997
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
1998
+            r = ngap_send_error_indication2(amf_ue,
1999
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2000
+            ogs_expect(r == OGS_OK);
2001
+            ogs_assert(r != OGS_ERROR);
2002
             return;
2003
         }
2004
 
2005
         if (PDUSessionItem->pDUSessionID ==
2006
                 OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
2007
             ogs_error("PDU Session Identity is unassigned");
2008
-            ogs_assert(OGS_OK ==
2009
-                ngap_send_error_indication2(amf_ue,
2010
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2011
+            r = ngap_send_error_indication2(amf_ue,
2012
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2013
+            ogs_expect(r == OGS_OK);
2014
+            ogs_assert(r != OGS_ERROR);
2015
             return;
2016
         }
2017
 
2018
@@ -3035,20 +3189,22 @@
2019
         if (!sess) {
2020
             ogs_error("Cannot find PDU Session ID %d",
2021
                     (int)PDUSessionItem->pDUSessionID);
2022
-            ogs_assert(OGS_OK ==
2023
-                ngap_send_error_indication2(amf_ue,
2024
+            r = ngap_send_error_indication2(amf_ue,
2025
                     NGAP_Cause_PR_radioNetwork,
2026
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
2027
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
2028
+            ogs_expect(r == OGS_OK);
2029
+            ogs_assert(r != OGS_ERROR);
2030
             return;
2031
         }
2032
 
2033
         if (!SESSION_CONTEXT_IN_SMF(sess)) {
2034
             ogs_error("Session Context is not in SMF %d",
2035
                     (int)PDUSessionItem->pDUSessionID);
2036
-            ogs_assert(OGS_OK ==
2037
-                ngap_send_error_indication2(amf_ue,
2038
+            r = ngap_send_error_indication2(amf_ue,
2039
                     NGAP_Cause_PR_radioNetwork,
2040
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
2041
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
2042
+            ogs_expect(r == OGS_OK);
2043
+            ogs_assert(r != OGS_ERROR);
2044
             return;
2045
         }
2046
 
2047
@@ -3075,7 +3231,7 @@
2048
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
2049
 {
2050
     char bufOGS_ADDRSTRLEN;
2051
-    int i;
2052
+    int i, r;
2053
 
2054
     amf_ue_t *amf_ue = NULL;
2055
     ran_ue_t *source_ue = NULL, *target_ue = NULL;
2056
@@ -3133,26 +3289,29 @@
2057
 
2058
     if (!RAN_UE_NGAP_ID) {
2059
         ogs_error("No RAN_UE_NGAP_ID");
2060
-        ogs_assert(OGS_OK ==
2061
-            ngap_send_error_indication(gnb, NULL, NULL,
2062
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2063
+        r = ngap_send_error_indication(gnb, NULL, NULL,
2064
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2065
+        ogs_expect(r == OGS_OK);
2066
+        ogs_assert(r != OGS_ERROR);
2067
         return;
2068
     }
2069
 
2070
     if (!AMF_UE_NGAP_ID) {
2071
         ogs_error("No AMF_UE_NGAP_ID");
2072
-        ogs_assert(OGS_OK ==
2073
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2074
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2075
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2076
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2077
+        ogs_expect(r == OGS_OK);
2078
+        ogs_assert(r != OGS_ERROR);
2079
         return;
2080
     }
2081
 
2082
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
2083
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
2084
         ogs_error("Invalid AMF_UE_NGAP_ID");
2085
-        ogs_assert(OGS_OK ==
2086
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2087
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2088
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2089
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2090
+        ogs_expect(r == OGS_OK);
2091
+        ogs_assert(r != OGS_ERROR);
2092
         return;
2093
     }
2094
 
2095
@@ -3160,19 +3319,21 @@
2096
     if (!target_ue) {
2097
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
2098
                 (long long)amf_ue_ngap_id);
2099
-        ogs_assert(OGS_OK ==
2100
-            ngap_send_error_indication(
2101
+        r = ngap_send_error_indication(
2102
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
2103
                 NGAP_Cause_PR_radioNetwork,
2104
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2105
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2106
+        ogs_expect(r == OGS_OK);
2107
+        ogs_assert(r != OGS_ERROR);
2108
         return;
2109
     }
2110
 
2111
     if (!RAN_UE_NGAP_ID) {
2112
         ogs_error("No RAN_UE_NGAP_ID");
2113
-        ogs_assert(OGS_OK ==
2114
-            ngap_send_error_indication(gnb, NULL, NULL,
2115
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2116
+        r = ngap_send_error_indication(gnb, NULL, NULL,
2117
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2118
+        ogs_expect(r == OGS_OK);
2119
+        ogs_assert(r != OGS_ERROR);
2120
         return;
2121
     }
2122
 
2123
@@ -3182,22 +3343,24 @@
2124
     if (!source_ue) {
2125
         ogs_error("Cannot find Source-UE Context %lld",
2126
                 (long long)amf_ue_ngap_id);
2127
-        ogs_assert(OGS_OK ==
2128
-            ngap_send_error_indication(
2129
+        r = ngap_send_error_indication(
2130
                 gnb, &target_ue->ran_ue_ngap_id, &target_ue->amf_ue_ngap_id,
2131
                 NGAP_Cause_PR_radioNetwork,
2132
-                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID));
2133
+                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID);
2134
+        ogs_expect(r == OGS_OK);
2135
+        ogs_assert(r != OGS_ERROR);
2136
         return;
2137
     }
2138
     amf_ue = target_ue->amf_ue;
2139
     if (!amf_ue) {
2140
         ogs_error("Cannot find AMF-UE Context %lld",
2141
                 (long long)amf_ue_ngap_id);
2142
-        ogs_assert(OGS_OK ==
2143
-            ngap_send_error_indication(
2144
+        r = ngap_send_error_indication(
2145
                 gnb, &target_ue->ran_ue_ngap_id, &target_ue->amf_ue_ngap_id,
2146
                 NGAP_Cause_PR_radioNetwork,
2147
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2148
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2149
+        ogs_expect(r == OGS_OK);
2150
+        ogs_assert(r != OGS_ERROR);
2151
         return;
2152
     }
2153
 
2154
@@ -3208,17 +3371,19 @@
2155
 
2156
     if (!PDUSessionList) {
2157
         ogs_error("No PDUSessionList");
2158
-        ogs_assert(OGS_OK ==
2159
-            ngap_send_error_indication2(amf_ue,
2160
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2161
+        r = ngap_send_error_indication2(amf_ue,
2162
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2163
+        ogs_expect(r == OGS_OK);
2164
+        ogs_assert(r != OGS_ERROR);
2165
         return;
2166
     }
2167
 
2168
     if (!TargetToSource_TransparentContainer) {
2169
         ogs_error("No TargetToSource_TransparentContainer");
2170
-        ogs_assert(OGS_OK ==
2171
-            ngap_send_error_indication2(amf_ue,
2172
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2173
+        r = ngap_send_error_indication2(amf_ue,
2174
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2175
+        ogs_expect(r == OGS_OK);
2176
+        ogs_assert(r != OGS_ERROR);
2177
         return;
2178
     }
2179
 
2180
@@ -3233,27 +3398,30 @@
2181
 
2182
         if (!PDUSessionItem) {
2183
             ogs_error("No PDUSessionResourceAdmittedItem");
2184
-            ogs_assert(OGS_OK ==
2185
-                ngap_send_error_indication2(amf_ue,
2186
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2187
+            r = ngap_send_error_indication2(amf_ue,
2188
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2189
+            ogs_expect(r == OGS_OK);
2190
+            ogs_assert(r != OGS_ERROR);
2191
             return;
2192
         }
2193
 
2194
         transfer = &PDUSessionItem->handoverRequestAcknowledgeTransfer;
2195
         if (!transfer) {
2196
             ogs_error("No handoverRequestAcknowledgeTransfer");
2197
-            ogs_assert(OGS_OK ==
2198
-                ngap_send_error_indication2(amf_ue,
2199
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2200
+            r = ngap_send_error_indication2(amf_ue,
2201
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2202
+            ogs_expect(r == OGS_OK);
2203
+            ogs_assert(r != OGS_ERROR);
2204
             return;
2205
         }
2206
 
2207
         if (PDUSessionItem->pDUSessionID ==
2208
                 OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED) {
2209
             ogs_error("PDU Session Identity is unassigned");
2210
-            ogs_assert(OGS_OK ==
2211
-                ngap_send_error_indication2(amf_ue,
2212
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2213
+            r = ngap_send_error_indication2(amf_ue,
2214
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2215
+            ogs_expect(r == OGS_OK);
2216
+            ogs_assert(r != OGS_ERROR);
2217
             return;
2218
         }
2219
 
2220
@@ -3261,20 +3429,22 @@
2221
         if (!sess) {
2222
             ogs_error("Cannot find PDU Session ID %d",
2223
                     (int)PDUSessionItem->pDUSessionID);
2224
-            ogs_assert(OGS_OK ==
2225
-                ngap_send_error_indication2(amf_ue,
2226
+            r = ngap_send_error_indication2(amf_ue,
2227
                     NGAP_Cause_PR_radioNetwork,
2228
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
2229
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
2230
+            ogs_expect(r == OGS_OK);
2231
+            ogs_assert(r != OGS_ERROR);
2232
             return;
2233
         }
2234
 
2235
         if (!SESSION_CONTEXT_IN_SMF(sess)) {
2236
             ogs_error("Session Context is not in SMF %d",
2237
                     (int)PDUSessionItem->pDUSessionID);
2238
-            ogs_assert(OGS_OK ==
2239
-                ngap_send_error_indication2(amf_ue,
2240
+            r = ngap_send_error_indication2(amf_ue,
2241
                     NGAP_Cause_PR_radioNetwork,
2242
-                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID));
2243
+                    NGAP_CauseRadioNetwork_unknown_PDU_session_ID);
2244
+            ogs_expect(r == OGS_OK);
2245
+            ogs_assert(r != OGS_ERROR);
2246
             return;
2247
         }
2248
 
2249
@@ -3300,7 +3470,7 @@
2250
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
2251
 {
2252
     char bufOGS_ADDRSTRLEN;
2253
-    int i;
2254
+    int i, r;
2255
 
2256
     ran_ue_t *source_ue = NULL, *target_ue = NULL;
2257
     uint64_t amf_ue_ngap_id;
2258
@@ -3343,18 +3513,20 @@
2259
 
2260
     if (!AMF_UE_NGAP_ID) {
2261
         ogs_error("No AMF_UE_NGAP_ID");
2262
-        ogs_assert(OGS_OK ==
2263
-            ngap_send_error_indication(gnb, NULL, NULL,
2264
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2265
+        r = ngap_send_error_indication(gnb, NULL, NULL,
2266
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2267
+        ogs_expect(r == OGS_OK);
2268
+        ogs_assert(r != OGS_ERROR);
2269
         return;
2270
     }
2271
 
2272
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
2273
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
2274
         ogs_error("Invalid AMF_UE_NGAP_ID");
2275
-        ogs_assert(OGS_OK ==
2276
-            ngap_send_error_indication(gnb, NULL, NULL,
2277
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2278
+        r = ngap_send_error_indication(gnb, NULL, NULL,
2279
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2280
+        ogs_expect(r == OGS_OK);
2281
+        ogs_assert(r != OGS_ERROR);
2282
         return;
2283
     }
2284
 
2285
@@ -3362,11 +3534,12 @@
2286
     if (!target_ue) {
2287
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
2288
                 (long long)amf_ue_ngap_id);
2289
-        ogs_assert(OGS_OK ==
2290
-            ngap_send_error_indication(
2291
+        r = ngap_send_error_indication(
2292
                 gnb, NULL, &amf_ue_ngap_id,
2293
                 NGAP_Cause_PR_radioNetwork,
2294
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2295
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2296
+        ogs_expect(r == OGS_OK);
2297
+        ogs_assert(r != OGS_ERROR);
2298
         return;
2299
     }
2300
 
2301
@@ -3374,11 +3547,12 @@
2302
     if (!source_ue) {
2303
         ogs_error("Cannot find Source-UE Context %lld",
2304
                 (long long)amf_ue_ngap_id);
2305
-        ogs_assert(OGS_OK ==
2306
-            ngap_send_error_indication(
2307
+        r = ngap_send_error_indication(
2308
                 gnb, &target_ue->ran_ue_ngap_id, &target_ue->amf_ue_ngap_id,
2309
                 NGAP_Cause_PR_radioNetwork,
2310
-                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID));
2311
+                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID);
2312
+        ogs_expect(r == OGS_OK);
2313
+        ogs_assert(r != OGS_ERROR);
2314
         return;
2315
     }
2316
 
2317
@@ -3389,29 +3563,32 @@
2318
 
2319
     if (!Cause) {
2320
         ogs_error("No Cause");
2321
-        ogs_assert(OGS_OK ==
2322
-            ngap_send_error_indication(
2323
+        r = ngap_send_error_indication(
2324
                 gnb, &target_ue->ran_ue_ngap_id, &target_ue->amf_ue_ngap_id,
2325
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2326
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2327
+        ogs_expect(r == OGS_OK);
2328
+        ogs_assert(r != OGS_ERROR);
2329
         return;
2330
     }
2331
     ogs_debug("    CauseGroup:%d Cause:%d",
2332
             Cause->present, (int)Cause->choice.radioNetwork);
2333
 
2334
-    ogs_assert(OGS_OK ==
2335
-        ngap_send_handover_preparation_failure(source_ue, Cause));
2336
+    r = ngap_send_handover_preparation_failure(source_ue, Cause);
2337
+    ogs_expect(r == OGS_OK);
2338
+    ogs_assert(r != OGS_ERROR);
2339
 
2340
-    ogs_assert(OGS_OK ==
2341
-        ngap_send_ran_ue_context_release_command(target_ue,
2342
+    r = ngap_send_ran_ue_context_release_command(target_ue,
2343
             NGAP_Cause_PR_radioNetwork, NGAP_CauseRadioNetwork_ho_failure_in_target_5GC_ngran_node_or_target_system,
2344
-            NGAP_UE_CTX_REL_NG_HANDOVER_FAILURE, 0));
2345
+            NGAP_UE_CTX_REL_NG_HANDOVER_FAILURE, 0);
2346
+    ogs_expect(r == OGS_OK);
2347
+    ogs_assert(r != OGS_ERROR);
2348
 }
2349
 
2350
 void ngap_handle_handover_cancel(
2351
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
2352
 {
2353
     char bufOGS_ADDRSTRLEN;
2354
-    int i;
2355
+    int i, r;
2356
 
2357
     amf_ue_t *amf_ue = NULL;
2358
     amf_sess_t *sess = NULL;
2359
@@ -3460,18 +3637,20 @@
2360
 
2361
     if (!AMF_UE_NGAP_ID) {
2362
         ogs_error("No AMF_UE_NGAP_ID");
2363
-        ogs_assert(OGS_OK ==
2364
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2365
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2366
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2367
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2368
+        ogs_expect(r == OGS_OK);
2369
+        ogs_assert(r != OGS_ERROR);
2370
         return;
2371
     }
2372
 
2373
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
2374
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
2375
         ogs_error("Invalid AMF_UE_NGAP_ID");
2376
-        ogs_assert(OGS_OK ==
2377
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2378
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2379
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2380
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2381
+        ogs_expect(r == OGS_OK);
2382
+        ogs_assert(r != OGS_ERROR);
2383
         return;
2384
     }
2385
 
2386
@@ -3479,11 +3658,12 @@
2387
     if (!source_ue) {
2388
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
2389
                 (long long)amf_ue_ngap_id);
2390
-        ogs_assert(OGS_OK ==
2391
-            ngap_send_error_indication(
2392
+        r = ngap_send_error_indication(
2393
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
2394
                 NGAP_Cause_PR_radioNetwork,
2395
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2396
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2397
+        ogs_expect(r == OGS_OK);
2398
+        ogs_assert(r != OGS_ERROR);
2399
         return;
2400
     }
2401
 
2402
@@ -3491,22 +3671,24 @@
2403
     if (!target_ue) {
2404
         ogs_error("Cannot find Source-UE Context %lld",
2405
                 (long long)amf_ue_ngap_id);
2406
-        ogs_assert(OGS_OK ==
2407
-            ngap_send_error_indication(
2408
+        r = ngap_send_error_indication(
2409
                 gnb, &source_ue->ran_ue_ngap_id, &source_ue->amf_ue_ngap_id,
2410
                 NGAP_Cause_PR_radioNetwork,
2411
-                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID));
2412
+                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID);
2413
+        ogs_expect(r == OGS_OK);
2414
+        ogs_assert(r != OGS_ERROR);
2415
         return;
2416
     }
2417
     amf_ue = source_ue->amf_ue;
2418
     if (!amf_ue) {
2419
         ogs_error("Cannot find AMF-UE Context %lld",
2420
                 (long long)amf_ue_ngap_id);
2421
-        ogs_assert(OGS_OK ==
2422
-            ngap_send_error_indication(
2423
+        r = ngap_send_error_indication(
2424
                 gnb, &source_ue->ran_ue_ngap_id, &source_ue->amf_ue_ngap_id,
2425
                 NGAP_Cause_PR_radioNetwork,
2426
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2427
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2428
+        ogs_expect(r == OGS_OK);
2429
+        ogs_assert(r != OGS_ERROR);
2430
         return;
2431
     }
2432
 
2433
@@ -3517,10 +3699,11 @@
2434
 
2435
     if (!Cause) {
2436
         ogs_error("No Cause");
2437
-        ogs_assert(OGS_OK ==
2438
-            ngap_send_error_indication(
2439
+        r = ngap_send_error_indication(
2440
                 gnb, &source_ue->ran_ue_ngap_id, &source_ue->amf_ue_ngap_id,
2441
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2442
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2443
+        ogs_expect(r == OGS_OK);
2444
+        ogs_assert(r != OGS_ERROR);
2445
         return;
2446
     }
2447
     ogs_debug("    CauseGroup:%d Cause:%d",
2448
@@ -3544,7 +3727,7 @@
2449
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
2450
 {
2451
     char bufOGS_ADDRSTRLEN;
2452
-    int i;
2453
+    int i, r;
2454
 
2455
     amf_ue_t *amf_ue = NULL;
2456
     ran_ue_t *source_ue = NULL, *target_ue = NULL;
2457
@@ -3594,18 +3777,20 @@
2458
 
2459
     if (!AMF_UE_NGAP_ID) {
2460
         ogs_error("No AMF_UE_NGAP_ID");
2461
-        ogs_assert(OGS_OK ==
2462
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2463
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2464
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2465
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2466
+        ogs_expect(r == OGS_OK);
2467
+        ogs_assert(r != OGS_ERROR);
2468
         return;
2469
     }
2470
 
2471
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
2472
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
2473
         ogs_error("Invalid AMF_UE_NGAP_ID");
2474
-        ogs_assert(OGS_OK ==
2475
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2476
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2477
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2478
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2479
+        ogs_expect(r == OGS_OK);
2480
+        ogs_assert(r != OGS_ERROR);
2481
         return;
2482
     }
2483
 
2484
@@ -3613,11 +3798,12 @@
2485
     if (!source_ue) {
2486
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
2487
                 (long long)amf_ue_ngap_id);
2488
-        ogs_assert(OGS_OK ==
2489
-            ngap_send_error_indication(
2490
+        r = ngap_send_error_indication(
2491
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
2492
                 NGAP_Cause_PR_radioNetwork,
2493
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2494
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2495
+        ogs_expect(r == OGS_OK);
2496
+        ogs_assert(r != OGS_ERROR);
2497
         return;
2498
     }
2499
 
2500
@@ -3625,22 +3811,24 @@
2501
     if (!target_ue) {
2502
         ogs_error("Cannot find Source-UE Context %lld",
2503
                 (long long)amf_ue_ngap_id);
2504
-        ogs_assert(OGS_OK ==
2505
-            ngap_send_error_indication(
2506
+        r = ngap_send_error_indication(
2507
                 gnb, &source_ue->ran_ue_ngap_id, &source_ue->amf_ue_ngap_id,
2508
                 NGAP_Cause_PR_radioNetwork,
2509
-                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID));
2510
+                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID);
2511
+        ogs_expect(r == OGS_OK);
2512
+        ogs_assert(r != OGS_ERROR);
2513
         return;
2514
     }
2515
     amf_ue = source_ue->amf_ue;
2516
     if (!amf_ue) {
2517
         ogs_error("Cannot find AMF-UE Context %lld",
2518
                 (long long)amf_ue_ngap_id);
2519
-        ogs_assert(OGS_OK ==
2520
-            ngap_send_error_indication(
2521
+        r = ngap_send_error_indication(
2522
                 gnb, &source_ue->ran_ue_ngap_id, &source_ue->amf_ue_ngap_id,
2523
                 NGAP_Cause_PR_radioNetwork,
2524
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2525
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2526
+        ogs_expect(r == OGS_OK);
2527
+        ogs_assert(r != OGS_ERROR);
2528
         return;
2529
     }
2530
 
2531
@@ -3649,16 +3837,17 @@
2532
     ogs_debug("    Target : RAN_UE_NGAP_ID%d AMF_UE_NGAP_ID%lld ",
2533
         target_ue->ran_ue_ngap_id, (long long)target_ue->amf_ue_ngap_id);
2534
 
2535
-    ogs_assert(OGS_OK ==
2536
-        ngap_send_downlink_ran_status_transfer(
2537
-            target_ue, RANStatusTransfer_TransparentContainer));
2538
+    r = ngap_send_downlink_ran_status_transfer(
2539
+            target_ue, RANStatusTransfer_TransparentContainer);
2540
+    ogs_expect(r == OGS_OK);
2541
+    ogs_assert(r != OGS_ERROR);
2542
 }
2543
 
2544
 void ngap_handle_handover_notification(
2545
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
2546
 {
2547
     char bufOGS_ADDRSTRLEN;
2548
-    int i;
2549
+    int i, r;
2550
 
2551
     amf_ue_t *amf_ue = NULL;
2552
     amf_sess_t *sess = NULL;
2553
@@ -3708,18 +3897,20 @@
2554
 
2555
     if (!AMF_UE_NGAP_ID) {
2556
         ogs_error("No AMF_UE_NGAP_ID");
2557
-        ogs_assert(OGS_OK ==
2558
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2559
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2560
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2561
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2562
+        ogs_expect(r == OGS_OK);
2563
+        ogs_assert(r != OGS_ERROR);
2564
         return;
2565
     }
2566
 
2567
     if (asn_INTEGER2ulong(AMF_UE_NGAP_ID,
2568
                 (unsigned long *)&amf_ue_ngap_id) != 0) {
2569
         ogs_error("Invalid AMF_UE_NGAP_ID");
2570
-        ogs_assert(OGS_OK ==
2571
-            ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2572
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2573
+        r = ngap_send_error_indication(gnb, (uint32_t *)RAN_UE_NGAP_ID, NULL,
2574
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2575
+        ogs_expect(r == OGS_OK);
2576
+        ogs_assert(r != OGS_ERROR);
2577
         return;
2578
     }
2579
 
2580
@@ -3727,11 +3918,12 @@
2581
     if (!target_ue) {
2582
         ogs_error("No RAN UE Context : AMF_UE_NGAP_ID%lld",
2583
                 (long long)amf_ue_ngap_id);
2584
-        ogs_assert(OGS_OK ==
2585
-            ngap_send_error_indication(
2586
+        r = ngap_send_error_indication(
2587
                 gnb, (uint32_t *)RAN_UE_NGAP_ID, &amf_ue_ngap_id,
2588
                 NGAP_Cause_PR_radioNetwork,
2589
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2590
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2591
+        ogs_expect(r == OGS_OK);
2592
+        ogs_assert(r != OGS_ERROR);
2593
         return;
2594
     }
2595
 
2596
@@ -3739,22 +3931,24 @@
2597
     if (!source_ue) {
2598
         ogs_error("Cannot find Source-UE Context %lld",
2599
                 (long long)amf_ue_ngap_id);
2600
-        ogs_assert(OGS_OK ==
2601
-            ngap_send_error_indication(
2602
+        r = ngap_send_error_indication(
2603
                 gnb, &target_ue->ran_ue_ngap_id, &target_ue->amf_ue_ngap_id,
2604
                 NGAP_Cause_PR_radioNetwork,
2605
-                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID));
2606
+                NGAP_CauseRadioNetwork_inconsistent_remote_UE_NGAP_ID);
2607
+        ogs_expect(r == OGS_OK);
2608
+        ogs_assert(r != OGS_ERROR);
2609
         return;
2610
     }
2611
     amf_ue = target_ue->amf_ue;
2612
     if (!amf_ue) {
2613
         ogs_error("Cannot find AMF-UE Context %lld",
2614
                 (long long)amf_ue_ngap_id);
2615
-        ogs_assert(OGS_OK ==
2616
-            ngap_send_error_indication(
2617
+        r = ngap_send_error_indication(
2618
                 gnb, &target_ue->ran_ue_ngap_id, &target_ue->amf_ue_ngap_id,
2619
                 NGAP_Cause_PR_radioNetwork,
2620
-                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID));
2621
+                NGAP_CauseRadioNetwork_unknown_local_UE_NGAP_ID);
2622
+        ogs_expect(r == OGS_OK);
2623
+        ogs_assert(r != OGS_ERROR);
2624
         return;
2625
     }
2626
 
2627
@@ -3762,9 +3956,10 @@
2628
 
2629
     if (!UserLocationInformation) {
2630
         ogs_error("No UserLocationInformation");
2631
-        ogs_assert(OGS_OK ==
2632
-            ngap_send_error_indication(gnb, &target_ue->ran_ue_ngap_id, NULL,
2633
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2634
+        r = ngap_send_error_indication(gnb, &target_ue->ran_ue_ngap_id, NULL,
2635
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2636
+        ogs_expect(r == OGS_OK);
2637
+        ogs_assert(r != OGS_ERROR);
2638
         return;
2639
     }
2640
 
2641
@@ -3772,9 +3967,10 @@
2642
             NGAP_UserLocationInformation_PR_userLocationInformationNR) {
2643
         ogs_error("Not implemented UserLocationInformation%d",
2644
                 UserLocationInformation->present);
2645
-        ogs_assert(OGS_OK ==
2646
-            ngap_send_error_indication(gnb, &target_ue->ran_ue_ngap_id, NULL,
2647
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified));
2648
+        r = ngap_send_error_indication(gnb, &target_ue->ran_ue_ngap_id, NULL,
2649
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_unspecified);
2650
+        ogs_expect(r == OGS_OK);
2651
+        ogs_assert(r != OGS_ERROR);
2652
         return;
2653
     }
2654
 
2655
@@ -3802,12 +3998,13 @@
2656
     memcpy(&amf_ue->nr_tai, &target_ue->saved.nr_tai, sizeof(ogs_5gs_tai_t));
2657
     memcpy(&amf_ue->nr_cgi, &target_ue->saved.nr_cgi, sizeof(ogs_nr_cgi_t));
2658
 
2659
-    ogs_assert(OGS_OK ==
2660
-        ngap_send_ran_ue_context_release_command(source_ue,
2661
+    r = ngap_send_ran_ue_context_release_command(source_ue,
2662
             NGAP_Cause_PR_radioNetwork,
2663
             NGAP_CauseRadioNetwork_successful_handover,
2664
             NGAP_UE_CTX_REL_NG_HANDOVER_COMPLETE,
2665
-            ogs_app()->time.handover.duration));
2666
+            ogs_app()->time.handover.duration);
2667
+    ogs_expect(r == OGS_OK);
2668
+    ogs_assert(r != OGS_ERROR);
2669
 
2670
     ogs_list_for_each(&amf_ue->sess_list, sess) {
2671
         memset(&param, 0, sizeof(param));
2672
@@ -3825,7 +4022,7 @@
2673
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
2674
 {
2675
     char bufOGS_ADDRSTRLEN;
2676
-    int i, j, k;
2677
+    int i, j, k, r;
2678
 
2679
     NGAP_InitiatingMessage_t *initiatingMessage = NULL;
2680
     NGAP_RANConfigurationUpdate_t *RANConfigurationUpdate = NULL;
2681
@@ -3875,8 +4072,9 @@
2682
             ogs_error("No globalGNB_ID");
2683
             group = NGAP_Cause_PR_protocol;
2684
             cause = NGAP_CauseProtocol_semantic_error;
2685
-            ogs_assert(OGS_OK ==
2686
-                ngap_send_ran_configuration_update_failure(gnb, group, cause));
2687
+            r = ngap_send_ran_configuration_update_failure(gnb, group, cause);
2688
+            ogs_expect(r == OGS_OK);
2689
+            ogs_assert(r != OGS_ERROR);
2690
             return;
2691
         }
2692
 
2693
@@ -3901,9 +4099,10 @@
2694
                 ogs_error("No SupportedTAItem");
2695
                 group = NGAP_Cause_PR_protocol;
2696
                 cause = NGAP_CauseProtocol_semantic_error;
2697
-                ogs_assert(OGS_OK ==
2698
-                    ngap_send_ran_configuration_update_failure(
2699
-                        gnb, group, cause));
2700
+                r = ngap_send_ran_configuration_update_failure(
2701
+                        gnb, group, cause);
2702
+                ogs_expect(r == OGS_OK);
2703
+                ogs_assert(r != OGS_ERROR);
2704
                 return;
2705
             }
2706
 
2707
@@ -3927,9 +4126,10 @@
2708
                     ogs_error("No BroadcastPLMNItem");
2709
                     group = NGAP_Cause_PR_protocol;
2710
                     cause = NGAP_CauseProtocol_semantic_error;
2711
-                    ogs_assert(OGS_OK ==
2712
-                        ngap_send_ran_configuration_update_failure(
2713
-                            gnb, group, cause));
2714
+                    r = ngap_send_ran_configuration_update_failure(
2715
+                            gnb, group, cause);
2716
+                    ogs_expect(r == OGS_OK);
2717
+                    ogs_assert(r != OGS_ERROR);
2718
                     return;
2719
                 }
2720
 
2721
@@ -3960,9 +4160,10 @@
2722
                         ogs_error("No SliceSupportItem");
2723
                         group = NGAP_Cause_PR_protocol;
2724
                         cause = NGAP_CauseProtocol_semantic_error;
2725
-                        ogs_assert(OGS_OK ==
2726
-                            ngap_send_ran_configuration_update_failure(
2727
-                                gnb, group, cause));
2728
+                        r = ngap_send_ran_configuration_update_failure(
2729
+                                gnb, group, cause);
2730
+                        ogs_expect(r == OGS_OK);
2731
+                        ogs_assert(r != OGS_ERROR);
2732
                         return;
2733
                     }
2734
 
2735
@@ -4001,8 +4202,9 @@
2736
             cause =
2737
                 NGAP_CauseProtocol_message_not_compatible_with_receiver_state;
2738
 
2739
-            ogs_assert(OGS_OK ==
2740
-                ngap_send_ran_configuration_update_failure(gnb, group, cause));
2741
+            r = ngap_send_ran_configuration_update_failure(gnb, group, cause);
2742
+            ogs_expect(r == OGS_OK);
2743
+            ogs_assert(r != OGS_ERROR);
2744
             return;
2745
         }
2746
 
2747
@@ -4013,8 +4215,9 @@
2748
             group = NGAP_Cause_PR_misc;
2749
             cause = NGAP_CauseMisc_unknown_PLMN_or_SNPN;
2750
 
2751
-            ogs_assert(OGS_OK ==
2752
-                ngap_send_ran_configuration_update_failure(gnb, group, cause));
2753
+            r = ngap_send_ran_configuration_update_failure(gnb, group, cause);
2754
+            ogs_expect(r == OGS_OK);
2755
+            ogs_assert(r != OGS_ERROR);
2756
             return;
2757
         }
2758
 
2759
@@ -4025,8 +4228,9 @@
2760
             group = NGAP_Cause_PR_radioNetwork;
2761
             cause = NGAP_CauseRadioNetwork_slice_not_supported;
2762
 
2763
-            ogs_assert(OGS_OK ==
2764
-                ngap_send_ran_configuration_update_failure(gnb, group, cause));
2765
+            r = ngap_send_ran_configuration_update_failure(gnb, group, cause);
2766
+            ogs_expect(r == OGS_OK);
2767
+            ogs_assert(r != OGS_ERROR);
2768
             return;
2769
         }
2770
     }
2771
@@ -4034,15 +4238,14 @@
2772
     if (PagingDRX)
2773
         ogs_debug("    PagingDRX%ld", *PagingDRX);
2774
 
2775
-    ogs_assert(OGS_OK ==
2776
-        ngap_send_ran_configuration_update_ack(gnb));
2777
+    ogs_expect(OGS_OK == ngap_send_ran_configuration_update_ack(gnb));
2778
 }
2779
 
2780
 void ngap_handle_ng_reset(
2781
         amf_gnb_t *gnb, ogs_ngap_message_t *message)
2782
 {
2783
     char bufOGS_ADDRSTRLEN;
2784
-    int i, old_xact_count = 0, new_xact_count = 0;
2785
+    int i, r, old_xact_count = 0, new_xact_count = 0;
2786
 
2787
     NGAP_InitiatingMessage_t *initiatingMessage = NULL;
2788
     NGAP_NGReset_t *NGReset = NULL;
2789
@@ -4084,9 +4287,10 @@
2790
 
2791
     if (!Cause) {
2792
         ogs_error("No Cause");
2793
-        ogs_assert(OGS_OK ==
2794
-            ngap_send_error_indication(gnb, NULL, NULL,
2795
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2796
+        r = ngap_send_error_indication(gnb, NULL, NULL,
2797
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2798
+        ogs_expect(r == OGS_OK);
2799
+        ogs_assert(r != OGS_ERROR);
2800
         return;
2801
     }
2802
 
2803
@@ -4095,9 +4299,10 @@
2804
 
2805
     if (!ResetType) {
2806
         ogs_error("No ResetType");
2807
-        ogs_assert(OGS_OK ==
2808
-            ngap_send_error_indication(gnb, NULL, NULL,
2809
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
2810
+        r = ngap_send_error_indication(gnb, NULL, NULL,
2811
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
2812
+        ogs_expect(r == OGS_OK);
2813
+        ogs_assert(r != OGS_ERROR);
2814
         return;
2815
     }
2816
 
2817
@@ -4137,9 +4342,11 @@
2818
      * for new UE-associated logical NG-connections over the NG interface,
2819
      * the AMF shall respond with the NG RESET ACKNOWLEDGE message.
2820
      */
2821
-        if (ogs_list_count(&gnb->ran_ue_list) == 0)
2822
-            ogs_assert(OGS_OK ==
2823
-                ngap_send_ng_reset_ack(gnb, NULL));
2824
+        if (ogs_list_count(&gnb->ran_ue_list) == 0) {
2825
+            r = ngap_send_ng_reset_ack(gnb, NULL);
2826
+            ogs_expect(r == OGS_OK);
2827
+            ogs_assert(r != OGS_ERROR);
2828
+        }
2829
 
2830
         break;
2831
 
2832
@@ -4153,7 +4360,10 @@
2833
             ogs_pkbuf_free(gnb->ng_reset_ack);
2834
 
2835
         gnb->ng_reset_ack = ogs_ngap_build_ng_reset_ack(partOfNG_Interface);
2836
-        ogs_expect_or_return(gnb->ng_reset_ack);
2837
+        if (!gnb->ng_reset_ack) {
2838
+            ogs_error("ogs_ngap_build_ng_reset_ack() failed");
2839
+            return;
2840
+        }
2841
 
2842
         for (i = 0; i < partOfNG_Interface->list.count; i++) {
2843
             NGAP_UE_associatedLogicalNG_connectionItem_t *item = NULL;
2844
@@ -4246,8 +4456,9 @@
2845
          * where PartOfNG_interface was requested
2846
          * REMOVED */
2847
         ogs_assert(gnb->ng_reset_ack);
2848
-        ogs_expect(OGS_OK ==
2849
-            ngap_send_to_gnb(gnb, gnb->ng_reset_ack, NGAP_NON_UE_SIGNALLING));
2850
+        r = ngap_send_to_gnb(gnb, gnb->ng_reset_ack, NGAP_NON_UE_SIGNALLING);
2851
+        ogs_expect(r == OGS_OK);
2852
+        ogs_assert(r != OGS_ERROR);
2853
 
2854
         /* Clear NG-Reset Ack Buffer */
2855
         gnb->ng_reset_ack = NULL;
2856
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/ngap-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/ngap-path.c Changed
337
 
1
@@ -54,16 +54,16 @@
2
 
3
     gnb = amf_gnb_cycle(gnb);
4
     if (!gnb) {
5
-        ogs_warn("gNB has already been removed");
6
+        ogs_error("gNB has already been removed");
7
         ogs_pkbuf_free(pkbuf);
8
-        return OGS_ERROR;
9
+        return OGS_NOTFOUND;
10
     }
11
 
12
     ogs_assert(gnb->sctp.sock);
13
     if (gnb->sctp.sock->fd == INVALID_SOCKET) {
14
-        ogs_fatal("gNB SCTP socket has already been destroyed");
15
+        ogs_error("gNB SCTP socket has already been destroyed");
16
         ogs_log_hexdump(OGS_LOG_FATAL, pkbuf->data, pkbuf->len);
17
-        ogs_assert_if_reached();
18
+        ogs_pkbuf_free(pkbuf);
19
         return OGS_ERROR;
20
     }
21
 
22
@@ -83,16 +83,20 @@
23
 
24
 int ngap_send_to_ran_ue(ran_ue_t *ran_ue, ogs_pkbuf_t *pkbuf)
25
 {
26
+    int rv;
27
     ogs_assert(pkbuf);
28
 
29
     ran_ue = ran_ue_cycle(ran_ue);
30
     if (!ran_ue) {
31
-        ogs_warn("NG context has already been removed");
32
+        ogs_error("NG context has already been removed");
33
         ogs_pkbuf_free(pkbuf);
34
-        return OGS_ERROR;
35
+        return OGS_NOTFOUND;
36
     }
37
 
38
-    return ngap_send_to_gnb(ran_ue->gnb, pkbuf, ran_ue->gnb_ostream_id);
39
+    rv = ngap_send_to_gnb(ran_ue->gnb, pkbuf, ran_ue->gnb_ostream_id);
40
+    ogs_expect(rv == OGS_OK);
41
+
42
+    return rv;
43
 }
44
 
45
 int ngap_delayed_send_to_ran_ue(
46
@@ -117,10 +121,10 @@
47
 
48
         return OGS_OK;
49
     } else {
50
-        amf_gnb_t *gnb = NULL;
51
-        gnb = ran_ue->gnb;
52
-        ogs_assert(gnb);
53
-        return ngap_send_to_ran_ue(ran_ue, pkbuf);
54
+        int rv = ngap_send_to_ran_ue(ran_ue, pkbuf);
55
+        ogs_expect(rv == OGS_OK);
56
+
57
+        return rv;
58
     }
59
 }
60
 
61
@@ -149,6 +153,8 @@
62
 int ngap_send_to_nas(ran_ue_t *ran_ue,
63
         NGAP_ProcedureCode_t procedureCode, NGAP_NAS_PDU_t *nasPdu)
64
 {
65
+    int rv;
66
+
67
     ogs_nas_5gs_security_header_t *sh = NULL;
68
     ogs_nas_security_header_type_t security_header_type;
69
 
70
@@ -211,7 +217,6 @@
71
     ogs_assert(h);
72
     if (h->extended_protocol_discriminator ==
73
             OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM) {
74
-        int rv;
75
         e = amf_event_new(AMF_EVENT_5GMM_MESSAGE);
76
         if (!e) {
77
             ogs_error("ngap_send_to_nas() failed");
78
@@ -237,7 +242,10 @@
79
             ogs_pkbuf_free(nasbuf);
80
             return OGS_ERROR;
81
         }
82
-        return ngap_send_to_5gsm(amf_ue, nasbuf);
83
+        rv = ngap_send_to_5gsm(amf_ue, nasbuf);
84
+        ogs_expect(rv == OGS_OK);
85
+
86
+        return rv;
87
     } else {
88
         ogs_error("Unknown NAS Protocol discriminator 0x%02x",
89
                   h->extended_protocol_discriminator);
90
@@ -253,7 +261,10 @@
91
 
92
     ogs_debug("NG-Setup response");
93
     ngap_buffer = ngap_build_ng_setup_response();
94
-    ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
95
+    if (!ngap_buffer) {
96
+        ogs_error("ngap_build_ng_setup_response() failed");
97
+        return OGS_ERROR;
98
+    }
99
 
100
     rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
101
     ogs_expect(rv == OGS_OK);
102
@@ -270,7 +281,10 @@
103
     ogs_debug("NG-Setup failure");
104
     ngap_buffer = ngap_build_ng_setup_failure(
105
             group, cause, NGAP_TimeToWait_v10s);
106
-    ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
107
+    if (!ngap_buffer) {
108
+        ogs_error("ngap_build_ng_setup_failure() failed");
109
+        return OGS_ERROR;
110
+    }
111
 
112
     rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
113
     ogs_expect(rv == OGS_OK);
114
@@ -285,7 +299,10 @@
115
 
116
     ogs_debug("RANConfigurationUpdateAcknowledge");
117
     ngap_buffer = ngap_build_ran_configuration_update_ack();
118
-    ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
119
+    if (!ngap_buffer) {
120
+        ogs_error("ngap_build_ran_configuration_update_ack() failed");
121
+        return OGS_ERROR;
122
+    }
123
 
124
     rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
125
     ogs_expect(rv == OGS_OK);
126
@@ -302,7 +319,10 @@
127
     ogs_debug("RANConfigurationUpdateFailure");
128
     ngap_buffer = ngap_build_ran_configuration_update_failure(
129
             group, cause, NGAP_TimeToWait_v10s);
130
-    ogs_expect_or_return_val(ngap_buffer, OGS_ERROR);
131
+    if (!ngap_buffer) {
132
+        ogs_error("ngap_build_ran_configuration_update_failure() failed");
133
+        return OGS_ERROR;
134
+    }
135
 
136
     rv = ngap_send_to_gnb(gnb, ngap_buffer, NGAP_NON_UE_SIGNALLING);
137
     ogs_expect(rv == OGS_OK);
138
@@ -330,7 +350,10 @@
139
             group, (int)cause, action, (int)duration);
140
 
141
     ngapbuf = ngap_build_ue_context_release_command(ran_ue, group, cause);
142
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
143
+    if (!ngapbuf) {
144
+        ogs_error("ngap_build_ue_context_release_command() failed");
145
+        return OGS_ERROR;
146
+    }
147
 
148
     rv = ngap_delayed_send_to_ran_ue(ran_ue, ngapbuf, duration);
149
     ogs_expect(rv == OGS_OK);
150
@@ -345,21 +368,15 @@
151
     amf_ue_t *amf_ue, NGAP_Cause_PR group, long cause,
152
     uint8_t action, ogs_time_t duration)
153
 {
154
+    int rv;
155
     ogs_assert(amf_ue);
156
 
157
-    ran_ue_t *ran_ue = ran_ue_cycle(amf_ue->ran_ue);
158
-    if (ran_ue) {
159
-        ogs_assert(OGS_OK ==
160
-            ngap_send_ran_ue_context_release_command(ran_ue,
161
-                group, cause, action, duration));
162
-        ogs_debug("    SUPI%s", amf_ue->supi);
163
-    } else {
164
-        ogs_error("%s No NG Context - "
165
-                "Group%d Cause%d Action%d Duration%d",
166
-                amf_ue->supi, group, (int)cause, action, (int)duration);
167
-    }
168
+    rv = ngap_send_ran_ue_context_release_command(
169
+            amf_ue->ran_ue, group, cause, action, duration);
170
+    ogs_expect(rv == OGS_OK);
171
+    ogs_debug("    SUPI%s", amf_ue->supi);
172
 
173
-    return OGS_OK;
174
+    return rv;
175
 }
176
 
177
 int ngap_send_paging(amf_ue_t *amf_ue)
178
@@ -383,14 +400,23 @@
179
                         ngapbuf = amf_ue->t3513.pkbuf;
180
                     } else {
181
                         ngapbuf = ngap_build_paging(amf_ue);
182
-                        ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
183
+                        if (!ngapbuf) {
184
+                            ogs_error("ngap_build_paging() failed");
185
+                            return OGS_ERROR;
186
+                        }
187
                     }
188
 
189
                     amf_ue->t3513.pkbuf = ogs_pkbuf_copy(ngapbuf);
190
-                    ogs_expect_or_return_val(amf_ue->t3513.pkbuf, OGS_ERROR);
191
+                    if (!amf_ue->t3513.pkbuf) {
192
+                        ogs_error("ogs_pkbuf_copy() failed");
193
+                        return OGS_ERROR;
194
+                    }
195
 
196
                     rv = ngap_send_to_gnb(gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
197
-                    ogs_expect_or_return_val(rv == OGS_OK, rv);
198
+                    if (rv != OGS_OK) {
199
+                        ogs_error("ngap_send_to_gnb() failed");
200
+                        return rv;
201
+                    }
202
                 }
203
             }
204
         }
205
@@ -413,7 +439,10 @@
206
     ogs_assert(transfer);
207
 
208
     ngapbuf = ngap_build_downlink_ran_configuration_transfer(transfer);
209
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
210
+    if (!ngapbuf) {
211
+        ogs_error("ngap_build_downlink_ran_configuration_transfer() failed");
212
+        return OGS_ERROR;
213
+    }
214
 
215
     rv = ngap_send_to_gnb(target_gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
216
     ogs_expect(rv == OGS_OK);
217
@@ -433,7 +462,10 @@
218
     ogs_assert(amf_ue);
219
 
220
     ngapbuf = ngap_build_path_switch_ack(amf_ue);
221
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
222
+    if (!ngapbuf) {
223
+        ogs_error("ngap_build_path_switch_ack() failed");
224
+        return OGS_ERROR;
225
+    }
226
 
227
     rv = nas_5gs_send_to_gnb(amf_ue, ngapbuf);
228
     ogs_expect(rv == OGS_OK);
229
@@ -456,7 +488,10 @@
230
     ogs_assert(target_ue);
231
 
232
     ngapbuf = ngap_build_handover_request(target_ue);
233
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
234
+    if (!ngapbuf) {
235
+        ogs_error("ngap_build_handover_request() failed");
236
+        return OGS_ERROR;
237
+    }
238
 
239
     rv = ngap_send_to_ran_ue(target_ue, ngapbuf);
240
     ogs_expect(rv == OGS_OK);
241
@@ -474,7 +509,10 @@
242
     ogs_assert(cause);
243
 
244
     ngapbuf = ngap_build_handover_preparation_failure(source_ue, cause);
245
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
246
+    if (!ngapbuf) {
247
+        ogs_error("ngap_build_handover_preparation_failure() failed");
248
+        return OGS_ERROR;
249
+    }
250
 
251
     rv = ngap_send_to_ran_ue(source_ue, ngapbuf);
252
     ogs_expect(rv == OGS_OK);
253
@@ -494,7 +532,10 @@
254
     ogs_assert(source_ue);
255
 
256
     ngapbuf = ngap_build_handover_command(source_ue);
257
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
258
+    if (!ngapbuf) {
259
+        ogs_error("ngap_build_handover_command() failed");
260
+        return OGS_ERROR;
261
+    }
262
 
263
     rv = ngap_send_to_ran_ue(source_ue, ngapbuf);
264
     ogs_expect(rv == OGS_OK);
265
@@ -510,7 +551,10 @@
266
     ogs_assert(source_ue);
267
 
268
     ngapbuf = ngap_build_handover_cancel_ack(source_ue);
269
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
270
+    if (!ngapbuf) {
271
+        ogs_error("ngap_build_handover_cancel_ack() failed");
272
+        return OGS_ERROR;
273
+    }
274
 
275
     rv = ngap_send_to_ran_ue(source_ue, ngapbuf);
276
     ogs_expect(rv == OGS_OK);
277
@@ -529,7 +573,10 @@
278
     ogs_assert(transfer);
279
 
280
     ngapbuf = ngap_build_uplink_ran_status_transfer(target_ue, transfer);
281
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
282
+    if (!ngapbuf) {
283
+        ogs_error("ngap_build_uplink_ran_status_transfer() failed");
284
+        return OGS_ERROR;
285
+    }
286
 
287
     rv = ngap_send_to_ran_ue(target_ue, ngapbuf);
288
     ogs_expect(rv == OGS_OK);
289
@@ -550,7 +597,10 @@
290
 
291
     ngapbuf = ogs_ngap_build_error_indication(
292
             ran_ue_ngap_id, amf_ue_ngap_id, group, cause);
293
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
294
+    if (!ngapbuf) {
295
+        ogs_error("ogs_ngap_build_error_indication() failed");
296
+        return OGS_ERROR;
297
+    }
298
 
299
     rv = ngap_send_to_gnb(gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
300
     ogs_expect(rv == OGS_OK);
301
@@ -562,17 +612,18 @@
302
         amf_ue_t *amf_ue, NGAP_Cause_PR group, long cause)
303
 {
304
     int rv;
305
-    amf_gnb_t *gnb;
306
     ran_ue_t *ran_ue;
307
 
308
     ogs_assert(amf_ue);
309
     ran_ue = ran_ue_cycle(amf_ue->ran_ue);
310
-    ogs_expect_or_return_val(ran_ue, OGS_ERROR);
311
-    gnb = ran_ue->gnb;
312
-    ogs_expect_or_return_val(gnb, OGS_ERROR);
313
+    if (!ran_ue) {
314
+        ogs_error("NG context has already been removed");
315
+        return OGS_NOTFOUND;
316
+    }
317
 
318
     rv = ngap_send_error_indication(
319
-        gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id, group, cause);
320
+        ran_ue->gnb, &ran_ue->ran_ue_ngap_id, &ran_ue->amf_ue_ngap_id,
321
+        group, cause);
322
     ogs_expect(rv == OGS_OK);
323
 
324
     return rv;
325
@@ -588,7 +639,10 @@
326
     ogs_assert(gnb);
327
 
328
     ngapbuf = ogs_ngap_build_ng_reset_ack(partOfNG_Interface);
329
-    ogs_expect_or_return_val(ngapbuf, OGS_ERROR);
330
+    if (!ngapbuf) {
331
+        ogs_error("ogs_ngap_build_ng_reset_ack() failed");
332
+        return OGS_ERROR;
333
+    }
334
 
335
     rv = ngap_send_to_gnb(gnb, ngapbuf, NGAP_NON_UE_SIGNALLING);
336
     ogs_expect(rv == OGS_OK);
337
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/ngap-path.h -> open5gs_2.5.5.101.6895.tar.xz/src/amf/ngap-path.h Changed
10
 
1
@@ -35,8 +35,6 @@
2
 
3
 ogs_sock_t *ngap_server(ogs_socknode_t *node);
4
 void ngap_recv_upcall(short when, ogs_socket_t fd, void *data);
5
-int ngap_send(ogs_sock_t *sock,
6
-        ogs_pkbuf_t *pkbuf, ogs_sockaddr_t *addr, uint16_t stream_no);
7
 
8
 int ngap_send_to_gnb(
9
         amf_gnb_t *gnb, ogs_pkbuf_t *pkb, uint16_t stream_no);
10
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/ngap-sm.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/ngap-sm.c Changed
22
 
1
@@ -39,6 +39,8 @@
2
 
3
 void ngap_state_operational(ogs_fsm_t *s, amf_event_t *e)
4
 {
5
+    int r;
6
+
7
     amf_gnb_t *gnb = NULL;
8
     ogs_pkbuf_t *pkbuf = NULL;
9
 
10
@@ -192,7 +194,10 @@
11
             ogs_assert(e->ran_ue);
12
             ogs_assert(e->pkbuf);
13
 
14
-            ogs_expect(OGS_OK == ngap_send_to_ran_ue(e->ran_ue, e->pkbuf));
15
+            r = ngap_send_to_ran_ue(e->ran_ue, e->pkbuf);
16
+            ogs_expect(r == OGS_OK);
17
+            ogs_assert(r != OGS_ERROR);
18
+
19
             ogs_timer_delete(e->timer);
20
             break;
21
         default:
22
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/nnrf-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/nnrf-handler.c Changed
48
 
1
@@ -25,6 +25,8 @@
2
 void amf_nnrf_handle_nf_discover(
3
         ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg)
4
 {
5
+    int r;
6
+
7
     ogs_sbi_nf_instance_t *nf_instance = NULL;
8
     ogs_sbi_object_t *sbi_object = NULL;
9
     ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
10
@@ -68,9 +70,10 @@
11
             ogs_assert(amf_ue);
12
             ogs_error("%s (NF discover) No %s", amf_ue->suci,
13
                         ogs_sbi_service_type_to_name(service_type));
14
-            ogs_assert(OGS_OK ==
15
-                nas_5gs_send_gmm_reject_from_sbi(amf_ue,
16
-                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
17
+            r = nas_5gs_send_gmm_reject_from_sbi(amf_ue,
18
+                    OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
19
+            ogs_expect(r == OGS_OK);
20
+            ogs_assert(r != OGS_ERROR);
21
             break;
22
         case OGS_SBI_OBJ_SESS_TYPE:
23
             sess = (amf_sess_t *)sbi_object;
24
@@ -82,15 +85,17 @@
25
             ogs_error("%d:%d (NF discover) No %s", sess->psi, sess->pti,
26
                         ogs_sbi_service_type_to_name(service_type));
27
             if (sess->payload_container_type) {
28
-                ogs_assert(OGS_OK ==
29
-                    nas_5gs_send_back_gsm_message(sess,
30
+                r = nas_5gs_send_back_gsm_message(sess,
31
                         OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
32
-                        AMF_NAS_BACKOFF_TIME));
33
+                        AMF_NAS_BACKOFF_TIME);
34
+                ogs_expect(r == OGS_OK);
35
+                ogs_assert(r != OGS_ERROR);
36
             } else {
37
-                ogs_assert(OGS_OK ==
38
-                    ngap_send_error_indication2(amf_ue,
39
+                r = ngap_send_error_indication2(amf_ue,
40
                         NGAP_Cause_PR_transport,
41
-                        NGAP_CauseTransport_transport_resource_unavailable));
42
+                        NGAP_CauseTransport_transport_resource_unavailable);
43
+                ogs_expect(r == OGS_OK);
44
+                ogs_assert(r != OGS_ERROR);
45
             }
46
             break;
47
         default:
48
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/nnssf-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/nnssf-handler.c Changed
73
 
1
@@ -25,6 +25,7 @@
2
         amf_sess_t *sess, ogs_sbi_message_t *recvmsg)
3
 {
4
     bool rc;
5
+    int r;
6
     OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;
7
     ogs_sbi_client_t *client = NULL, *scp_client = NULL;
8
     ogs_sockaddr_t *addr = NULL;
9
@@ -44,34 +45,38 @@
10
     if (recvmsg->res_status != OGS_SBI_HTTP_STATUS_OK) {
11
         ogs_error("%s HTTP response error %d",
12
                 amf_ue->supi, recvmsg->res_status);
13
-        ogs_assert(OGS_OK ==
14
-            nas_5gs_send_gmm_status(amf_ue, recvmsg->res_status));
15
+        r = nas_5gs_send_gmm_status(amf_ue, recvmsg->res_status);
16
+        ogs_expect(r == OGS_OK);
17
+        ogs_assert(r != OGS_ERROR);
18
         return OGS_ERROR;
19
     }
20
 
21
     AuthorizedNetworkSliceInfo = recvmsg->AuthorizedNetworkSliceInfo;
22
     if (!AuthorizedNetworkSliceInfo) {
23
         ogs_error("No AuthorizedNetworkSliceInfo");
24
-        ogs_assert(OGS_OK ==
25
-            nas_5gs_send_gmm_reject_from_sbi(
26
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
27
+        r = nas_5gs_send_gmm_reject_from_sbi(
28
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
29
+        ogs_expect(r == OGS_OK);
30
+        ogs_assert(r != OGS_ERROR);
31
         return OGS_ERROR;
32
     }
33
 
34
     NsiInformation = AuthorizedNetworkSliceInfo->nsi_information;
35
     if (!NsiInformation) {
36
         ogs_error("No NsiInformation");
37
-        ogs_assert(OGS_OK ==
38
-            nas_5gs_send_gmm_reject_from_sbi(
39
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
40
+        r = nas_5gs_send_gmm_reject_from_sbi(
41
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
42
+        ogs_expect(r == OGS_OK);
43
+        ogs_assert(r != OGS_ERROR);
44
         return OGS_ERROR;
45
     }
46
 
47
     if (!NsiInformation->nrf_id) {
48
         ogs_error("No nrfId");
49
-        ogs_assert(OGS_OK ==
50
-            nas_5gs_send_gmm_reject_from_sbi(
51
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
52
+        r = nas_5gs_send_gmm_reject_from_sbi(
53
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
54
+        ogs_expect(r == OGS_OK);
55
+        ogs_assert(r != OGS_ERROR);
56
         return OGS_ERROR;
57
     }
58
 
59
@@ -97,9 +102,10 @@
60
         if (rc == false || scheme == OpenAPI_uri_scheme_NULL) {
61
             ogs_error("%s:%d Invalid URI %s",
62
                     amf_ue->supi, sess->psi, NsiInformation->nrf_id);
63
-            ogs_assert(OGS_OK ==
64
-                nas_5gs_send_gmm_reject_from_sbi(
65
-                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
66
+            r = nas_5gs_send_gmm_reject_from_sbi(
67
+                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
68
+            ogs_expect(r == OGS_OK);
69
+            ogs_assert(r != OGS_ERROR);
70
             return OGS_ERROR;;
71
         }
72
 
73
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/npcf-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/npcf-handler.c Changed
87
 
1
@@ -25,7 +25,7 @@
2
 int amf_npcf_am_policy_control_handle_create(
3
         amf_ue_t *amf_ue, ogs_sbi_message_t *recvmsg)
4
 {
5
-    int rv;
6
+    int r, rv;
7
 
8
     uint64_t supported_features;
9
 
10
@@ -38,33 +38,37 @@
11
     if (recvmsg->res_status != OGS_SBI_HTTP_STATUS_CREATED) {
12
         ogs_error("%s HTTP response error %d",
13
                 amf_ue->supi, recvmsg->res_status);
14
-        ogs_assert(OGS_OK ==
15
-            nas_5gs_send_gmm_reject_from_sbi(amf_ue, recvmsg->res_status));
16
+        r = nas_5gs_send_gmm_reject_from_sbi(amf_ue, recvmsg->res_status);
17
+        ogs_expect(r == OGS_OK);
18
+        ogs_assert(r != OGS_ERROR);
19
         return OGS_ERROR;
20
     }
21
 
22
     if (!recvmsg->http.location) {
23
         ogs_error("%s No http.location", amf_ue->supi);
24
-        ogs_assert(OGS_OK ==
25
-            nas_5gs_send_gmm_reject_from_sbi(
26
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
27
+        r = nas_5gs_send_gmm_reject_from_sbi(
28
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
29
+        ogs_expect(r == OGS_OK);
30
+        ogs_assert(r != OGS_ERROR);
31
         return OGS_ERROR;
32
     }
33
 
34
     PolicyAssociation = recvmsg->PolicyAssociation;
35
     if (!PolicyAssociation) {
36
         ogs_error("No PolicyAssociation");
37
-        ogs_assert(OGS_OK ==
38
-            nas_5gs_send_gmm_reject_from_sbi(
39
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
40
+        r = nas_5gs_send_gmm_reject_from_sbi(
41
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
42
+        ogs_expect(r == OGS_OK);
43
+        ogs_assert(r != OGS_ERROR);
44
         return OGS_ERROR;
45
     }
46
 
47
     if (!PolicyAssociation->supp_feat) {
48
         ogs_error("No suppFeat");
49
-        ogs_assert(OGS_OK ==
50
-            nas_5gs_send_gmm_reject_from_sbi(
51
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
52
+        r = nas_5gs_send_gmm_reject_from_sbi(
53
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
54
+        ogs_expect(r == OGS_OK);
55
+        ogs_assert(r != OGS_ERROR);
56
         return OGS_ERROR;
57
     }
58
 
59
@@ -75,9 +79,10 @@
60
     if (rv != OGS_OK) {
61
         ogs_error("%s Cannot parse http.location %s",
62
                 amf_ue->supi, recvmsg->http.location);
63
-        ogs_assert(OGS_OK ==
64
-            nas_5gs_send_gmm_reject_from_sbi(
65
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
66
+        r = nas_5gs_send_gmm_reject_from_sbi(
67
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
68
+        ogs_expect(r == OGS_OK);
69
+        ogs_assert(r != OGS_ERROR);
70
         return OGS_ERROR;
71
     }
72
 
73
@@ -86,9 +91,10 @@
74
                 amf_ue->supi, recvmsg->http.location);
75
 
76
         ogs_sbi_header_free(&header);
77
-        ogs_assert(OGS_OK ==
78
-            nas_5gs_send_gmm_reject_from_sbi(
79
-                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
80
+        r = nas_5gs_send_gmm_reject_from_sbi(
81
+                amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
82
+        ogs_expect(r == OGS_OK);
83
+        ogs_assert(r != OGS_ERROR);
84
         return OGS_ERROR;
85
     }
86
 
87
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/nsmf-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/nsmf-handler.c Changed
565
 
1
@@ -27,7 +27,7 @@
2
 int amf_nsmf_pdusession_handle_create_sm_context(
3
         amf_sess_t *sess, ogs_sbi_message_t *recvmsg)
4
 {
5
-    int rv;
6
+    int rv, r;
7
 
8
     ogs_assert(sess);
9
     ogs_assert(recvmsg);
10
@@ -38,10 +38,11 @@
11
 
12
         if (!recvmsg->http.location) {
13
             ogs_error("%d:%d No http.location", sess->psi, sess->pti);
14
-            ogs_assert(OGS_OK ==
15
-                nas_5gs_send_back_gsm_message(sess,
16
+            r = nas_5gs_send_back_gsm_message(sess,
17
                     OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
18
-                    AMF_NAS_BACKOFF_TIME));
19
+                    AMF_NAS_BACKOFF_TIME);
20
+            ogs_expect(r == OGS_OK);
21
+            ogs_assert(r != OGS_ERROR);
22
 
23
             return OGS_ERROR;
24
         }
25
@@ -53,10 +54,11 @@
26
         if (rv != OGS_OK) {
27
             ogs_error("%d:%d Cannot parse http.location %s",
28
                     sess->psi, sess->pti, recvmsg->http.location);
29
-            ogs_assert(OGS_OK ==
30
-                nas_5gs_send_back_gsm_message(sess,
31
+            r = nas_5gs_send_back_gsm_message(sess,
32
                     OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
33
-                    AMF_NAS_BACKOFF_TIME));
34
+                    AMF_NAS_BACKOFF_TIME);
35
+            ogs_expect(r == OGS_OK);
36
+            ogs_assert(r != OGS_ERROR);
37
 
38
             return OGS_ERROR;
39
         }
40
@@ -66,10 +68,11 @@
41
                     sess->psi, sess->pti, recvmsg->http.location);
42
 
43
             ogs_sbi_header_free(&header);
44
-            ogs_assert(OGS_OK ==
45
-                nas_5gs_send_back_gsm_message(sess,
46
+            r = nas_5gs_send_back_gsm_message(sess,
47
                     OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
48
-                    AMF_NAS_BACKOFF_TIME));
49
+                    AMF_NAS_BACKOFF_TIME);
50
+            ogs_expect(r == OGS_OK);
51
+            ogs_assert(r != OGS_ERROR);
52
 
53
             return OGS_ERROR;
54
         }
55
@@ -86,7 +89,7 @@
56
             amf_ue_t *amf_ue = sess->amf_ue;
57
             ogs_assert(amf_ue);
58
 
59
-            rv = nas_5gs_send_to_gnb(amf_ue,
60
+            r = nas_5gs_send_to_gnb(amf_ue,
61
                     sess->pdu_session_establishment_accept);
62
 
63
             sess->pdu_session_establishment_accept = NULL;
64
@@ -96,10 +99,11 @@
65
                         sess->psi, sess->pti);
66
 
67
                 ogs_sbi_header_free(&header);
68
-                ogs_assert(OGS_OK ==
69
-                    nas_5gs_send_back_gsm_message(sess,
70
+                r = nas_5gs_send_back_gsm_message(sess,
71
                         OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
72
-                        AMF_NAS_BACKOFF_TIME));
73
+                        AMF_NAS_BACKOFF_TIME);
74
+                ogs_expect(r == OGS_OK);
75
+                ogs_assert(r != OGS_ERROR);
76
 
77
                 return OGS_ERROR;
78
             }
79
@@ -120,19 +124,21 @@
80
         SmContextCreateError = recvmsg->SmContextCreateError;
81
         if (!SmContextCreateError) {
82
             ogs_error("%d:%d No SmContextCreateError", sess->psi, sess->pti);
83
-            ogs_assert(OGS_OK ==
84
-                nas_5gs_send_back_gsm_message(sess,
85
+            r = nas_5gs_send_back_gsm_message(sess,
86
                     OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
87
-                    AMF_NAS_BACKOFF_TIME));
88
+                    AMF_NAS_BACKOFF_TIME);
89
+            ogs_expect(r == OGS_OK);
90
+            ogs_assert(r != OGS_ERROR);
91
 
92
             return OGS_ERROR;
93
         }
94
         if (!SmContextCreateError->error) {
95
             ogs_error("%d:%d No Error", sess->psi, sess->pti);
96
-            ogs_assert(OGS_OK ==
97
-                nas_5gs_send_back_gsm_message(sess,
98
+            r = nas_5gs_send_back_gsm_message(sess,
99
                     OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
100
-                    AMF_NAS_BACKOFF_TIME));
101
+                    AMF_NAS_BACKOFF_TIME);
102
+            ogs_expect(r == OGS_OK);
103
+            ogs_assert(r != OGS_ERROR);
104
 
105
             return OGS_ERROR;
106
         }
107
@@ -150,19 +156,21 @@
108
                         sess->psi, sess->pti);
109
                 n1smbuf = ogs_pkbuf_copy(n1smbuf);
110
                 ogs_assert(n1smbuf);
111
-                ogs_assert(OGS_OK ==
112
-                    nas_5gs_send_gsm_reject(sess,
113
-                        OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf));
114
+                r = nas_5gs_send_gsm_reject(sess,
115
+                        OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf);
116
+                ogs_expect(r == OGS_OK);
117
+                ogs_assert(r != OGS_ERROR);
118
 
119
                 return OGS_ERROR;
120
             }
121
         }
122
 
123
         ogs_error("%d:%d 5GMM was not forwarded", sess->psi, sess->pti);
124
-        ogs_assert(OGS_OK ==
125
-            nas_5gs_send_back_gsm_message(sess,
126
+        r = nas_5gs_send_back_gsm_message(sess,
127
                 OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
128
-                AMF_NAS_BACKOFF_TIME));
129
+                AMF_NAS_BACKOFF_TIME);
130
+        ogs_expect(r == OGS_OK);
131
+        ogs_assert(r != OGS_ERROR);
132
 
133
         return OGS_ERROR;
134
     }
135
@@ -173,6 +181,8 @@
136
 int amf_nsmf_pdusession_handle_update_sm_context(
137
         amf_sess_t *sess, int state, ogs_sbi_message_t *recvmsg)
138
 {
139
+    int r;
140
+
141
     amf_ue_t *amf_ue = NULL;
142
     ran_ue_t *ran_ue = NULL;
143
 
144
@@ -239,8 +249,9 @@
145
                                     amf_ue, 0, NULL));
146
                         } else {
147
                             CLEAR_AMF_UE_TIMER(amf_ue->t3550);
148
-                            ogs_assert(OGS_OK ==
149
-                                nas_5gs_send_registration_accept(amf_ue));
150
+                            r = nas_5gs_send_registration_accept(amf_ue);
151
+                            ogs_expect(r == OGS_OK);
152
+                            ogs_assert(r != OGS_ERROR);
153
 
154
                             AMF_UE_CLEAR_N2_TRANSFER(
155
                                     amf_ue, pdu_session_resource_setup_request);
156
@@ -255,8 +266,9 @@
157
                                 AMF_RELEASE_SM_CONTEXT_SERVICE_ACCEPT) &&
158
                         AMF_SESSION_SYNC_DONE(amf_ue,
159
                                 AMF_UPDATE_SM_CONTEXT_SERVICE_REQUEST)) {
160
-                        ogs_assert(OGS_OK ==
161
-                            nas_5gs_send_service_accept(amf_ue));
162
+                        r = nas_5gs_send_service_accept(amf_ue);
163
+                        ogs_expect(r == OGS_OK);
164
+                        ogs_assert(r != OGS_ERROR);
165
 
166
                         AMF_UE_CLEAR_N2_TRANSFER(
167
                                 amf_ue, pdu_session_resource_setup_request);
168
@@ -267,8 +279,9 @@
169
 
170
                     if (AMF_SESSION_SYNC_DONE(amf_ue,
171
                                 AMF_UPDATE_SM_CONTEXT_HANDOVER_REQUIRED)) {
172
-                        ogs_assert(OGS_OK ==
173
-                            ngap_send_handover_request(amf_ue));
174
+                        r = ngap_send_handover_request(amf_ue);
175
+                        ogs_expect(r == OGS_OK);
176
+                        ogs_assert(r != OGS_ERROR);
177
 
178
                         AMF_UE_CLEAR_N2_TRANSFER(amf_ue, handover_request);
179
                     }
180
@@ -282,10 +295,11 @@
181
                 if (!n1smbuf) {
182
                     ogs_error("%s:%d No N1 SM Content %s",
183
                             amf_ue->supi, sess->psi, n1SmMsg->content_id);
184
-                    ogs_assert(OGS_OK ==
185
-                        nas_5gs_send_back_gsm_message(sess,
186
+                    r = nas_5gs_send_back_gsm_message(sess,
187
                             OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
188
-                            AMF_NAS_BACKOFF_TIME));
189
+                            AMF_NAS_BACKOFF_TIME);
190
+                    ogs_expect(r == OGS_OK);
191
+                    ogs_assert(r != OGS_ERROR);
192
 
193
                     return OGS_ERROR;
194
                 }
195
@@ -293,10 +307,11 @@
196
                 if (!n2smbuf) {
197
                     ogs_error("%s:%d No N2 SM Content",
198
                             amf_ue->supi, sess->psi);
199
-                    ogs_assert(OGS_OK ==
200
-                        nas_5gs_send_back_gsm_message(sess,
201
+                    r = nas_5gs_send_back_gsm_message(sess,
202
                             OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
203
-                            AMF_NAS_BACKOFF_TIME));
204
+                            AMF_NAS_BACKOFF_TIME);
205
+                    ogs_expect(r == OGS_OK);
206
+                    ogs_assert(r != OGS_ERROR);
207
 
208
                     return OGS_ERROR;
209
                 }
210
@@ -311,9 +326,10 @@
211
                 n2smbuf = ogs_pkbuf_copy(n2smbuf);
212
                 ogs_assert(n2smbuf);
213
 
214
-                ogs_assert(OGS_OK ==
215
-                    nas_send_pdu_session_modification_command(
216
-                        sess, n1smbuf, n2smbuf));
217
+                r = nas_send_pdu_session_modification_command(
218
+                        sess, n1smbuf, n2smbuf);
219
+                ogs_expect(r == OGS_OK);
220
+                ogs_assert(r != OGS_ERROR);
221
                 break;
222
 
223
 
224
@@ -321,10 +337,11 @@
225
                 if (!n1smbuf) {
226
                     ogs_error("%s:%d No N1 SM Content %s",
227
                             amf_ue->supi, sess->psi, n1SmMsg->content_id);
228
-                    ogs_assert(OGS_OK ==
229
-                        nas_5gs_send_back_gsm_message(sess,
230
+                    r = nas_5gs_send_back_gsm_message(sess,
231
                             OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
232
-                            AMF_NAS_BACKOFF_TIME));
233
+                            AMF_NAS_BACKOFF_TIME);
234
+                    ogs_expect(r == OGS_OK);
235
+                    ogs_assert(r != OGS_ERROR);
236
 
237
                     return OGS_ERROR;
238
                 }
239
@@ -332,10 +349,11 @@
240
                 if (!n2smbuf) {
241
                     ogs_error("%s:%d No N2 SM Content",
242
                             amf_ue->supi, sess->psi);
243
-                    ogs_assert(OGS_OK ==
244
-                        nas_5gs_send_back_gsm_message(sess,
245
+                    r = nas_5gs_send_back_gsm_message(sess,
246
                             OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
247
-                            AMF_NAS_BACKOFF_TIME));
248
+                            AMF_NAS_BACKOFF_TIME);
249
+                    ogs_expect(r == OGS_OK);
250
+                    ogs_assert(r != OGS_ERROR);
251
 
252
                     return OGS_ERROR;
253
                 }
254
@@ -350,19 +368,21 @@
255
                 n2smbuf = ogs_pkbuf_copy(n2smbuf);
256
                 ogs_assert(n2smbuf);
257
 
258
-                ogs_assert(OGS_OK ==
259
-                    nas_send_pdu_session_release_command(
260
-                        sess, n1smbuf, n2smbuf));
261
+                r = nas_send_pdu_session_release_command(
262
+                        sess, n1smbuf, n2smbuf);
263
+                ogs_expect(r == OGS_OK);
264
+                ogs_assert(r != OGS_ERROR);
265
                 break;
266
 
267
             case OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK:
268
                 if (!n2smbuf) {
269
                     ogs_error("%s:%d No N2 SM Content",
270
                             amf_ue->supi, sess->psi);
271
-                    ogs_expect(OGS_OK ==
272
-                        ngap_send_error_indication2(amf_ue,
273
+                    r = ngap_send_error_indication2(amf_ue,
274
                             NGAP_Cause_PR_protocol,
275
-                            NGAP_CauseProtocol_semantic_error));
276
+                            NGAP_CauseProtocol_semantic_error);
277
+                    ogs_expect(r == OGS_OK);
278
+                    ogs_assert(r != OGS_ERROR);
279
 
280
                     return OGS_ERROR;
281
                 }
282
@@ -372,8 +392,9 @@
283
                         ogs_pkbuf_copy(n2smbuf));
284
 
285
                 if (AMF_SESSION_SYNC_DONE(amf_ue, state)) {
286
-                    ogs_assert(OGS_OK ==
287
-                        ngap_send_path_switch_ack(sess));
288
+                    r = ngap_send_path_switch_ack(sess);
289
+                    ogs_expect(r == OGS_OK);
290
+                    ogs_assert(r != OGS_ERROR);
291
 
292
                     AMF_UE_CLEAR_N2_TRANSFER(amf_ue, path_switch_request_ack);
293
                 }
294
@@ -383,10 +404,11 @@
295
                 if (!n2smbuf) {
296
                     ogs_error("%s:%d No N2 SM Content",
297
                             amf_ue->supi, sess->psi);
298
-                    ogs_expect(OGS_OK ==
299
-                        ngap_send_error_indication2(amf_ue,
300
+                    r = ngap_send_error_indication2(amf_ue,
301
                             NGAP_Cause_PR_protocol,
302
-                            NGAP_CauseProtocol_semantic_error));
303
+                            NGAP_CauseProtocol_semantic_error);
304
+                    ogs_expect(r == OGS_OK);
305
+                    ogs_assert(r != OGS_ERROR);
306
 
307
                     return OGS_ERROR;
308
                 }
309
@@ -395,8 +417,9 @@
310
                         sess, handover_command, ogs_pkbuf_copy(n2smbuf));
311
 
312
                 if (AMF_SESSION_SYNC_DONE(amf_ue, state)) {
313
-                    ogs_assert(OGS_OK ==
314
-                        ngap_send_handover_command(amf_ue));
315
+                    r = ngap_send_handover_command(amf_ue);
316
+                    ogs_expect(r == OGS_OK);
317
+                    ogs_assert(r != OGS_ERROR);
318
 
319
                     AMF_UE_CLEAR_N2_TRANSFER(amf_ue, handover_command);
320
                 }
321
@@ -405,10 +428,11 @@
322
             default:
323
                 ogs_error("Not implemented %d",
324
                         SmContextUpdatedData->n2_sm_info_type);
325
-                ogs_expect(OGS_OK ==
326
-                    ngap_send_error_indication2(amf_ue,
327
+                r = ngap_send_error_indication2(amf_ue,
328
                         NGAP_Cause_PR_protocol,
329
-                        NGAP_CauseProtocol_semantic_error));
330
+                        NGAP_CauseProtocol_semantic_error);
331
+                ogs_expect(r == OGS_OK);
332
+                ogs_assert(r != OGS_ERROR);
333
             }
334
 
335
         } else {
336
@@ -478,11 +502,12 @@
337
                 ogs_warn("PDUSessionResourceSetupResponse(Unsuccessful)");
338
                 ogs_assert(amf_ue->deactivation.group);
339
 
340
-                ogs_assert(OGS_OK ==
341
-                    ngap_send_amf_ue_context_release_command(amf_ue,
342
+                r = ngap_send_amf_ue_context_release_command(amf_ue,
343
                         amf_ue->deactivation.group,
344
                         amf_ue->deactivation.cause,
345
-                        NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0));
346
+                        NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0);
347
+                ogs_expect(r == OGS_OK);
348
+                ogs_assert(r != OGS_ERROR);
349
 
350
             } else if (state == AMF_UPDATE_SM_CONTEXT_MODIFIED) {
351
                 /*
352
@@ -515,11 +540,12 @@
353
                 if (AMF_SESSION_SYNC_DONE(amf_ue, state)) {
354
                     ogs_assert(amf_ue->deactivation.group);
355
 
356
-                    ogs_assert(OGS_OK ==
357
-                        ngap_send_amf_ue_context_release_command(amf_ue,
358
+                    r = ngap_send_amf_ue_context_release_command(amf_ue,
359
                             amf_ue->deactivation.group,
360
                             amf_ue->deactivation.cause,
361
-                            NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0));
362
+                            NGAP_UE_CTX_REL_NG_REMOVE_AND_UNLINK, 0);
363
+                    ogs_expect(r == OGS_OK);
364
+                    ogs_assert(r != OGS_ERROR);
365
                 }
366
 
367
             } else if (state == AMF_UPDATE_SM_CONTEXT_REGISTRATION_REQUEST) {
368
@@ -597,11 +623,12 @@
369
                     target_ue = source_ue->target_ue;
370
                     ogs_assert(target_ue);
371
 
372
-                    ogs_assert(OGS_OK ==
373
-                        ngap_send_ran_ue_context_release_command(target_ue,
374
+                    r = ngap_send_ran_ue_context_release_command(target_ue,
375
                             NGAP_Cause_PR_radioNetwork,
376
                             NGAP_CauseRadioNetwork_handover_cancelled,
377
-                            NGAP_UE_CTX_REL_NG_HANDOVER_CANCEL, 0));
378
+                            NGAP_UE_CTX_REL_NG_HANDOVER_CANCEL, 0);
379
+                    ogs_expect(r == OGS_OK);
380
+                    ogs_assert(r != OGS_ERROR);
381
                 }
382
 
383
             } else if (state == AMF_UPDATE_SM_CONTEXT_HANDOVER_NOTIFY) {
384
@@ -636,9 +663,11 @@
385
                         ogs_debug("    SUPI%s", amf_ue->supi);
386
                         ran_ue_remove(ran_ue);
387
 
388
-                        if (ogs_list_count(&gnb->ran_ue_list) == 0)
389
-                            ogs_assert(OGS_OK ==
390
-                                ngap_send_ng_reset_ack(gnb, NULL));
391
+                        if (ogs_list_count(&gnb->ran_ue_list) == 0) {
392
+                            r = ngap_send_ng_reset_ack(gnb, NULL);
393
+                            ogs_expect(r == OGS_OK);
394
+                            ogs_assert(r != OGS_ERROR);
395
+                        }
396
 
397
                     } else {
398
                         ogs_warn("%s RAN-NG Context has already been removed",
399
@@ -673,9 +702,10 @@
400
                          * where PartOfNG_interface was requested
401
                          * REMOVED */
402
                         ogs_assert(gnb->ng_reset_ack);
403
-                        ogs_expect(OGS_OK ==
404
-                            ngap_send_to_gnb(gnb,
405
-                                gnb->ng_reset_ack, NGAP_NON_UE_SIGNALLING));
406
+                        r = ngap_send_to_gnb(
407
+                            gnb, gnb->ng_reset_ack, NGAP_NON_UE_SIGNALLING);
408
+                        ogs_expect(r == OGS_OK);
409
+                        ogs_assert(r != OGS_ERROR);
410
 
411
                         /* Clear NG-Reset Ack Buffer */
412
                         gnb->ng_reset_ack = NULL;
413
@@ -722,18 +752,20 @@
414
         if (!SmContextUpdateError) {
415
             ogs_error("%d:%d No SmContextUpdateError %d",
416
                     sess->psi, sess->pti, recvmsg->res_status);
417
-            ogs_expect(OGS_OK ==
418
-                ngap_send_error_indication2(amf_ue,
419
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
420
+            r = ngap_send_error_indication2(amf_ue,
421
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
422
+            ogs_expect(r == OGS_OK);
423
+            ogs_assert(r != OGS_ERROR);
424
 
425
             return OGS_ERROR;
426
         }
427
         if (!SmContextUpdateError->error) {
428
             ogs_error("%d:%d No Error %d",
429
                     sess->psi, sess->pti, recvmsg->res_status);
430
-            ogs_expect(OGS_OK ==
431
-                ngap_send_error_indication2(amf_ue,
432
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
433
+            r = ngap_send_error_indication2(amf_ue,
434
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
435
+            ogs_expect(r == OGS_OK);
436
+            ogs_assert(r != OGS_ERROR);
437
 
438
             return OGS_ERROR;
439
         }
440
@@ -752,9 +784,10 @@
441
 
442
                 n1smbuf = ogs_pkbuf_copy(n1smbuf);
443
                 ogs_assert(n1smbuf);
444
-                ogs_assert(OGS_OK ==
445
-                    nas_5gs_send_gsm_reject(sess,
446
-                        OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf));
447
+                r = nas_5gs_send_gsm_reject(sess,
448
+                        OGS_NAS_PAYLOAD_CONTAINER_N1_SM_INFORMATION, n1smbuf);
449
+                ogs_expect(r == OGS_OK);
450
+                ogs_assert(r != OGS_ERROR);
451
 
452
                 return OGS_ERROR;
453
             }
454
@@ -764,9 +797,10 @@
455
         n2SmInfo = SmContextUpdateError->n2_sm_info;
456
         if (!n2SmInfo || !n2SmInfo->content_id) {
457
             ogs_error("%d:%d No N2 SM Message", sess->psi, sess->pti);
458
-            ogs_expect(OGS_OK ==
459
-                ngap_send_error_indication2(amf_ue,
460
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
461
+            r = ngap_send_error_indication2(amf_ue,
462
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
463
+            ogs_expect(r == OGS_OK);
464
+            ogs_assert(r != OGS_ERROR);
465
 
466
             return OGS_ERROR;
467
         }
468
@@ -776,9 +810,10 @@
469
         if (!n2smbuf) {
470
             ogs_error("%d:%d No N2 SM Content %s",
471
                     sess->psi, sess->pti, n2SmInfo->content_id);
472
-            ogs_expect(OGS_OK ==
473
-                ngap_send_error_indication2(amf_ue,
474
-                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
475
+            r = ngap_send_error_indication2(amf_ue,
476
+                    NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
477
+            ogs_expect(r == OGS_OK);
478
+            ogs_assert(r != OGS_ERROR);
479
 
480
             return OGS_ERROR;
481
         }
482
@@ -786,9 +821,10 @@
483
 
484
         ogs_error("%d:%d Error Indication", sess->psi, sess->pti);
485
 
486
-        ogs_expect(OGS_OK ==
487
-            ngap_send_error_indication2(amf_ue,
488
-                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error));
489
+        r = ngap_send_error_indication2(amf_ue,
490
+                NGAP_Cause_PR_protocol, NGAP_CauseProtocol_semantic_error);
491
+        ogs_expect(r == OGS_OK);
492
+        ogs_assert(r != OGS_ERROR);
493
 
494
         return OGS_ERROR;
495
     }
496
@@ -798,6 +834,7 @@
497
 
498
 int amf_nsmf_pdusession_handle_release_sm_context(amf_sess_t *sess, int state)
499
 {
500
+    int r;
501
     amf_ue_t *amf_ue = NULL;
502
 
503
     ogs_assert(sess);
504
@@ -825,8 +862,9 @@
505
                         amf_ue, 0, NULL));
506
             } else {
507
                 CLEAR_AMF_UE_TIMER(amf_ue->t3550);
508
-                ogs_assert(OGS_OK ==
509
-                    nas_5gs_send_registration_accept(amf_ue));
510
+                r = nas_5gs_send_registration_accept(amf_ue);
511
+                ogs_expect(r == OGS_OK);
512
+                ogs_assert(r != OGS_ERROR);
513
             }
514
         }
515
 
516
@@ -836,10 +874,14 @@
517
          * 2. Release All SM contexts
518
          * 3. Service accept
519
          */
520
-        if (AMF_SESSION_SYNC_DONE(amf_ue, AMF_RELEASE_SM_CONTEXT_SERVICE_ACCEPT) &&
521
-            AMF_SESSION_SYNC_DONE(amf_ue, AMF_UPDATE_SM_CONTEXT_SERVICE_REQUEST))
522
-            ogs_assert(OGS_OK ==
523
-                nas_5gs_send_service_accept(amf_ue));
524
+        if (AMF_SESSION_SYNC_DONE(amf_ue,
525
+                AMF_RELEASE_SM_CONTEXT_SERVICE_ACCEPT) &&
526
+            AMF_SESSION_SYNC_DONE(amf_ue,
527
+                AMF_UPDATE_SM_CONTEXT_SERVICE_REQUEST)) {
528
+            r = nas_5gs_send_service_accept(amf_ue);
529
+            ogs_expect(r == OGS_OK);
530
+            ogs_assert(r != OGS_ERROR);
531
+        }
532
 
533
     } else {
534
 
535
@@ -852,10 +894,11 @@
536
                  * 3. UE Context release command
537
                  * 4. UE Context release complete
538
                  */
539
-                ogs_assert(OGS_OK ==
540
-                    ngap_send_amf_ue_context_release_command(amf_ue,
541
+                r = ngap_send_amf_ue_context_release_command(amf_ue,
542
                         NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
543
-                        NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
544
+                        NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0);
545
+                ogs_expect(r == OGS_OK);
546
+                ogs_assert(r != OGS_ERROR);
547
 
548
             } else if (state == AMF_RELEASE_SM_CONTEXT_REGISTRATION_ACCEPT) {
549
 
550
@@ -917,10 +960,11 @@
551
                      * 3. UE Context release command
552
                      * 4. UE Context release complete
553
                      */
554
-                    ogs_assert(OGS_OK ==
555
-                        ngap_send_amf_ue_context_release_command(amf_ue,
556
+                    r = ngap_send_amf_ue_context_release_command(amf_ue,
557
                             NGAP_Cause_PR_nas, NGAP_CauseNas_normal_release,
558
-                            NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
559
+                            NGAP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
560
+                    ogs_expect(r == OGS_OK);
561
+                    ogs_assert(r != OGS_ERROR);
562
 
563
                 } else if (OGS_FSM_CHECK(&amf_ue->sm,
564
                                 gmm_state_initial_context_setup)) {
565
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/nudm-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/nudm-handler.c Changed
52
 
1
@@ -25,7 +25,7 @@
2
 int amf_nudm_sdm_handle_provisioned(
3
         amf_ue_t *amf_ue, int state, ogs_sbi_message_t *recvmsg)
4
 {
5
-    int i;
6
+    int i, r;
7
 
8
     ogs_assert(amf_ue);
9
     ogs_assert(recvmsg);
10
@@ -259,9 +259,10 @@
11
 
12
         if (!recvmsg->http.location) {
13
             ogs_error("%s No http.location", amf_ue->supi);
14
-            ogs_assert(OGS_OK ==
15
-                nas_5gs_send_gmm_reject_from_sbi(
16
-                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
17
+            r = nas_5gs_send_gmm_reject_from_sbi(
18
+                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
19
+            ogs_expect(r == OGS_OK);
20
+            ogs_assert(r != OGS_ERROR);
21
             return OGS_ERROR;
22
         }
23
 
24
@@ -272,9 +273,10 @@
25
         if (rv != OGS_OK) {
26
             ogs_error("%s Cannot parse http.location %s",
27
                 amf_ue->supi, recvmsg->http.location);
28
-            ogs_assert(OGS_OK ==
29
-                nas_5gs_send_gmm_reject_from_sbi(
30
-                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
31
+            r = nas_5gs_send_gmm_reject_from_sbi(
32
+                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
33
+            ogs_expect(r == OGS_OK);
34
+            ogs_assert(r != OGS_ERROR);
35
             return OGS_ERROR;
36
         }
37
 
38
@@ -283,9 +285,10 @@
39
                 amf_ue->supi, recvmsg->http.location);
40
 
41
             ogs_sbi_header_free(&header);
42
-            ogs_assert(OGS_OK ==
43
-                nas_5gs_send_gmm_reject_from_sbi(
44
-                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
45
+            r = nas_5gs_send_gmm_reject_from_sbi(
46
+                    amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR);
47
+            ogs_expect(r == OGS_OK);
48
+            ogs_assert(r != OGS_ERROR);
49
             return OGS_ERROR;
50
         }
51
 
52
open5gs_2.5.5.100.a8f8.tar.xz/src/amf/sbi-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/amf/sbi-path.c Changed
165
 
1
@@ -92,6 +92,7 @@
2
         ogs_sbi_request_t *(*build)(amf_ue_t *amf_ue, void *data),
3
         amf_ue_t *amf_ue, int state, void *data)
4
 {
5
+    int r;
6
     ogs_sbi_xact_t *xact = NULL;
7
 
8
     ogs_assert(service_type);
9
@@ -103,9 +104,10 @@
10
             (ogs_sbi_build_f)build, amf_ue, data);
11
     if (!xact) {
12
         ogs_error("amf_ue_sbi_discover_and_send() failed");
13
-        ogs_assert(OGS_OK ==
14
-            nas_5gs_send_gmm_reject_from_sbi(
15
-                amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
16
+        r = nas_5gs_send_gmm_reject_from_sbi(
17
+                amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
18
+        ogs_expect(r == OGS_OK);
19
+        ogs_assert(r != OGS_ERROR);
20
         return false;
21
     }
22
 
23
@@ -114,9 +116,10 @@
24
     if (ogs_sbi_discover_and_send(xact) != true) {
25
         ogs_error("amf_ue_sbi_discover_and_send() failed");
26
         ogs_sbi_xact_remove(xact);
27
-        ogs_assert(OGS_OK ==
28
-            nas_5gs_send_gmm_reject_from_sbi(
29
-                amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT));
30
+        r = nas_5gs_send_gmm_reject_from_sbi(
31
+                amf_ue, OGS_SBI_HTTP_STATUS_GATEWAY_TIMEOUT);
32
+        ogs_expect(r == OGS_OK);
33
+        ogs_assert(r != OGS_ERROR);
34
         return false;
35
     }
36
 
37
@@ -129,6 +132,7 @@
38
         ogs_sbi_request_t *(*build)(amf_sess_t *sess, void *data),
39
         amf_sess_t *sess, int state, void *data)
40
 {
41
+    int r;
42
     ogs_sbi_xact_t *xact = NULL;
43
 
44
     ogs_assert(service_type);
45
@@ -140,8 +144,10 @@
46
             (ogs_sbi_build_f)build, sess, data);
47
     if (!xact) {
48
         ogs_error("amf_sess_sbi_discover_and_send() failed");
49
-        ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
50
-            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
51
+        r = nas_5gs_send_back_gsm_message(sess,
52
+            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
53
+        ogs_expect(r == OGS_OK);
54
+        ogs_assert(r != OGS_ERROR);
55
         return false;
56
     }
57
 
58
@@ -150,8 +156,10 @@
59
     if (ogs_sbi_discover_and_send(xact) != true) {
60
         ogs_error("amf_sess_sbi_discover_and_send() failed");
61
         ogs_sbi_xact_remove(xact);
62
-        ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
63
-            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
64
+        r = nas_5gs_send_back_gsm_message(sess,
65
+            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
66
+        ogs_expect(r == OGS_OK);
67
+        ogs_assert(r != OGS_ERROR);
68
         return false;
69
     }
70
 
71
@@ -160,7 +168,7 @@
72
 static int client_discover_cb(
73
         int status, ogs_sbi_response_t *response, void *data)
74
 {
75
-    int rv;
76
+    int r, rv;
77
     ogs_sbi_message_t message;
78
 
79
     ogs_sbi_xact_t *xact = NULL;
80
@@ -216,24 +224,30 @@
81
     rv = ogs_sbi_parse_response(&message, response);
82
     if (rv != OGS_OK) {
83
         ogs_error("cannot parse HTTP response");
84
-        ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
85
-            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
86
+        r = nas_5gs_send_back_gsm_message(sess,
87
+            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
88
+        ogs_expect(r == OGS_OK);
89
+        ogs_assert(r != OGS_ERROR);
90
 
91
         goto cleanup;
92
     }
93
 
94
     if (message.res_status != OGS_SBI_HTTP_STATUS_OK) {
95
         ogs_error("NF-Discover failed %d", message.res_status);
96
-        ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
97
-            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
98
+        r = nas_5gs_send_back_gsm_message(sess,
99
+            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
100
+        ogs_expect(r == OGS_OK);
101
+        ogs_assert(r != OGS_ERROR);
102
 
103
         goto cleanup;
104
     }
105
 
106
     if (!message.SearchResult) {
107
         ogs_error("No SearchResult");
108
-        ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
109
-            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME));
110
+        r = nas_5gs_send_back_gsm_message(sess,
111
+            OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED, AMF_NAS_BACKOFF_TIME);
112
+        ogs_expect(r == OGS_OK);
113
+        ogs_assert(r != OGS_ERROR);
114
 
115
         goto cleanup;
116
     }
117
@@ -247,10 +261,11 @@
118
         ogs_error("%s:%d (NF discover) No %s",
119
                     amf_ue->supi, sess->psi,
120
                     ogs_sbi_service_type_to_name(service_type));
121
-        ogs_assert(OGS_OK ==
122
-            nas_5gs_send_back_gsm_message(sess,
123
+        r = nas_5gs_send_back_gsm_message(sess,
124
                 OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED,
125
-                AMF_NAS_BACKOFF_TIME));
126
+                AMF_NAS_BACKOFF_TIME);
127
+        ogs_expect(r == OGS_OK);
128
+        ogs_assert(r != OGS_ERROR);
129
 
130
         goto cleanup;
131
     }
132
@@ -294,11 +309,18 @@
133
 
134
     xact = ogs_sbi_xact_add(
135
             &sess->sbi, service_type, discovery_option, NULL, NULL, NULL);
136
-    ogs_expect_or_return_val(xact, false);
137
+    if (!xact) {
138
+        ogs_error("ogs_sbi_xact_add() failed");
139
+        return false;
140
+    }
141
 
142
     xact->request = amf_nnrf_disc_build_discover(
143
                 sess->nssf.nrf.id, xact->service_type, xact->discovery_option);
144
-    ogs_expect_or_return_val(xact->request, false);
145
+    if (!xact->request) {
146
+        ogs_error("amf_nnrf_disc_build_discover() failed");
147
+        ogs_sbi_xact_remove(xact);
148
+        return false;
149
+    }
150
 
151
     return ogs_sbi_client_send_request(
152
             client, client_discover_cb, xact->request, xact);
153
@@ -460,7 +482,10 @@
154
     ogs_assert(client);
155
 
156
     request = amf_nsmf_callback_build_n1_n2_failure_notify(sess, cause);
157
-    ogs_expect_or_return_val(request, false);
158
+    if (!request) {
159
+        ogs_error("amf_nsmf_callback_build_n1_n2_failure_notify() failed");
160
+        return false;
161
+    }
162
 
163
     rc = ogs_sbi_send_request_to_client(
164
             client, client_notify_cb, request, NULL);
165
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/emm-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/emm-handler.c Changed
116
 
1
@@ -35,6 +35,7 @@
2
 int emm_handle_attach_request(mme_ue_t *mme_ue,
3
         ogs_nas_eps_attach_request_t *attach_request, ogs_pkbuf_t *pkbuf)
4
 {
5
+    int r;
6
     int served_tai_index = 0;
7
 
8
     ogs_nas_eps_mobile_identity_guti_t *eps_mobile_identity_guti = NULL;
9
@@ -129,10 +130,11 @@
10
         /* Send Attach Reject */
11
         ogs_warn("Cannot find Served TAIPLMN_ID:%06x,TAC:%d",
12
             ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
13
-        ogs_assert(OGS_OK ==
14
-            nas_eps_send_attach_reject(mme_ue,
15
+        r = nas_eps_send_attach_reject(mme_ue,
16
                 OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED,
17
-                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
18
+                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
19
+        ogs_expect(r == OGS_OK);
20
+        ogs_assert(r != OGS_ERROR);
21
         return OGS_ERROR;
22
     }
23
     ogs_debug("    SERVED_TAI_INDEX%d", served_tai_index);
24
@@ -172,10 +174,11 @@
25
             "but Integrity0x%x cannot be bypassed with EIA0",
26
             mme_selected_enc_algorithm(mme_ue), 
27
             mme_selected_int_algorithm(mme_ue));
28
-        ogs_assert(OGS_OK ==
29
-            nas_eps_send_attach_reject(mme_ue,
30
+        r = nas_eps_send_attach_reject(mme_ue,
31
                 OGS_NAS_EMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH,
32
-                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
33
+                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
34
+        ogs_expect(r == OGS_OK);
35
+        ogs_assert(r != OGS_ERROR);
36
         return OGS_ERROR;
37
     }
38
 
39
@@ -222,7 +225,7 @@
40
 int emm_handle_attach_complete(
41
     mme_ue_t *mme_ue, ogs_nas_eps_attach_complete_t *attach_complete)
42
 {
43
-    int rv;
44
+    int r, rv;
45
     ogs_pkbuf_t *emmbuf = NULL;
46
 
47
     ogs_nas_eps_message_t message;
48
@@ -315,15 +318,19 @@
49
     network_daylight_saving_time->length = 1;
50
 
51
     emmbuf = nas_eps_security_encode(mme_ue, &message);
52
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
53
+    if (!emmbuf) {
54
+        ogs_error("nas_eps_security_encode() failed");
55
+        return OGS_ERROR;
56
+    }
57
 
58
-    rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
59
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
60
+    r = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
61
+    ogs_expect(r == OGS_OK);
62
+    ogs_assert(r != OGS_ERROR);
63
 
64
     ogs_debug("EMM information");
65
     ogs_debug("    IMSI%s", mme_ue->imsi_bcd);
66
 
67
-    return rv;
68
+    return r;
69
 }
70
 
71
 int emm_handle_identity_response(
72
@@ -487,6 +494,7 @@
73
 int emm_handle_tau_request(mme_ue_t *mme_ue,
74
     ogs_nas_eps_tracking_area_update_request_t *tau_request, ogs_pkbuf_t *pkbuf)
75
 {
76
+    int r;
77
     int served_tai_index = 0;
78
 
79
     ogs_nas_eps_mobile_identity_guti_t *eps_mobile_identity_guti = NULL;
80
@@ -560,9 +568,10 @@
81
         /* Send TAU reject */
82
         ogs_warn("Cannot find Served TAIPLMN_ID:%06x,TAC:%d",
83
             ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
84
-        ogs_assert(OGS_OK ==
85
-            nas_eps_send_tau_reject(
86
-                mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED));
87
+        r = nas_eps_send_tau_reject(
88
+                mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED);
89
+        ogs_expect(r == OGS_OK);
90
+        ogs_assert(r != OGS_ERROR);
91
         return OGS_ERROR;
92
     }
93
     ogs_debug("    SERVED_TAI_INDEX%d", served_tai_index);
94
@@ -625,6 +634,7 @@
95
 int emm_handle_extended_service_request(mme_ue_t *mme_ue,
96
         ogs_nas_eps_extended_service_request_t *extended_service_request)
97
 {
98
+    int r;
99
     int served_tai_index = 0;
100
 
101
     ogs_nas_service_type_t *service_type =
102
@@ -678,9 +688,10 @@
103
         /* Send TAU reject */
104
         ogs_warn("Cannot find Served TAIPLMN_ID:%06x,TAC:%d",
105
             ogs_plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
106
-        ogs_assert(OGS_OK ==
107
-            nas_eps_send_tau_reject(
108
-                mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED));
109
+        r = nas_eps_send_tau_reject(
110
+                mme_ue, OGS_NAS_EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED);
111
+        ogs_expect(r == OGS_OK);
112
+        ogs_assert(r != OGS_ERROR);
113
         return OGS_ERROR;
114
     }
115
     ogs_debug("    SERVED_TAI_INDEX%d", served_tai_index);
116
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/emm-sm.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/emm-sm.c Changed
626
 
1
@@ -56,7 +56,7 @@
2
 
3
 void emm_state_de_registered(ogs_fsm_t *s, mme_event_t *e)
4
 {
5
-    int rv;
6
+    int r;
7
     mme_ue_t *mme_ue = NULL;
8
 
9
     ogs_assert(e);
10
@@ -85,14 +85,10 @@
11
                         "Stop retransmission");
12
                 OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
13
             } else {
14
-                ogs_assert(mme_ue->t3470.pkbuf);
15
-                rv = nas_eps_send_identity_request(mme_ue);
16
-                if (rv == OGS_OK) {
17
-                    mme_ue->t3470.retry_count++;
18
-                } else {
19
-                    ogs_error("nas_eps_send_identity_request() failed");
20
-                    OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
21
-                }
22
+                mme_ue->t3470.retry_count++;
23
+                r = nas_eps_send_identity_request(mme_ue);
24
+                ogs_expect(r == OGS_OK);
25
+                ogs_assert(r != OGS_ERROR);
26
             }
27
             break;
28
 
29
@@ -109,7 +105,7 @@
30
 
31
 void emm_state_registered(ogs_fsm_t *s, mme_event_t *e)
32
 {
33
-    int rv;
34
+    int r;
35
     mme_ue_t *mme_ue = NULL;
36
 
37
     ogs_assert(e);
38
@@ -146,7 +142,9 @@
39
                  * We don't have to set CNDomain.
40
                  * So, we just set CNDomain to 0
41
                  */
42
-                ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, 0));
43
+                r = s1ap_send_paging(mme_ue, 0);
44
+                ogs_expect(r == OGS_OK);
45
+                ogs_assert(r != OGS_ERROR);
46
             }
47
             break;
48
 
49
@@ -157,14 +155,10 @@
50
                         "Stop retransmission");
51
                 OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
52
             } else {
53
-                ogs_assert(mme_ue->t3470.pkbuf);
54
-                rv = nas_eps_send_identity_request(mme_ue);
55
-                if (rv == OGS_OK) {
56
-                    mme_ue->t3470.retry_count++;
57
-                } else {
58
-                    ogs_error("nas_eps_send_identity_request() failed");
59
-                    OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
60
-                }
61
+                mme_ue->t3470.retry_count++;
62
+                r = nas_eps_send_identity_request(mme_ue);
63
+                ogs_expect(r == OGS_OK);
64
+                ogs_assert(r != OGS_ERROR);
65
             }
66
             break;
67
 
68
@@ -175,14 +169,10 @@
69
                         "Stop retransmission");
70
                 OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
71
             } else {
72
-                ogs_assert(mme_ue->t3422.pkbuf);
73
-                rv = nas_eps_send_detach_request(mme_ue);
74
-                if (rv == OGS_OK) {
75
-                    mme_ue->t3422.retry_count++;
76
-                } else {
77
-                    ogs_error("nas_eps_send_detach_request() failed");
78
-                    OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
79
-                }
80
+                mme_ue->t3422.retry_count++;
81
+                r = nas_eps_send_detach_request(mme_ue);
82
+                ogs_expect(r == OGS_OK);
83
+                ogs_assert(r != OGS_ERROR);
84
             }
85
             break;
86
 
87
@@ -199,7 +189,7 @@
88
 
89
 static void common_register_state(ogs_fsm_t *s, mme_event_t *e)
90
 {
91
-    int rv;
92
+    int r, rv;
93
 
94
     mme_ue_t *mme_ue = NULL;
95
     enb_ue_t *enb_ue = NULL;
96
@@ -234,42 +224,47 @@
97
 
98
             if (!MME_UE_HAVE_IMSI(mme_ue)) {
99
                 ogs_info("Service request : Unknown UE");
100
-                ogs_assert(OGS_OK ==
101
-                    nas_eps_send_service_reject(mme_ue,
102
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
103
+                r = nas_eps_send_service_reject(mme_ue,
104
+                    OGS_NAS_EMM_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, &emm_state_exception);
108
                 break;
109
             }
110
 
111
             if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
112
                 ogs_warn("No Security Context : IMSI%s", mme_ue->imsi_bcd);
113
-                ogs_assert(OGS_OK ==
114
-                    nas_eps_send_service_reject(mme_ue,
115
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
116
+                r = nas_eps_send_service_reject(mme_ue,
117
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
118
+                ogs_expect(r == OGS_OK);
119
+                ogs_assert(r != OGS_ERROR);
120
                 OGS_FSM_TRAN(s, &emm_state_exception);
121
                 break;
122
             }
123
 
124
             if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
125
                 ogs_warn("No Session Context : IMSI%s", mme_ue->imsi_bcd);
126
-                ogs_assert(OGS_OK ==
127
-                    nas_eps_send_service_reject(mme_ue,
128
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
129
+                r = nas_eps_send_service_reject(mme_ue,
130
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
131
+                ogs_expect(r == OGS_OK);
132
+                ogs_assert(r != OGS_ERROR);
133
                 OGS_FSM_TRAN(s, &emm_state_exception);
134
                 break;
135
             }
136
 
137
             if (!ACTIVE_EPS_BEARERS_IS_AVAIABLE(mme_ue)) {
138
                 ogs_warn("No active EPS bearers : IMSI%s", mme_ue->imsi_bcd);
139
-                ogs_assert(OGS_OK ==
140
-                    nas_eps_send_service_reject(mme_ue,
141
-                        OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED));
142
+                r = nas_eps_send_service_reject(mme_ue,
143
+                        OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED);
144
+                ogs_expect(r == OGS_OK);
145
+                ogs_assert(r != OGS_ERROR);
146
                 OGS_FSM_TRAN(s, &emm_state_exception);
147
                 break;
148
             }
149
 
150
-            ogs_assert(OGS_OK ==
151
-                s1ap_send_initial_context_setup_request(mme_ue));
152
+            r = s1ap_send_initial_context_setup_request(mme_ue);
153
+            ogs_expect(r == OGS_OK);
154
+            ogs_assert(r != OGS_ERROR);
155
             OGS_FSM_TRAN(s, &emm_state_registered);
156
             break;
157
         }
158
@@ -314,8 +309,9 @@
159
 
160
             if (!MME_UE_HAVE_IMSI(mme_ue)) {
161
                 CLEAR_MME_UE_TIMER(mme_ue->t3470);
162
-                ogs_assert(OGS_OK ==
163
-                    nas_eps_send_identity_request(mme_ue));
164
+                r = nas_eps_send_identity_request(mme_ue);
165
+                ogs_expect(r == OGS_OK);
166
+                ogs_assert(r != OGS_ERROR);
167
                 break;
168
             }
169
 
170
@@ -328,10 +324,11 @@
171
                             &mme_ue->pdn_connectivity_request);
172
                     if (rv != OGS_OK) {
173
                         ogs_error("nas_eps_send_emm_to_esm() failed");
174
-                        ogs_assert(OGS_OK ==
175
-                            nas_eps_send_attach_reject(mme_ue,
176
+                        r = nas_eps_send_attach_reject(mme_ue,
177
                                 OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
178
-                                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
179
+                                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
180
+                        ogs_expect(r == OGS_OK);
181
+                        ogs_assert(r != OGS_ERROR);
182
                         OGS_FSM_TRAN(s, &emm_state_exception);
183
                         break;
184
                     }
185
@@ -360,27 +357,30 @@
186
 
187
             if (!MME_UE_HAVE_IMSI(mme_ue)) {
188
                 ogs_info("TAU request : Unknown UE");
189
-                ogs_assert(OGS_OK ==
190
-                    nas_eps_send_tau_reject(mme_ue,
191
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
192
+                r = nas_eps_send_tau_reject(mme_ue,
193
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
194
+                ogs_expect(r == OGS_OK);
195
+                ogs_assert(r != OGS_ERROR);
196
                 OGS_FSM_TRAN(s, &emm_state_exception);
197
                 break;
198
             }
199
 
200
             if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
201
                 ogs_warn("No PDN Connection : UE%s", mme_ue->imsi_bcd);
202
-                ogs_assert(OGS_OK ==
203
-                    nas_eps_send_tau_reject(mme_ue,
204
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
205
+                r = nas_eps_send_tau_reject(mme_ue,
206
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
207
+                ogs_expect(r == OGS_OK);
208
+                ogs_assert(r != OGS_ERROR);
209
                 OGS_FSM_TRAN(s, emm_state_exception);
210
                 break;
211
             }
212
 
213
             if (!ACTIVE_EPS_BEARERS_IS_AVAIABLE(mme_ue)) {
214
                 ogs_warn("No active EPS bearers : IMSI%s", mme_ue->imsi_bcd);
215
-                ogs_assert(OGS_OK ==
216
-                    nas_eps_send_tau_reject(mme_ue,
217
-                        OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED));
218
+                r = nas_eps_send_tau_reject(mme_ue,
219
+                        OGS_NAS_EMM_CAUSE_NO_EPS_BEARER_CONTEXT_ACTIVATED);
220
+                ogs_expect(r == OGS_OK);
221
+                ogs_assert(r != OGS_ERROR);
222
                 OGS_FSM_TRAN(s, &emm_state_exception);
223
                 break;
224
             }
225
@@ -459,20 +459,23 @@
226
             if (e->s1ap_code == S1AP_ProcedureCode_id_initialUEMessage) {
227
                 ogs_debug("    Iniital UE Message");
228
                 if (mme_ue->nas_eps.update.active_flag) {
229
-                    ogs_assert(OGS_OK ==
230
-                        nas_eps_send_tau_accept(mme_ue,
231
-                            S1AP_ProcedureCode_id_InitialContextSetup));
232
+                    r = nas_eps_send_tau_accept(mme_ue,
233
+                            S1AP_ProcedureCode_id_InitialContextSetup);
234
+                    ogs_expect(r == OGS_OK);
235
+                    ogs_assert(r != OGS_ERROR);
236
                 } else {
237
-                    ogs_assert(OGS_OK ==
238
-                        nas_eps_send_tau_accept(mme_ue,
239
-                            S1AP_ProcedureCode_id_downlinkNASTransport));
240
+                    r = nas_eps_send_tau_accept(mme_ue,
241
+                            S1AP_ProcedureCode_id_downlinkNASTransport);
242
+                    ogs_expect(r == OGS_OK);
243
+                    ogs_assert(r != OGS_ERROR);
244
                 }
245
             } else if (e->s1ap_code ==
246
                     S1AP_ProcedureCode_id_uplinkNASTransport) {
247
                 ogs_debug("    Uplink NAS Transport");
248
-                ogs_assert(OGS_OK ==
249
-                    nas_eps_send_tau_accept(mme_ue,
250
-                        S1AP_ProcedureCode_id_downlinkNASTransport));
251
+                r = nas_eps_send_tau_accept(mme_ue,
252
+                        S1AP_ProcedureCode_id_downlinkNASTransport);
253
+                ogs_expect(r == OGS_OK);
254
+                ogs_assert(r != OGS_ERROR);
255
             } else {
256
                 ogs_fatal("Invalid Procedure Code%d", (int)e->s1ap_code);
257
             }
258
@@ -501,27 +504,30 @@
259
 
260
             if (!MME_UE_HAVE_IMSI(mme_ue)) {
261
                 ogs_warn("Extended Service request : Unknown UE");
262
-                ogs_assert(OGS_OK ==
263
-                    nas_eps_send_service_reject(mme_ue,
264
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
265
+                r = nas_eps_send_service_reject(mme_ue,
266
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
267
+                ogs_expect(r == OGS_OK);
268
+                ogs_assert(r != OGS_ERROR);
269
                 OGS_FSM_TRAN(s, &emm_state_exception);
270
                 break;
271
             }
272
 
273
             if (!SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
274
                 ogs_warn("No PDN Connection : UE%s", mme_ue->imsi_bcd);
275
-                ogs_assert(OGS_OK ==
276
-                    nas_eps_send_service_reject(mme_ue,
277
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
278
+                r = nas_eps_send_service_reject(mme_ue,
279
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
280
+                ogs_expect(r == OGS_OK);
281
+                ogs_assert(r != OGS_ERROR);
282
                 OGS_FSM_TRAN(s, emm_state_exception);
283
                 break;
284
             }
285
 
286
             if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
287
                 ogs_warn("No Security Context : IMSI%s", mme_ue->imsi_bcd);
288
-                ogs_assert(OGS_OK ==
289
-                    nas_eps_send_service_reject(mme_ue,
290
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
291
+                r = nas_eps_send_service_reject(mme_ue,
292
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
293
+                ogs_expect(r == OGS_OK);
294
+                ogs_assert(r != OGS_ERROR);
295
                 OGS_FSM_TRAN(s, &emm_state_exception);
296
                 break;
297
             }
298
@@ -531,10 +537,10 @@
299
 
300
                 if (!MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
301
                     ogs_warn("No P-TMSI : UE%s", mme_ue->imsi_bcd);
302
-                    ogs_assert(OGS_OK ==
303
-                        nas_eps_send_service_reject(mme_ue,
304
-                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
305
-                    );
306
+                    r = nas_eps_send_service_reject(mme_ue,
307
+                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
308
+                    ogs_expect(r == OGS_OK);
309
+                    ogs_assert(r != OGS_ERROR);
310
                     mme_send_release_access_bearer_or_ue_context_release(
311
                             enb_ue);
312
                     break;
313
@@ -558,16 +564,17 @@
314
                 } else {
315
                     ogs_warn(" Unknown CSFB Service Type%d",
316
                             mme_ue->nas_eps.service.value);
317
-                    ogs_assert(OGS_OK ==
318
-                        nas_eps_send_service_reject(mme_ue,
319
-                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
320
-                    );
321
+                    r = nas_eps_send_service_reject(mme_ue,
322
+                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
323
+                    ogs_expect(r == OGS_OK);
324
+                    ogs_assert(r != OGS_ERROR);
325
                     OGS_FSM_TRAN(s, &emm_state_exception);
326
                     break;
327
                 }
328
 
329
-                ogs_assert(OGS_OK ==
330
-                    s1ap_send_initial_context_setup_request(mme_ue));
331
+                r = s1ap_send_initial_context_setup_request(mme_ue);
332
+                ogs_expect(r == OGS_OK);
333
+                ogs_assert(r != OGS_ERROR);
334
 
335
             } else if (e->s1ap_code ==
336
                     S1AP_ProcedureCode_id_uplinkNASTransport) {
337
@@ -575,10 +582,10 @@
338
 
339
                 if (!MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
340
                     ogs_warn("No P-TMSI : UE%s", mme_ue->imsi_bcd);
341
-                    ogs_assert(OGS_OK ==
342
-                        nas_eps_send_service_reject(mme_ue,
343
-                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
344
-                    );
345
+                    r = nas_eps_send_service_reject(mme_ue,
346
+                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
347
+                    ogs_expect(r == OGS_OK);
348
+                    ogs_assert(r != OGS_ERROR);
349
                     break;
350
                 }
351
 
352
@@ -600,16 +607,17 @@
353
                 } else {
354
                     ogs_warn(" Unknown CSFB Service Type%d",
355
                             mme_ue->nas_eps.service.value);
356
-                    ogs_assert(OGS_OK ==
357
-                        nas_eps_send_service_reject(mme_ue,
358
-                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK)
359
-                    );
360
+                    r = nas_eps_send_service_reject(mme_ue,
361
+                        OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
362
+                    ogs_expect(r == OGS_OK);
363
+                    ogs_assert(r != OGS_ERROR);
364
                     OGS_FSM_TRAN(s, &emm_state_exception);
365
                     break;
366
                 }
367
 
368
-                ogs_assert(OGS_OK ==
369
-                    s1ap_send_ue_context_modification_request(mme_ue));
370
+                r = s1ap_send_ue_context_modification_request(mme_ue);
371
+                ogs_expect(r == OGS_OK);
372
+                ogs_assert(r != OGS_ERROR);
373
             } else {
374
                 ogs_error("Invalid Procedure Code%d", (int)e->s1ap_code);
375
             }
376
@@ -646,10 +654,11 @@
377
 
378
             CLEAR_MME_UE_TIMER(mme_ue->t3422);
379
 
380
-            rv = s1ap_send_ue_context_release_command(enb_ue,
381
+            r = s1ap_send_ue_context_release_command(enb_ue,
382
                     S1AP_Cause_PR_nas, S1AP_CauseNas_detach,
383
                     S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
384
-            ogs_expect(rv == OGS_OK);
385
+            ogs_expect(r == OGS_OK);
386
+            ogs_assert(r != OGS_ERROR);
387
 
388
             OGS_FSM_TRAN(s, &emm_state_de_registered);
389
             break;
390
@@ -669,11 +678,12 @@
391
                 MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id;
392
                 ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
393
 
394
-                ogs_assert(OGS_OK ==
395
-                    s1ap_send_error_indication(enb_ue->enb, 
396
+                r = s1ap_send_error_indication(enb_ue->enb, 
397
                         &MME_UE_S1AP_ID, &ENB_UE_S1AP_ID,
398
                         S1AP_Cause_PR_transport,
399
-                        S1AP_CauseTransport_transport_resource_unavailable));
400
+                        S1AP_CauseTransport_transport_resource_unavailable);
401
+                ogs_expect(r == OGS_OK);
402
+                ogs_assert(r != OGS_ERROR);
403
             }
404
             break;
405
 
406
@@ -700,7 +710,7 @@
407
 
408
 void emm_state_authentication(ogs_fsm_t *s, mme_event_t *e)
409
 {
410
-    int rv;
411
+    int r, rv;
412
     mme_ue_t *mme_ue = NULL;
413
     ogs_nas_eps_message_t *message = NULL;
414
 
415
@@ -745,8 +755,9 @@
416
                         authentication_response_parameter->length);
417
                 ogs_log_hexdump(OGS_LOG_WARN,
418
                         mme_ue->xres, OGS_MAX_RES_LEN);
419
-                ogs_assert(OGS_OK ==
420
-                    nas_eps_send_authentication_reject(mme_ue));
421
+                r = nas_eps_send_authentication_reject(mme_ue);
422
+                ogs_expect(r == OGS_OK);
423
+                ogs_assert(r != OGS_ERROR);
424
                 OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
425
             } else {
426
                 OGS_FSM_TRAN(&mme_ue->sm, &emm_state_security_mode);
427
@@ -789,8 +800,9 @@
428
                 break;
429
             }
430
 
431
-            ogs_assert(OGS_OK ==
432
-                nas_eps_send_authentication_reject(mme_ue));
433
+            r = nas_eps_send_authentication_reject(mme_ue);
434
+            ogs_expect(r == OGS_OK);
435
+            ogs_assert(r != OGS_ERROR);
436
             OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
437
 
438
             break;
439
@@ -841,16 +853,14 @@
440
                         "Stop retransmission", mme_ue->imsi_bcd);
441
                 OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
442
 
443
-                ogs_expect(OGS_OK ==
444
-                    nas_eps_send_authentication_reject(mme_ue));
445
+                r = nas_eps_send_authentication_reject(mme_ue);
446
+                ogs_expect(r == OGS_OK);
447
+                ogs_assert(r != OGS_ERROR);
448
             } else {
449
-                rv = nas_eps_send_authentication_request(mme_ue);
450
-                if (rv == OGS_OK) {
451
-                    mme_ue->t3460.retry_count++;
452
-                } else {
453
-                    ogs_error("nas_eps_send_authentication_request() failed");
454
-                    OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
455
-                }
456
+                mme_ue->t3460.retry_count++;
457
+                r = nas_eps_send_authentication_request(mme_ue);
458
+                ogs_expect(r == OGS_OK);
459
+                ogs_assert(r != OGS_ERROR);
460
             }
461
             break;
462
         default:
463
@@ -867,7 +877,7 @@
464
 
465
 void emm_state_security_mode(ogs_fsm_t *s, mme_event_t *e)
466
 {
467
-    int rv;
468
+    int r, rv;
469
     mme_ue_t *mme_ue = NULL;
470
     ogs_nas_eps_message_t *message = NULL;
471
     ogs_nas_security_header_type_t h;
472
@@ -883,8 +893,9 @@
473
     switch (e->id) {
474
     case OGS_FSM_ENTRY_SIG:
475
         CLEAR_MME_UE_TIMER(mme_ue->t3460);
476
-        ogs_assert(OGS_OK ==
477
-            nas_eps_send_security_mode_command(mme_ue));
478
+        r = nas_eps_send_security_mode_command(mme_ue);
479
+        ogs_expect(r == OGS_OK);
480
+        ogs_assert(r != OGS_ERROR);
481
         break;
482
     case OGS_FSM_EXIT_SIG:
483
         break;
484
@@ -895,9 +906,10 @@
485
         if (message->emm.h.security_header_type
486
                 == OGS_NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) {
487
             ogs_debug("Service request");
488
-            ogs_assert(OGS_OK ==
489
-                nas_eps_send_service_reject(mme_ue,
490
-                    OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
491
+            r = nas_eps_send_service_reject(mme_ue,
492
+                    OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED);
493
+            ogs_expect(r == OGS_OK);
494
+            ogs_assert(r != OGS_ERROR);
495
             OGS_FSM_TRAN(s, &emm_state_exception);
496
             break;
497
         }
498
@@ -979,9 +991,10 @@
499
             break;
500
         case OGS_NAS_EPS_TRACKING_AREA_UPDATE_REQUEST:
501
             ogs_debug("Tracking area update request");
502
-            ogs_assert(OGS_OK ==
503
-                nas_eps_send_tau_reject(mme_ue,
504
-                    OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
505
+            r = nas_eps_send_tau_reject(mme_ue,
506
+                    OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED);
507
+            ogs_expect(r == OGS_OK);
508
+            ogs_assert(r != OGS_ERROR);
509
             OGS_FSM_TRAN(s, &emm_state_exception);
510
             break;
511
         case OGS_NAS_EPS_EMM_STATUS:
512
@@ -1017,18 +1030,16 @@
513
                         "Stop retransmission", mme_ue->imsi_bcd);
514
                 OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
515
 
516
-                ogs_expect(OGS_OK ==
517
-                    nas_eps_send_attach_reject(mme_ue,
518
+                r = nas_eps_send_attach_reject(mme_ue,
519
                         OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
520
-                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
521
+                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
522
+                ogs_expect(r == OGS_OK);
523
+                ogs_assert(r != OGS_ERROR);
524
             } else {
525
-                rv = nas_eps_send_security_mode_command(mme_ue);
526
-                if (rv == OGS_OK) {
527
-                    mme_ue->t3460.retry_count++;
528
-                } else {
529
-                    ogs_error("nas_eps_send_security_mode_command() failed");
530
-                    OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
531
-                }
532
+                mme_ue->t3460.retry_count++;
533
+                r = nas_eps_send_security_mode_command(mme_ue);
534
+                ogs_expect(r == OGS_OK);
535
+                ogs_assert(r != OGS_ERROR);
536
             }
537
             break;
538
         default:
539
@@ -1045,7 +1056,7 @@
540
 
541
 void emm_state_initial_context_setup(ogs_fsm_t *s, mme_event_t *e)
542
 {
543
-    int rv;
544
+    int r, rv;
545
     mme_ue_t *mme_ue = NULL;
546
     ogs_nas_eps_message_t *message = NULL;
547
     ogs_nas_security_header_type_t h;
548
@@ -1070,9 +1081,10 @@
549
         if (message->emm.h.security_header_type
550
                 == OGS_NAS_SECURITY_HEADER_FOR_SERVICE_REQUEST_MESSAGE) {
551
             ogs_debug("Service request");
552
-            ogs_assert(OGS_OK ==
553
-                nas_eps_send_service_reject(mme_ue,
554
-                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK));
555
+            r = nas_eps_send_service_reject(mme_ue,
556
+                    OGS_NAS_EMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK);
557
+            ogs_expect(r == OGS_OK);
558
+            ogs_assert(r != OGS_ERROR);
559
             OGS_FSM_TRAN(s, &emm_state_exception);
560
             break;
561
         }
562
@@ -1225,7 +1237,10 @@
563
                 mme_ue->t3450.retry_count++;
564
 
565
                 emmbuf = mme_ue->t3450.pkbuf;
566
-                ogs_expect_or_return(emmbuf);
567
+                if (!emmbuf) {
568
+                    ogs_error("No emmbuf");
569
+                    return;
570
+                }
571
 
572
                 mme_ue->t3450.pkbuf = ogs_pkbuf_copy(emmbuf);
573
                 ogs_assert(mme_ue->t3450.pkbuf);
574
@@ -1233,12 +1248,9 @@
575
                 ogs_timer_start(mme_ue->t3450.timer,
576
                         mme_timer_cfg(MME_TIMER_T3450)->duration);
577
 
578
-                rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
579
-                if (rv != OGS_OK) {
580
-                    ogs_error("nas_eps_send_to_downlink_nas_transport() "
581
-                            "failed");
582
-                    OGS_FSM_TRAN(&mme_ue->sm, &emm_state_exception);
583
-                }
584
+                r = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
585
+                ogs_expect(r == OGS_OK);
586
+                ogs_assert(r != OGS_ERROR);
587
             }
588
             break;
589
         default:
590
@@ -1255,7 +1267,7 @@
591
 
592
 void emm_state_exception(ogs_fsm_t *s, mme_event_t *e)
593
 {
594
-    int rv;
595
+    int r, rv;
596
 
597
     mme_ue_t *mme_ue = NULL;
598
     enb_ue_t *enb_ue = NULL;
599
@@ -1298,8 +1310,9 @@
600
 
601
             if (!MME_UE_HAVE_IMSI(mme_ue)) {
602
                 CLEAR_MME_UE_TIMER(mme_ue->t3470);
603
-                ogs_assert(OGS_OK ==
604
-                    nas_eps_send_identity_request(mme_ue));
605
+                r = nas_eps_send_identity_request(mme_ue);
606
+                ogs_expect(r == OGS_OK);
607
+                ogs_assert(r != OGS_ERROR);
608
 
609
                 OGS_FSM_TRAN(s, &emm_state_de_registered);
610
                 break;
611
@@ -1314,10 +1327,11 @@
612
                             &mme_ue->pdn_connectivity_request);
613
                     if (rv != OGS_OK) {
614
                         ogs_error("nas_eps_send_emm_to_esm() failed");
615
-                        ogs_assert(OGS_OK ==
616
-                            nas_eps_send_attach_reject(mme_ue,
617
+                        r = nas_eps_send_attach_reject(mme_ue,
618
                                 OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
619
-                                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
620
+                                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
621
+                        ogs_expect(r == OGS_OK);
622
+                        ogs_assert(r != OGS_ERROR);
623
                         OGS_FSM_TRAN(s, &emm_state_exception);
624
                         break;
625
                     }
626
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/esm-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/esm-handler.c Changed
136
 
1
@@ -31,6 +31,7 @@
2
 int esm_handle_pdn_connectivity_request(mme_bearer_t *bearer, 
3
         ogs_nas_eps_pdn_connectivity_request_t *req, int create_action)
4
 {
5
+    int r;
6
     mme_ue_t *mme_ue = NULL;
7
     mme_sess_t *sess = NULL;
8
     uint8_t security_protected_required = 0;
9
@@ -65,9 +66,11 @@
10
                             mme_ue, req->access_point_name.apn);
11
         if (!sess->session) {
12
             /* Invalid APN */
13
-            ogs_assert(OGS_OK ==
14
-                nas_eps_send_pdn_connectivity_reject(
15
-                    sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action));
16
+            r = nas_eps_send_pdn_connectivity_reject(
17
+                    sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN,
18
+                    create_action);
19
+            ogs_expect(r == OGS_OK);
20
+            ogs_assert(r != OGS_ERROR);
21
             ogs_warn("Invalid APN%s", req->access_point_name.apn);
22
             return OGS_ERROR;
23
         }
24
@@ -80,9 +83,11 @@
25
             if (derived_pdn_type == 0) {
26
                 ogs_error("Cannot derived PDN Type UE:%d,HSS:%d",
27
                     sess->request_type.type, sess->session->session_type);
28
-                ogs_assert(OGS_OK ==
29
-                    nas_eps_send_pdn_connectivity_reject(
30
-                        sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE, create_action));
31
+                r = nas_eps_send_pdn_connectivity_reject(
32
+                        sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE,
33
+                        create_action);
34
+                ogs_expect(r == OGS_OK);
35
+                ogs_assert(r != OGS_ERROR);
36
                 return OGS_ERROR;
37
             }
38
         } else {
39
@@ -102,7 +107,9 @@
40
 
41
     if (security_protected_required) {
42
         CLEAR_BEARER_TIMER(bearer->t3489);
43
-        ogs_assert(OGS_OK == nas_eps_send_esm_information_request(bearer));
44
+        r = nas_eps_send_esm_information_request(bearer);
45
+        ogs_expect(r == OGS_OK);
46
+        ogs_assert(r != OGS_ERROR);
47
 
48
         return OGS_OK;
49
     }
50
@@ -137,9 +144,10 @@
51
             mme_gtp_send_create_session_request(sess, create_action));
52
     } else {
53
         ogs_error("No APN");
54
-        ogs_assert(OGS_OK ==
55
-            nas_eps_send_pdn_connectivity_reject(
56
-                sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action));
57
+        r = nas_eps_send_pdn_connectivity_reject(
58
+                sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN, create_action);
59
+        ogs_expect(r == OGS_OK);
60
+        ogs_assert(r != OGS_ERROR);
61
         return OGS_ERROR;
62
     }
63
 
64
@@ -149,6 +157,7 @@
65
 int esm_handle_information_response(mme_sess_t *sess, 
66
         ogs_nas_eps_esm_information_response_t *rsp)
67
 {
68
+    int r;
69
     mme_ue_t *mme_ue = NULL;
70
 
71
     ogs_assert(sess);
72
@@ -183,10 +192,11 @@
73
             if (derived_pdn_type == 0) {
74
                 ogs_error("Cannot derived PDN Type UE:%d,HSS:%d",
75
                     sess->request_type.type, sess->session->session_type);
76
-                ogs_assert(OGS_OK ==
77
-                    nas_eps_send_pdn_connectivity_reject(
78
+                r = nas_eps_send_pdn_connectivity_reject(
79
                         sess, OGS_NAS_ESM_CAUSE_UNKNOWN_PDN_TYPE,
80
-                        OGS_GTP_CREATE_IN_ATTACH_REQUEST));
81
+                        OGS_GTP_CREATE_IN_ATTACH_REQUEST);
82
+                ogs_expect(r == OGS_OK);
83
+                ogs_assert(r != OGS_ERROR);
84
                 return OGS_ERROR;
85
             }
86
         } else {
87
@@ -203,8 +213,9 @@
88
                 ogs_assert(OGS_OK ==
89
                     sgsap_send_location_update_request(mme_ue));
90
             } else {
91
-                ogs_assert(OGS_OK ==
92
-                    nas_eps_send_attach_accept(mme_ue));
93
+                r = nas_eps_send_attach_accept(mme_ue);
94
+                ogs_expect(r == OGS_OK);
95
+                ogs_assert(r != OGS_ERROR);
96
             }
97
         } else {
98
             ogs_assert(OGS_OK ==
99
@@ -217,10 +228,11 @@
100
         else
101
             ogs_error("No APN");
102
 
103
-        ogs_assert(OGS_OK ==
104
-            nas_eps_send_pdn_connectivity_reject(
105
+        r = nas_eps_send_pdn_connectivity_reject(
106
                 sess, OGS_NAS_ESM_CAUSE_MISSING_OR_UNKNOWN_APN,
107
-                OGS_GTP_CREATE_IN_ATTACH_REQUEST));
108
+                OGS_GTP_CREATE_IN_ATTACH_REQUEST);
109
+        ogs_expect(r == OGS_OK);
110
+        ogs_assert(r != OGS_ERROR);
111
         return OGS_ERROR;
112
     }
113
 
114
@@ -230,6 +242,7 @@
115
 int esm_handle_bearer_resource_allocation_request(
116
         mme_bearer_t *bearer, ogs_nas_eps_message_t *message)
117
 {
118
+    int r;
119
     mme_ue_t *mme_ue = NULL;
120
     mme_sess_t *sess = NULL;
121
 
122
@@ -239,9 +252,10 @@
123
     mme_ue = sess->mme_ue;
124
     ogs_assert(mme_ue);
125
 
126
-    ogs_assert(OGS_OK ==
127
-        nas_eps_send_bearer_resource_allocation_reject(
128
-            mme_ue, sess->pti, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
129
+    r = nas_eps_send_bearer_resource_allocation_reject(
130
+            mme_ue, sess->pti, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
131
+    ogs_expect(r == OGS_OK);
132
+    ogs_assert(r != OGS_ERROR);
133
 
134
     return OGS_OK;
135
 }
136
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/esm-sm.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/esm-sm.c Changed
117
 
1
@@ -68,7 +68,7 @@
2
 
3
 void esm_state_inactive(ogs_fsm_t *s, mme_event_t *e)
4
 {
5
-    int rv;
6
+    int r, rv;
7
     mme_ue_t *mme_ue = NULL;
8
     mme_sess_t *sess = NULL;
9
     mme_bearer_t *bearer = NULL;
10
@@ -122,8 +122,9 @@
11
                     mme_gtp_send_delete_session_request(mme_ue->sgw_ue, sess,
12
                     OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST));
13
             } else {
14
-                ogs_assert(OGS_OK ==
15
-                    nas_eps_send_deactivate_bearer_context_request(bearer));
16
+                r = nas_eps_send_deactivate_bearer_context_request(bearer);
17
+                ogs_expect(r == OGS_OK);
18
+                ogs_assert(r != OGS_ERROR);
19
             }
20
             OGS_FSM_TRAN(s, esm_state_pdn_will_disconnect);
21
             break;
22
@@ -137,30 +138,34 @@
23
             h.type = e->nas_type;
24
             if (h.integrity_protected == 0) {
25
                 ogs_error("%s No Integrity Protected", mme_ue->imsi_bcd);
26
-                ogs_assert(OGS_OK ==
27
-                    nas_eps_send_attach_reject(mme_ue,
28
+                r = nas_eps_send_attach_reject(mme_ue,
29
                         OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
30
-                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
31
+                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
32
+                ogs_expect(r == OGS_OK);
33
+                ogs_assert(r != OGS_ERROR);
34
                 ogs_assert(mme_ue->enb_ue);
35
-                ogs_assert(OGS_OK ==
36
-                    s1ap_send_ue_context_release_command(mme_ue->enb_ue,
37
+                r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
38
                         S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
39
-                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
40
+                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
41
+                ogs_expect(r == OGS_OK);
42
+                ogs_assert(r != OGS_ERROR);
43
                 OGS_FSM_TRAN(s, &esm_state_exception);
44
                 break;
45
             }
46
 
47
             if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
48
                 ogs_warn("%s No Security Context", mme_ue->imsi_bcd);
49
-                ogs_assert(OGS_OK ==
50
-                    nas_eps_send_attach_reject(mme_ue,
51
+                r = nas_eps_send_attach_reject(mme_ue,
52
                         OGS_NAS_EMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED,
53
-                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
54
+                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
55
+                ogs_expect(r == OGS_OK);
56
+                ogs_assert(r != OGS_ERROR);
57
                 ogs_assert(mme_ue->enb_ue);
58
-                ogs_assert(OGS_OK ==
59
-                    s1ap_send_ue_context_release_command(mme_ue->enb_ue,
60
+                r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
61
                         S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
62
-                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
63
+                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
64
+                ogs_expect(r == OGS_OK);
65
+                ogs_assert(r != OGS_ERROR);
66
                 OGS_FSM_TRAN(s, &esm_state_exception);
67
                 break;
68
             }
69
@@ -230,18 +235,16 @@
70
                         "Stop retransmission", mme_ue->imsi_bcd);
71
                 OGS_FSM_TRAN(&bearer->sm, &esm_state_exception);
72
 
73
-                ogs_assert(OGS_OK ==
74
-                    nas_eps_send_pdn_connectivity_reject(sess,
75
+                r = nas_eps_send_pdn_connectivity_reject(sess,
76
                         OGS_NAS_ESM_CAUSE_ESM_INFORMATION_NOT_RECEIVED,
77
-                        e->create_action));
78
+                        e->create_action);
79
+                ogs_expect(r == OGS_OK);
80
+                ogs_assert(r != OGS_ERROR);
81
             } else {
82
-                rv = nas_eps_send_esm_information_request(bearer);
83
-                if (rv == OGS_OK) {
84
-                    bearer->t3489.retry_count++;
85
-                } else {
86
-                    ogs_error("nas_eps_send_esm_information_request() failed");
87
-                    OGS_FSM_TRAN(&bearer->sm, &esm_state_exception);
88
-                }
89
+                bearer->t3489.retry_count++;
90
+                r = nas_eps_send_esm_information_request(bearer);
91
+                ogs_expect(r == OGS_OK);
92
+                ogs_assert(r != OGS_ERROR);
93
             }
94
             break;
95
         default:
96
@@ -258,7 +261,7 @@
97
 
98
 void esm_state_active(ogs_fsm_t *s, mme_event_t *e)
99
 {
100
-    int rv;
101
+    int r, rv;
102
     mme_ue_t *mme_ue = NULL;
103
     mme_sess_t *sess = NULL;
104
     mme_bearer_t *bearer = NULL;
105
@@ -309,8 +312,9 @@
106
                     mme_gtp_send_delete_session_request(mme_ue->sgw_ue, sess,
107
                     OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST));
108
             } else {
109
-                ogs_assert(OGS_OK ==
110
-                    nas_eps_send_deactivate_bearer_context_request(bearer));
111
+                r = nas_eps_send_deactivate_bearer_context_request(bearer);
112
+                ogs_expect(r == OGS_OK);
113
+                ogs_assert(r != OGS_ERROR);
114
             }
115
             OGS_FSM_TRAN(s, esm_state_pdn_will_disconnect);
116
             break;
117
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/mme-context.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/mme-context.c Changed
115
 
1
@@ -3223,6 +3223,7 @@
2
 mme_bearer_t *mme_bearer_find_or_add_by_message(
3
         mme_ue_t *mme_ue, ogs_nas_eps_message_t *message, int create_action)
4
 {
5
+    int r;
6
     uint8_t pti = OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED;
7
     uint8_t ebi = OGS_NAS_EPS_BEARER_IDENTITY_UNASSIGNED;
8
 
9
@@ -3242,10 +3243,11 @@
10
         bearer = mme_bearer_find_by_ue_ebi(mme_ue, ebi);
11
         if (!bearer) {
12
             ogs_error("No Bearer : EBI%d", ebi);
13
-            ogs_assert(OGS_OK ==
14
-                nas_eps_send_attach_reject(mme_ue,
15
+            r = nas_eps_send_attach_reject(mme_ue,
16
                     OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
17
-                    OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
18
+                    OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
19
+            ogs_expect(r == OGS_OK);
20
+            ogs_assert(r != OGS_ERROR);
21
             return NULL;
22
         }
23
 
24
@@ -3254,10 +3256,11 @@
25
 
26
     if (pti == OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED) {
27
         ogs_error("Both PTI%d and EBI%d are 0", pti, ebi);
28
-        ogs_assert(OGS_OK ==
29
-            nas_eps_send_attach_reject(mme_ue,
30
+        r = nas_eps_send_attach_reject(mme_ue,
31
                 OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
32
-                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
33
+                OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
34
+        ogs_expect(r == OGS_OK);
35
+        ogs_assert(r != OGS_ERROR);
36
         return NULL;
37
     }
38
 
39
@@ -3272,10 +3275,11 @@
40
         if (!bearer) {
41
             ogs_error("No Bearer : Linked-EBI%d",
42
                     linked_eps_bearer_identity->eps_bearer_identity);
43
-            ogs_assert(OGS_OK ==
44
-                nas_eps_send_attach_reject(mme_ue,
45
+            r = nas_eps_send_attach_reject(mme_ue,
46
                     OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
47
-                    OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
48
+                    OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
49
+            ogs_expect(r == OGS_OK);
50
+            ogs_assert(r != OGS_ERROR);
51
             return NULL;
52
         }
53
     } else if (message->esm.h.message_type ==
54
@@ -3291,10 +3295,11 @@
55
         if (!bearer) {
56
             ogs_error("No Bearer : Linked-EBI%d",
57
                     linked_eps_bearer_identity->eps_bearer_identity);
58
-            ogs_assert(OGS_OK ==
59
-                nas_eps_send_bearer_resource_allocation_reject(
60
+            r = nas_eps_send_bearer_resource_allocation_reject(
61
                     mme_ue, pti,
62
-                    OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY));
63
+                    OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
64
+            ogs_expect(r == OGS_OK);
65
+            ogs_assert(r != OGS_ERROR);
66
             return NULL;
67
         }
68
 
69
@@ -3311,10 +3316,11 @@
70
         if (!bearer) {
71
             ogs_error("No Bearer : Linked-EBI%d",
72
                     linked_eps_bearer_identity->eps_bearer_identity);
73
-            ogs_assert(OGS_OK ==
74
-                nas_eps_send_bearer_resource_modification_reject(
75
+            r = nas_eps_send_bearer_resource_modification_reject(
76
                     mme_ue, pti,
77
-                    OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY));
78
+                    OGS_NAS_ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY);
79
+            ogs_expect(r == OGS_OK);
80
+            ogs_assert(r != OGS_ERROR);
81
             return NULL;
82
         }
83
     }
84
@@ -3335,11 +3341,12 @@
85
             sess = mme_sess_find_by_apn(mme_ue,
86
                     pdn_connectivity_request->access_point_name.apn);
87
             if (sess && create_action != OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
88
-                ogs_assert(OGS_OK ==
89
-                    nas_eps_send_pdn_connectivity_reject(
90
+                r = nas_eps_send_pdn_connectivity_reject(
91
                         sess,
92
                         OGS_NAS_ESM_CAUSE_MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED,
93
-                        create_action));
94
+                        create_action);
95
+                ogs_expect(r == OGS_OK);
96
+                ogs_assert(r != OGS_ERROR);
97
                 ogs_warn("APN duplicated %s",
98
                     pdn_connectivity_request->access_point_name.apn);
99
                 return NULL;
100
@@ -3359,10 +3366,11 @@
101
         if (!sess) {
102
             ogs_error("No Session : ESM message type%d, PTI%d",
103
                     message->esm.h.message_type, pti);
104
-            ogs_assert(OGS_OK ==
105
-                nas_eps_send_attach_reject(mme_ue,
106
+            r = nas_eps_send_attach_reject(mme_ue,
107
                     OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
108
-                    OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
109
+                    OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
110
+            ogs_expect(r == OGS_OK);
111
+            ogs_assert(r != OGS_ERROR);
112
             return NULL;
113
         }
114
     }
115
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/mme-gtp-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/mme-gtp-path.c Changed
24
 
1
@@ -76,6 +76,7 @@
2
 
3
 static void timeout(ogs_gtp_xact_t *xact, void *data)
4
 {
5
+    int r;
6
     mme_ue_t *mme_ue = NULL;
7
     enb_ue_t *enb_ue = NULL;
8
     mme_sess_t *sess = NULL;
9
@@ -131,10 +132,11 @@
10
 
11
         enb_ue = enb_ue_cycle(mme_ue->enb_ue);
12
         if (enb_ue) {
13
-            ogs_assert(OGS_OK ==
14
-                s1ap_send_ue_context_release_command(enb_ue,
15
+            r = s1ap_send_ue_context_release_command(enb_ue,
16
                     S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
17
-                    S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
18
+                    S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
19
+            ogs_expect(r == OGS_OK);
20
+            ogs_assert(r != OGS_ERROR);
21
         } else {
22
             ogs_warn("No S1 Context");
23
         }
24
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/mme-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/mme-path.c Changed
124
 
1
@@ -26,6 +26,7 @@
2
 
3
 void mme_send_delete_session_or_detach(mme_ue_t *mme_ue)
4
 {
5
+    int r;
6
     ogs_assert(mme_ue);
7
 
8
     switch (mme_ue->detach_type) {
9
@@ -35,7 +36,9 @@
10
             mme_gtp_send_delete_all_sessions(
11
                     mme_ue, OGS_GTP_DELETE_SEND_DETACH_ACCEPT);
12
         } else {
13
-            ogs_assert(OGS_OK == nas_eps_send_detach_accept(mme_ue));
14
+            r = nas_eps_send_detach_accept(mme_ue);
15
+            ogs_expect(r == OGS_OK);
16
+            ogs_assert(r != OGS_ERROR);
17
         }
18
         break;
19
 
20
@@ -94,6 +97,7 @@
21
 
22
 void mme_send_delete_session_or_mme_ue_context_release(mme_ue_t *mme_ue)
23
 {
24
+    int r;
25
     ogs_assert(mme_ue);
26
 
27
     if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue)) {
28
@@ -102,10 +106,11 @@
29
     } else {
30
         enb_ue_t *enb_ue = enb_ue_cycle(mme_ue->enb_ue);
31
         if (enb_ue) {
32
-            ogs_assert(OGS_OK ==
33
-                s1ap_send_ue_context_release_command(enb_ue,
34
+            r = s1ap_send_ue_context_release_command(enb_ue,
35
                     S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
36
-                    S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
37
+                    S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
38
+            ogs_expect(r == OGS_OK);
39
+            ogs_assert(r != OGS_ERROR);
40
         } else {
41
             ogs_warn("%s No S1 Context", mme_ue->imsi_bcd);
42
         }
43
@@ -114,6 +119,7 @@
44
 
45
 void mme_send_release_access_bearer_or_ue_context_release(enb_ue_t *enb_ue)
46
 {
47
+    int r;
48
     mme_ue_t *mme_ue = NULL;
49
     ogs_assert(enb_ue);
50
 
51
@@ -125,15 +131,17 @@
52
                 mme_ue, OGS_GTP_RELEASE_SEND_UE_CONTEXT_RELEASE_COMMAND));
53
     } else {
54
         ogs_debug("No UE Context");
55
-        ogs_assert(OGS_OK ==
56
-            s1ap_send_ue_context_release_command(enb_ue,
57
+        r = s1ap_send_ue_context_release_command(enb_ue,
58
                 S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
59
-                S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0));
60
+                S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
61
+        ogs_expect(r == OGS_OK);
62
+        ogs_assert(r != OGS_ERROR);
63
     }
64
 }
65
 
66
 void mme_send_after_paging(mme_ue_t *mme_ue, bool failed)
67
 {
68
+    int r;
69
     mme_bearer_t *bearer = NULL;
70
 
71
     ogs_assert(mme_ue);
72
@@ -168,8 +176,9 @@
73
                 mme_gtp_send_create_bearer_response(
74
                     bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE));
75
         } else {
76
-            ogs_assert(OGS_OK ==
77
-                nas_eps_send_activate_dedicated_bearer_context_request(bearer));
78
+            r = nas_eps_send_activate_dedicated_bearer_context_request(bearer);
79
+            ogs_expect(r == OGS_OK);
80
+            ogs_assert(r != OGS_ERROR);
81
         }
82
         break;
83
     case MME_PAGING_TYPE_UPDATE_BEARER:
84
@@ -190,12 +199,13 @@
85
                 goto cleanup;
86
             }
87
 
88
-            ogs_assert(OGS_OK ==
89
-                nas_eps_send_modify_bearer_context_request(bearer,
90
+            r = nas_eps_send_modify_bearer_context_request(bearer,
91
                     (xact->update_flags &
92
                         OGS_GTP_MODIFY_QOS_UPDATE) ? 1 : 0,
93
                     (xact->update_flags &
94
-                        OGS_GTP_MODIFY_TFT_UPDATE) ? 1 : 0));
95
+                        OGS_GTP_MODIFY_TFT_UPDATE) ? 1 : 0);
96
+            ogs_expect(r == OGS_OK);
97
+            ogs_assert(r != OGS_ERROR);
98
         }
99
         break;
100
     case MME_PAGING_TYPE_DELETE_BEARER:
101
@@ -210,8 +220,9 @@
102
                 mme_gtp_send_delete_bearer_response(
103
                     bearer, OGS_GTP2_CAUSE_UNABLE_TO_PAGE_UE));
104
         } else {
105
-            ogs_assert(OGS_OK ==
106
-                nas_eps_send_deactivate_bearer_context_request(bearer));
107
+            r = nas_eps_send_deactivate_bearer_context_request(bearer);
108
+            ogs_expect(r == OGS_OK);
109
+            ogs_assert(r != OGS_ERROR);
110
         }
111
         break;
112
     case MME_PAGING_TYPE_CS_CALL_SERVICE:
113
@@ -239,7 +250,9 @@
114
             /* Nothing */
115
             ogs_warn("MME-initiated Detach cannot be invoked");
116
         } else {
117
-            ogs_assert(OGS_OK == nas_eps_send_detach_request(mme_ue));
118
+            r = nas_eps_send_detach_request(mme_ue);
119
+            ogs_expect(r == OGS_OK);
120
+            ogs_assert(r != OGS_ERROR);
121
             if (MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
122
                 ogs_assert(OGS_OK == sgsap_send_detach_indication(mme_ue));
123
             } else {
124
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/mme-s11-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/mme-s11-handler.c Changed
450
 
1
@@ -81,7 +81,7 @@
2
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
3
         ogs_gtp2_create_session_response_t *rsp)
4
 {
5
-    int rv, i;
6
+    int i, r, rv;
7
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
8
     uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
9
     uint8_t bearer_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
10
@@ -151,8 +151,11 @@
11
         if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
12
             ogs_error("%s Attach reject Cause:%d",
13
                     mme_ue->imsi_bcd, session_cause);
14
-            ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
15
-                    OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
16
+            r = nas_eps_send_attach_reject(mme_ue,
17
+                    OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
18
+                    OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
19
+            ogs_expect(r == OGS_OK);
20
+            ogs_assert(r != OGS_ERROR);
21
         }
22
         mme_send_delete_session_or_mme_ue_context_release(mme_ue);
23
         return;
24
@@ -216,9 +219,11 @@
25
         if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
26
             ogs_error("%s Attach reject Cause:%d",
27
                     mme_ue->imsi_bcd, session_cause);
28
-            ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
29
+            r = nas_eps_send_attach_reject(mme_ue,
30
                     OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
31
-                    OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
32
+                    OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
33
+            ogs_expect(r == OGS_OK);
34
+            ogs_assert(r != OGS_ERROR);
35
         }
36
         mme_send_delete_session_or_mme_ue_context_release(mme_ue);
37
         return;
38
@@ -246,9 +251,11 @@
39
                     mme_ue->imsi_bcd, bearer_cause);
40
             if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
41
                 ogs_error("%s Attach reject", mme_ue->imsi_bcd);
42
-                ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
43
+                r = nas_eps_send_attach_reject(mme_ue,
44
                         OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
45
-                        OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
46
+                        OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
47
+                ogs_expect(r == OGS_OK);
48
+                ogs_assert(r != OGS_ERROR);
49
             }
50
             mme_send_delete_session_or_mme_ue_context_release(mme_ue);
51
             return;
52
@@ -264,8 +271,11 @@
53
         ogs_error("%s GTP Cause VALUE:%d", mme_ue->imsi_bcd, session_cause);
54
         if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
55
             ogs_error("%s Attach reject", mme_ue->imsi_bcd);
56
-            ogs_assert(OGS_OK == nas_eps_send_attach_reject(mme_ue,
57
-                    OGS_NAS_EMM_CAUSE_NETWORK_FAILURE, OGS_NAS_ESM_CAUSE_NETWORK_FAILURE));
58
+            r = nas_eps_send_attach_reject(mme_ue,
59
+                    OGS_NAS_EMM_CAUSE_NETWORK_FAILURE,
60
+                    OGS_NAS_ESM_CAUSE_NETWORK_FAILURE);
61
+            ogs_expect(r == OGS_OK);
62
+            ogs_assert(r != OGS_ERROR);
63
         }
64
         mme_send_delete_session_or_mme_ue_context_release(mme_ue);
65
         return;
66
@@ -395,15 +405,17 @@
67
         } else {
68
             ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(
69
                         session->paa.session_type));
70
-            ogs_assert(OGS_OK ==
71
-                nas_eps_send_attach_accept(mme_ue));
72
+            r = nas_eps_send_attach_accept(mme_ue);
73
+            ogs_expect(r == OGS_OK);
74
+            ogs_assert(r != OGS_ERROR);
75
         }
76
 
77
     } else if (create_action == OGS_GTP_CREATE_IN_UPLINK_NAS_TRANSPORT) {
78
         ogs_assert(OGS_PDU_SESSION_TYPE_IS_VALID(session->paa.session_type));
79
-        ogs_assert(OGS_OK ==
80
-            nas_eps_send_activate_default_bearer_context_request(
81
-                bearer, create_action));
82
+        r = nas_eps_send_activate_default_bearer_context_request(
83
+                bearer, create_action);
84
+        ogs_expect(r == OGS_OK);
85
+        ogs_assert(r != OGS_ERROR);
86
     } else if (create_action == OGS_GTP_CREATE_IN_PATH_SWITCH_REQUEST) {
87
 
88
         GTP_COUNTER_CHECK(mme_ue, GTP_COUNTER_CREATE_SESSION_BY_PATH_SWITCH,
89
@@ -411,7 +423,9 @@
90
                     mme_timer_cfg(MME_TIMER_S11_HOLDING)->duration);
91
 
92
             sgw_ue_associate_mme_ue(target_ue, mme_ue);
93
-            ogs_assert(OGS_OK == s1ap_send_path_switch_ack(mme_ue, true));
94
+            r = s1ap_send_path_switch_ack(mme_ue, true);
95
+            ogs_expect(r == OGS_OK);
96
+            ogs_assert(r != OGS_ERROR);
97
         );
98
 
99
     } else {
100
@@ -424,7 +438,7 @@
101
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
102
         ogs_gtp2_modify_bearer_response_t *rsp)
103
 {
104
-    int rv;
105
+    int r, rv;
106
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
107
     uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
108
     int modify_action = 0;
109
@@ -511,10 +525,14 @@
110
 
111
     switch (modify_action) {
112
     case OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST:
113
-        ogs_assert(OGS_OK == s1ap_send_path_switch_ack(mme_ue, false));
114
+        r = s1ap_send_path_switch_ack(mme_ue, false);
115
+        ogs_expect(r == OGS_OK);
116
+        ogs_assert(r != OGS_ERROR);
117
         break;
118
     case OGS_GTP_MODIFY_IN_E_RAB_MODIFICATION:
119
-        ogs_assert(OGS_OK == s1ap_send_e_rab_modification_confirm(mme_ue));
120
+        r = s1ap_send_e_rab_modification_confirm(mme_ue);
121
+        ogs_expect(r == OGS_OK);
122
+        ogs_assert(r != OGS_ERROR);
123
         break;
124
     default:
125
         break;
126
@@ -525,7 +543,7 @@
127
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
128
         ogs_gtp2_delete_session_response_t *rsp)
129
 {
130
-    int rv;
131
+    int r, rv;
132
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
133
     int action = 0;
134
     sgw_ue_t *source_ue = NULL, *target_ue = NULL;
135
@@ -601,7 +619,9 @@
136
 
137
     } else if (action == OGS_GTP_DELETE_SEND_DETACH_ACCEPT) {
138
         if (mme_sess_count(mme_ue) == 1) /* Last Session */ {
139
-            ogs_assert(OGS_OK == nas_eps_send_detach_accept(mme_ue));
140
+            r = nas_eps_send_detach_accept(mme_ue);
141
+            ogs_expect(r == OGS_OK);
142
+            ogs_assert(r != OGS_ERROR);
143
         }
144
 
145
     } else if (action ==
146
@@ -609,8 +629,9 @@
147
         mme_bearer_t *bearer = mme_default_bearer_in_sess(sess);
148
         ogs_expect_or_return(bearer);
149
 
150
-        ogs_assert(OGS_OK ==
151
-            nas_eps_send_deactivate_bearer_context_request(bearer));
152
+        r = nas_eps_send_deactivate_bearer_context_request(bearer);
153
+        ogs_expect(r == OGS_OK);
154
+        ogs_assert(r != OGS_ERROR);
155
 
156
         /*
157
          * mme_sess_remove() should not be called here.
158
@@ -631,10 +652,11 @@
159
                 }
160
             } else {
161
                 ogs_assert(mme_ue->enb_ue);
162
-                ogs_assert(OGS_OK ==
163
-                    s1ap_send_ue_context_release_command(mme_ue->enb_ue,
164
+                r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
165
                     S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
166
-                    S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
167
+                    S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
168
+                ogs_expect(r == OGS_OK);
169
+                ogs_assert(r != OGS_ERROR);
170
             }
171
         }
172
 
173
@@ -645,10 +667,11 @@
174
 
175
             enb_ue = enb_ue_cycle(mme_ue->enb_ue);
176
             if (enb_ue) {
177
-                ogs_assert(OGS_OK ==
178
-                    s1ap_send_ue_context_release_command(enb_ue,
179
+                r = s1ap_send_ue_context_release_command(enb_ue,
180
                         S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
181
-                        S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0));
182
+                        S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0);
183
+                ogs_expect(r == OGS_OK);
184
+                ogs_assert(r != OGS_ERROR);
185
             } else
186
                 ogs_error("ENB-S1 Context has already been removed");
187
         }
188
@@ -659,10 +682,11 @@
189
                     &mme_ue->pdn_connectivity_request);
190
             if (rv != OGS_OK) {
191
                 ogs_error("nas_eps_send_emm_to_esm() failed");
192
-                ogs_assert(OGS_OK ==
193
-                    nas_eps_send_attach_reject(mme_ue,
194
+                r = nas_eps_send_attach_reject(mme_ue,
195
                         OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
196
-                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
197
+                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
198
+                ogs_expect(r == OGS_OK);
199
+                ogs_assert(r != OGS_ERROR);
200
             }
201
         }
202
 
203
@@ -701,6 +725,7 @@
204
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
205
         ogs_gtp2_create_bearer_request_t *req)
206
 {
207
+    int r;
208
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
209
     mme_bearer_t *bearer = NULL, *default_bearer = NULL;
210
     mme_sess_t *sess = NULL;
211
@@ -863,10 +888,13 @@
212
         if (ECM_IDLE(mme_ue)) {
213
             MME_STORE_PAGING_INFO(mme_ue,
214
                     MME_PAGING_TYPE_CREATE_BEARER, bearer);
215
-            ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
216
+            r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
217
+            ogs_expect(r == OGS_OK);
218
+            ogs_assert(r != OGS_ERROR);
219
         } else {
220
-            ogs_assert(OGS_OK ==
221
-                nas_eps_send_activate_dedicated_bearer_context_request(bearer));
222
+            r = nas_eps_send_activate_dedicated_bearer_context_request(bearer);
223
+            ogs_expect(r == OGS_OK);
224
+            ogs_assert(r != OGS_ERROR);
225
         }
226
     } else {
227
         /*
228
@@ -880,6 +908,7 @@
229
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
230
         ogs_gtp2_update_bearer_request_t *req)
231
 {
232
+    int r;
233
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
234
     mme_bearer_t *bearer = NULL;
235
     mme_sess_t *sess = NULL;
236
@@ -988,12 +1017,15 @@
237
         if (ECM_IDLE(mme_ue)) {
238
             MME_STORE_PAGING_INFO(mme_ue,
239
                     MME_PAGING_TYPE_UPDATE_BEARER, bearer);
240
-            ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
241
+            r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
242
+            ogs_expect(r == OGS_OK);
243
+            ogs_assert(r != OGS_ERROR);
244
         } else {
245
-            ogs_assert(OGS_OK ==
246
-                nas_eps_send_modify_bearer_context_request(bearer,
247
+            r = nas_eps_send_modify_bearer_context_request(bearer,
248
                     req->bearer_contexts.bearer_level_qos.presence,
249
-                    req->bearer_contexts.tft.presence));
250
+                    req->bearer_contexts.tft.presence);
251
+            ogs_expect(r == OGS_OK);
252
+            ogs_assert(r != OGS_ERROR);
253
         }
254
     } else {
255
         ogs_error("IGNORE Update Bearer Request : "
256
@@ -1001,10 +1033,11 @@
257
 
258
         if (xact->xid & OGS_GTP_CMD_XACT_ID) {
259
             /* MME received Bearer Resource Modification Request */
260
-            ogs_assert(OGS_OK ==
261
-                nas_eps_send_bearer_resource_modification_reject(
262
+            r = nas_eps_send_bearer_resource_modification_reject(
263
                     mme_ue, sess->pti,
264
-                    OGS_NAS_ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED));
265
+                    OGS_NAS_ESM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED);
266
+            ogs_expect(r == OGS_OK);
267
+            ogs_assert(r != OGS_ERROR);
268
         }
269
 
270
         ogs_assert(OGS_OK ==
271
@@ -1017,6 +1050,7 @@
272
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
273
         ogs_gtp2_delete_bearer_request_t *req)
274
 {
275
+    int r;
276
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
277
 
278
     mme_bearer_t *bearer = NULL;
279
@@ -1121,10 +1155,13 @@
280
 
281
     if (ECM_IDLE(mme_ue)) {
282
         MME_STORE_PAGING_INFO(mme_ue, MME_PAGING_TYPE_DELETE_BEARER, bearer);
283
-        ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
284
+        r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
285
+        ogs_expect(r == OGS_OK);
286
+        ogs_assert(r != OGS_ERROR);
287
     } else {
288
-        ogs_assert(OGS_OK ==
289
-            nas_eps_send_deactivate_bearer_context_request(bearer));
290
+        r = nas_eps_send_deactivate_bearer_context_request(bearer);
291
+        ogs_expect(r == OGS_OK);
292
+        ogs_assert(r != OGS_ERROR);
293
     }
294
 }
295
 
296
@@ -1132,7 +1169,7 @@
297
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
298
         ogs_gtp2_release_access_bearers_response_t *rsp)
299
 {
300
-    int rv;
301
+    int r, rv;
302
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
303
     int action = 0;
304
     enb_ue_t *enb_ue = NULL;
305
@@ -1197,10 +1234,11 @@
306
     if (action == OGS_GTP_RELEASE_SEND_UE_CONTEXT_RELEASE_COMMAND) {
307
         enb_ue = enb_ue_cycle(mme_ue->enb_ue);
308
         if (enb_ue) {
309
-            ogs_assert(OGS_OK ==
310
-                s1ap_send_ue_context_release_command(enb_ue,
311
+            r = s1ap_send_ue_context_release_command(enb_ue,
312
                     S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
313
-                    S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0));
314
+                    S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK, 0);
315
+            ogs_expect(r == OGS_OK);
316
+            ogs_assert(r != OGS_ERROR);
317
         } else {
318
             ogs_error("ENB-S1 Context has already been removed");
319
         }
320
@@ -1232,9 +1270,11 @@
321
 
322
             enb_ue_remove(enb_ue);
323
 
324
-            if (ogs_list_count(&enb->enb_ue_list) == 0)
325
-                ogs_assert(OGS_OK ==
326
-                    s1ap_send_s1_reset_ack(enb, NULL));
327
+            if (ogs_list_count(&enb->enb_ue_list) == 0) {
328
+                r = s1ap_send_s1_reset_ack(enb, NULL);
329
+                ogs_expect(r == OGS_OK);
330
+                ogs_assert(r != OGS_ERROR);
331
+            }
332
         } else {
333
             ogs_error("ENB-S1 Context has already been removed");
334
         }
335
@@ -1265,7 +1305,9 @@
336
              * where PartOfS1_interface was requested
337
              * REMOVED */
338
             ogs_assert(enb->s1_reset_ack);
339
-            s1ap_send_to_enb(enb, enb->s1_reset_ack, S1AP_NON_UE_SIGNALLING);
340
+            r = s1ap_send_to_enb(enb, enb->s1_reset_ack, S1AP_NON_UE_SIGNALLING);
341
+            ogs_expect(r == OGS_OK);
342
+            ogs_assert(r != OGS_ERROR);
343
 
344
             /* Clear S1-Reset Ack Buffer */
345
             enb->s1_reset_ack = NULL;
346
@@ -1284,6 +1326,7 @@
347
         ogs_gtp2_downlink_data_notification_t *noti)
348
 {
349
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
350
+    int r;
351
 
352
     mme_bearer_t *bearer = NULL;
353
     sgw_ue_t *sgw_ue = NULL;
354
@@ -1370,7 +1413,9 @@
355
     if (ECM_IDLE(mme_ue)) {
356
         MME_STORE_PAGING_INFO(mme_ue,
357
                 MME_PAGING_TYPE_DOWNLINK_DATA_NOTIFICATION, bearer);
358
-        ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
359
+        r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
360
+        ogs_expect(r == OGS_OK);
361
+        ogs_assert(r != OGS_ERROR);
362
 
363
     } else if (ECM_CONNECTED(mme_ue)) {
364
         if (cause_value == OGS_GTP2_CAUSE_ERROR_INDICATION_RECEIVED) {
365
@@ -1406,10 +1451,11 @@
366
             enb_ue_t *enb_ue = enb_ue_cycle(mme_ue->enb_ue);
367
             ogs_assert(enb_ue);
368
 
369
-            ogs_assert(OGS_OK ==
370
-                s1ap_send_ue_context_release_command(enb_ue,
371
+            r = s1ap_send_ue_context_release_command(enb_ue,
372
                     S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
373
-                    S1AP_UE_CTX_REL_S1_PAGING, 0));
374
+                    S1AP_UE_CTX_REL_S1_PAGING, 0);
375
+            ogs_expect(r == OGS_OK);
376
+            ogs_assert(r != OGS_ERROR);
377
         } else {
378
             ogs_assert(OGS_OK ==
379
                 mme_gtp_send_downlink_data_notification_ack(
380
@@ -1422,14 +1468,13 @@
381
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
382
         ogs_gtp2_create_indirect_data_forwarding_tunnel_response_t *rsp)
383
 {
384
-    int rv;
385
+    int i, r, rv;
386
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
387
     uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
388
     sgw_ue_t *sgw_ue = NULL;
389
     mme_bearer_t *bearer = NULL;
390
     mme_ue_t *mme_ue = NULL;
391
     enb_ue_t *source_ue = NULL;
392
-    int i;
393
 
394
     ogs_gtp2_f_teid_t *teid = NULL;
395
 
396
@@ -1540,14 +1585,16 @@
397
     source_ue = enb_ue_cycle(mme_ue->enb_ue);
398
     ogs_assert(source_ue);
399
 
400
-    ogs_assert(OGS_OK == s1ap_send_handover_command(source_ue));
401
+    r = s1ap_send_handover_command(source_ue);
402
+    ogs_expect(r == OGS_OK);
403
+    ogs_assert(r != OGS_ERROR);
404
 }
405
 
406
 void mme_s11_handle_delete_indirect_data_forwarding_tunnel_response(
407
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
408
         ogs_gtp2_delete_indirect_data_forwarding_tunnel_response_t *rsp)
409
 {
410
-    int rv;
411
+    int r, rv;
412
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
413
     uint8_t session_cause = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
414
     int action = 0;
415
@@ -1637,8 +1684,9 @@
416
     if (action == OGS_GTP_DELETE_INDIRECT_HANDOVER_COMPLETE) {
417
         /* Nothing to do */
418
     } else if (action == OGS_GTP_DELETE_INDIRECT_HANDOVER_CANCEL) {
419
-        ogs_assert(OGS_OK ==
420
-            s1ap_send_handover_cancel_ack(mme_ue->enb_ue));
421
+        r = s1ap_send_handover_cancel_ack(mme_ue->enb_ue);
422
+        ogs_expect(r == OGS_OK);
423
+        ogs_assert(r != OGS_ERROR);
424
     } else {
425
         ogs_fatal("Invalid action = %d", action);
426
         ogs_assert_if_reached();
427
@@ -1649,7 +1697,7 @@
428
         ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
429
         ogs_gtp2_bearer_resource_failure_indication_t *ind)
430
 {
431
-    int rv;
432
+    int r, rv;
433
     uint8_t cause_value = OGS_GTP2_CAUSE_UNDEFINED_VALUE;
434
 
435
     mme_bearer_t *bearer = NULL;
436
@@ -1700,9 +1748,10 @@
437
     ogs_debug("    MME_S11_TEID%d SGW_S11_TEID%d",
438
             mme_ue->mme_s11_teid, sgw_ue->sgw_s11_teid);
439
 
440
-    ogs_assert(OGS_OK ==
441
-        nas_eps_send_bearer_resource_modification_reject(
442
-            mme_ue, sess->pti, esm_cause_from_gtp(cause_value)));
443
+    r = nas_eps_send_bearer_resource_modification_reject(
444
+            mme_ue, sess->pti, esm_cause_from_gtp(cause_value));
445
+    ogs_expect(r == OGS_OK);
446
+    ogs_assert(r != OGS_ERROR);
447
 
448
     if (!sgw_ue ||
449
         cause_value == OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND) {
450
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/mme-s6a-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/mme-s6a-handler.c Changed
67
 
1
@@ -39,6 +39,7 @@
2
 uint8_t mme_s6a_handle_aia(
3
         mme_ue_t *mme_ue, ogs_diam_s6a_message_t *s6a_message)
4
 {
5
+    int r;
6
     ogs_diam_s6a_aia_message_t *aia_message = NULL;
7
     ogs_diam_e_utran_vector_t *e_utran_vector = NULL;
8
 
9
@@ -66,7 +67,9 @@
10
     if (mme_ue->nas_eps.ksi == OGS_NAS_KSI_NO_KEY_IS_AVAILABLE)
11
         mme_ue->nas_eps.ksi = 0;
12
 
13
-    ogs_assert(OGS_OK == nas_eps_send_authentication_request(mme_ue));
14
+    r = nas_eps_send_authentication_request(mme_ue);
15
+    ogs_expect(r == OGS_OK);
16
+    ogs_assert(r != OGS_ERROR);
17
 
18
     return OGS_NAS_EMM_CAUSE_REQUEST_ACCEPTED;
19
 }
20
@@ -77,7 +80,7 @@
21
     ogs_diam_s6a_ula_message_t *ula_message = NULL;
22
     ogs_subscription_data_t *subscription_data = NULL;
23
     ogs_slice_data_t *slice_data = NULL;
24
-    int rv, num_of_session;
25
+    int r, rv, num_of_session;
26
 
27
     ogs_assert(mme_ue);
28
     ogs_assert(s6a_message);
29
@@ -115,9 +118,10 @@
30
             return OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED;
31
         }
32
     } else if (mme_ue->nas_eps.type == MME_EPS_TYPE_TAU_REQUEST) {
33
-        ogs_assert(OGS_OK ==
34
-            nas_eps_send_tau_accept(mme_ue,
35
-                S1AP_ProcedureCode_id_InitialContextSetup));
36
+        r = nas_eps_send_tau_accept(mme_ue,
37
+                S1AP_ProcedureCode_id_InitialContextSetup);
38
+        ogs_expect(r == OGS_OK);
39
+        ogs_assert(r != OGS_ERROR);
40
     } else {
41
         ogs_error("Invalid Type%d", mme_ue->nas_eps.type);
42
         return OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED;
43
@@ -199,6 +203,7 @@
44
 
45
 void mme_s6a_handle_clr(mme_ue_t *mme_ue, ogs_diam_s6a_message_t *s6a_message)
46
 {
47
+    int r;
48
     ogs_diam_s6a_clr_message_t *clr_message = NULL;
49
     ogs_assert(mme_ue);
50
     ogs_assert(s6a_message);
51
@@ -260,9 +265,13 @@
52
          */
53
         if (ECM_IDLE(mme_ue)) {
54
             MME_STORE_PAGING_INFO(mme_ue, MME_PAGING_TYPE_DETACH_TO_UE, NULL);
55
-            ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
56
+            r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
57
+            ogs_expect(r == OGS_OK);
58
+            ogs_assert(r != OGS_ERROR);
59
         } else {
60
-            ogs_assert(OGS_OK == nas_eps_send_detach_request(mme_ue));
61
+            r = nas_eps_send_detach_request(mme_ue);
62
+            ogs_expect(r == OGS_OK);
63
+            ogs_assert(r != OGS_ERROR);
64
             if (MME_P_TMSI_IS_AVAILABLE(mme_ue)) {
65
                 ogs_assert(OGS_OK == sgsap_send_detach_indication(mme_ue));
66
             } else {
67
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/mme-sm.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/mme-sm.c Changed
113
 
1
@@ -62,7 +62,7 @@
2
 
3
     ogs_s1ap_message_t s1ap_message;
4
     ogs_pkbuf_t *pkbuf = NULL;
5
-    int rc;
6
+    int rc, r;
7
 
8
     ogs_nas_eps_message_t nas_message;
9
     enb_ue_t *enb_ue = NULL;
10
@@ -196,10 +196,11 @@
11
             ogs_fsm_dispatch(&enb->sm, e);
12
         } else {
13
             ogs_warn("Cannot decode S1AP message");
14
-            ogs_assert(OGS_OK ==
15
-                s1ap_send_error_indication(
16
+            r = s1ap_send_error_indication(
17
                     enb, NULL, NULL, S1AP_Cause_PR_protocol,
18
-                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
19
+                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
20
+            ogs_expect(r == OGS_OK);
21
+            ogs_assert(r != OGS_ERROR);
22
         }
23
 
24
         ogs_s1ap_free(&s1ap_message);
25
@@ -217,7 +218,9 @@
26
             pkbuf = e->pkbuf;
27
             ogs_assert(pkbuf);
28
 
29
-            ogs_expect(OGS_OK == s1ap_send_to_enb_ue(enb_ue, pkbuf));
30
+            r = s1ap_send_to_enb_ue(enb_ue, pkbuf);
31
+            ogs_expect(r == OGS_OK);
32
+            ogs_assert(r != OGS_ERROR);
33
             ogs_timer_delete(e->timer);
34
             break;
35
         case MME_TIMER_S1_HOLDING:
36
@@ -251,11 +254,12 @@
37
             if (!mme_ue) {
38
                 mme_ue = mme_ue_add(enb_ue);
39
                 if (mme_ue == NULL) {
40
-                    ogs_expect(OGS_OK ==
41
-                        s1ap_send_ue_context_release_command(enb_ue,
42
+                    r = s1ap_send_ue_context_release_command(enb_ue,
43
                             S1AP_Cause_PR_misc,
44
                             S1AP_CauseMisc_control_processing_overload,
45
-                            S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0));
46
+                            S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
47
+                    ogs_expect(r == OGS_OK);
48
+                    ogs_assert(r != OGS_ERROR);
49
                     ogs_pkbuf_free(pkbuf);
50
                     return;
51
                 }
52
@@ -296,10 +300,11 @@
53
                 /* De-associate S1 with NAS/EMM */
54
                 enb_ue_deassociate(mme_ue->enb_ue);
55
 
56
-                ogs_assert(OGS_OK ==
57
-                    s1ap_send_ue_context_release_command(mme_ue->enb_ue,
58
+                r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
59
                         S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
60
-                        S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0));
61
+                        S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
62
+                ogs_expect(r == OGS_OK);
63
+                ogs_assert(r != OGS_ERROR);
64
             }
65
             enb_ue_associate_mme_ue(enb_ue, mme_ue);
66
         }
67
@@ -409,14 +414,16 @@
68
                     ogs_error("S1 context has already been removed");
69
                     break;
70
                 }
71
-                ogs_assert(OGS_OK ==
72
-                    nas_eps_send_attach_reject(mme_ue, emm_cause,
73
-                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
74
+                r = nas_eps_send_attach_reject(mme_ue, emm_cause,
75
+                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
76
+                ogs_expect(r == OGS_OK);
77
+                ogs_assert(r != OGS_ERROR);
78
 
79
-                ogs_assert(OGS_OK ==
80
-                    s1ap_send_ue_context_release_command(enb_ue,
81
+                r = s1ap_send_ue_context_release_command(enb_ue,
82
                         S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
83
-                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
84
+                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
85
+                ogs_expect(r == OGS_OK);
86
+                ogs_assert(r != OGS_ERROR);
87
             }
88
             break;
89
         case OGS_DIAM_S6A_CMD_CODE_UPDATE_LOCATION:
90
@@ -429,14 +436,16 @@
91
                     ogs_error("S1 context has already been removed");
92
                     break;
93
                 }
94
-                ogs_assert(OGS_OK ==
95
-                    nas_eps_send_attach_reject(mme_ue, emm_cause,
96
-                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
97
+                r = nas_eps_send_attach_reject(mme_ue, emm_cause,
98
+                        OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
99
+                ogs_expect(r == OGS_OK);
100
+                ogs_assert(r != OGS_ERROR);
101
 
102
-                ogs_assert(OGS_OK ==
103
-                    s1ap_send_ue_context_release_command(enb_ue,
104
+                r = s1ap_send_ue_context_release_command(enb_ue,
105
                         S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
106
-                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
107
+                        S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
108
+                ogs_expect(r == OGS_OK);
109
+                ogs_assert(r != OGS_ERROR);
110
             }
111
 
112
             mme_ue->location_updated_but_not_canceled_yet = true;
113
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/nas-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/nas-path.c Changed
600
 
1
@@ -28,16 +28,21 @@
2
 
3
 int nas_eps_send_to_enb(mme_ue_t *mme_ue, ogs_pkbuf_t *pkbuf)
4
 {
5
+    int rv;
6
+
7
     ogs_assert(pkbuf);
8
 
9
     mme_ue = mme_ue_cycle(mme_ue);
10
     if (!mme_ue) {
11
-        ogs_warn("UE(mme-ue) context has already been removed");
12
+        ogs_error("UE(mme-ue) context has already been removed");
13
         ogs_pkbuf_free(pkbuf);
14
-        return OGS_ERROR;
15
+        return OGS_NOTFOUND;
16
     }
17
 
18
-    return s1ap_send_to_enb_ue(mme_ue->enb_ue, pkbuf);
19
+    rv = s1ap_send_to_enb_ue(mme_ue->enb_ue, pkbuf);
20
+    ogs_expect(rv == OGS_OK);
21
+
22
+    return rv;
23
 }
24
 
25
 int nas_eps_send_emm_to_esm(mme_ue_t *mme_ue,
26
@@ -75,20 +80,23 @@
27
 
28
     mme_ue = mme_ue_cycle(mme_ue);
29
     if (!mme_ue) {
30
-        ogs_warn("UE(mme-ue) context has already been removed");
31
+        ogs_error("UE(mme-ue) context has already been removed");
32
         ogs_pkbuf_free(pkbuf);
33
-        return OGS_ERROR;
34
+        return OGS_NOTFOUND;
35
     }
36
 
37
     enb_ue = enb_ue_cycle(mme_ue->enb_ue);
38
     if (!enb_ue) {
39
-        ogs_warn("S1 context has already been removed");
40
+        ogs_error("S1 context has already been removed");
41
         ogs_pkbuf_free(pkbuf);
42
-        return OGS_ERROR;
43
+        return OGS_NOTFOUND;
44
     }
45
 
46
     s1apbuf = s1ap_build_downlink_nas_transport(enb_ue, pkbuf);
47
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
48
+    if (!s1apbuf) {
49
+        ogs_error("s1ap_build_downlink_nas_transport() failed");
50
+        return OGS_ERROR;
51
+    }
52
 
53
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
54
     ogs_expect(rv == OGS_OK);
55
@@ -116,19 +124,31 @@
56
 
57
     esmbuf = esm_build_activate_default_bearer_context_request(
58
                 sess, OGS_GTP_CREATE_IN_ATTACH_REQUEST);
59
-    ogs_expect_or_return_val(esmbuf, OGS_ERROR);
60
+    if (!esmbuf) {
61
+        ogs_error("esm_build_activate_default_bearer_context_request() failed");
62
+        return OGS_ERROR;
63
+    }
64
 
65
     emmbuf = emm_build_attach_accept(mme_ue, esmbuf);
66
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
67
+    if (!emmbuf) {
68
+        ogs_error("emm_build_attach_accept() failed");
69
+        return OGS_ERROR;
70
+    }
71
 
72
     CLEAR_MME_UE_TIMER(mme_ue->t3450);
73
     mme_ue->t3450.pkbuf = ogs_pkbuf_copy(emmbuf);
74
-    ogs_expect_or_return_val(mme_ue->t3450.pkbuf, OGS_ERROR);
75
+    if (!mme_ue->t3450.pkbuf) {
76
+        ogs_error("ogs_pkbuf_copy(mme_ue->t3450.pkbuf) failed");
77
+        return OGS_ERROR;
78
+    }
79
     ogs_timer_start(mme_ue->t3450.timer,
80
             mme_timer_cfg(MME_TIMER_T3450)->duration);
81
 
82
     s1apbuf = s1ap_build_initial_context_setup_request(mme_ue, emmbuf);
83
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
84
+    if (!s1apbuf) {
85
+        ogs_error("s1ap_build_initial_context_setup_request() failed");
86
+        return OGS_ERROR;
87
+    }
88
 
89
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
90
     ogs_expect(rv == OGS_OK);
91
@@ -143,7 +163,11 @@
92
     mme_sess_t *sess = NULL;
93
     ogs_pkbuf_t *esmbuf = NULL, *emmbuf = NULL;
94
 
95
-    ogs_expect_or_return_val(mme_ue, OGS_ERROR);
96
+    mme_ue = mme_ue_cycle(mme_ue);
97
+    if (!mme_ue) {
98
+        ogs_error("UE(mme-ue) context has already been removed");
99
+        return OGS_NOTFOUND;
100
+    }
101
 
102
     ogs_debug("%s Attach reject", mme_ue->imsi_bcd);
103
     ogs_debug("    Cause%d", emm_cause);
104
@@ -152,13 +176,19 @@
105
     if (sess) {
106
         esmbuf = esm_build_pdn_connectivity_reject(
107
                     sess, esm_cause, OGS_GTP_CREATE_IN_ATTACH_REQUEST);
108
-        ogs_expect_or_return_val(esmbuf, OGS_ERROR);
109
+        if (!esmbuf) {
110
+            ogs_error("esm_build_pdn_connectivity_reject() failed");
111
+            return OGS_ERROR;
112
+        }
113
     }
114
 
115
     emmbuf = emm_build_attach_reject(emm_cause, esmbuf);
116
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
117
+    if (!emmbuf) {
118
+        ogs_error("emm_build_attach_reject() failed");
119
+        return OGS_ERROR;
120
+    }
121
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
122
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
123
+    ogs_expect(rv == OGS_OK);
124
 
125
     return rv;
126
 }
127
@@ -174,19 +204,24 @@
128
 
129
     if (mme_ue->t3470.pkbuf) {
130
         emmbuf = mme_ue->t3470.pkbuf;
131
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
132
     } else {
133
         emmbuf = emm_build_identity_request(mme_ue);
134
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
135
+        if (!emmbuf) {
136
+            ogs_error("emm_build_identity_request() failed");
137
+            return OGS_ERROR;
138
+        }
139
     }
140
 
141
     mme_ue->t3470.pkbuf = ogs_pkbuf_copy(emmbuf);
142
-    ogs_expect_or_return_val(mme_ue->t3470.pkbuf, OGS_ERROR);
143
+    if (!mme_ue->t3470.pkbuf) {
144
+        ogs_error("ogs_pkbuf_copy(mme_ue->t3470.pkbuf) failed");
145
+        return OGS_ERROR;
146
+    }
147
     ogs_timer_start(mme_ue->t3470.timer, 
148
             mme_timer_cfg(MME_TIMER_T3470)->duration);
149
 
150
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
151
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
152
+    ogs_expect(rv == OGS_OK);
153
 
154
     return rv;
155
 }
156
@@ -202,19 +237,24 @@
157
 
158
     if (mme_ue->t3460.pkbuf) {
159
         emmbuf = mme_ue->t3460.pkbuf;
160
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
161
     } else {
162
         emmbuf = emm_build_authentication_request(mme_ue);
163
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
164
+        if (!emmbuf) {
165
+            ogs_error("emm_build_authentication_request() failed");
166
+            return OGS_ERROR;
167
+        }
168
     }
169
 
170
     mme_ue->t3460.pkbuf = ogs_pkbuf_copy(emmbuf);
171
-    ogs_expect_or_return_val(mme_ue->t3460.pkbuf, OGS_ERROR);
172
+    if (!mme_ue->t3460.pkbuf) {
173
+        ogs_error("ogs_pkbuf_copy(mme_ue->t3460.pkbuf) failed");
174
+        return OGS_ERROR;
175
+    }
176
     ogs_timer_start(mme_ue->t3460.timer, 
177
             mme_timer_cfg(MME_TIMER_T3460)->duration);
178
 
179
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
180
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
181
+    ogs_expect(rv == OGS_OK);
182
 
183
     return rv;
184
 }
185
@@ -230,19 +270,24 @@
186
 
187
     if (mme_ue->t3460.pkbuf) {
188
         emmbuf = mme_ue->t3460.pkbuf;
189
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
190
     } else {
191
         emmbuf = emm_build_security_mode_command(mme_ue);
192
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
193
+        if (!emmbuf) {
194
+            ogs_error("emm_build_security_mode_command() failed");
195
+            return OGS_ERROR;
196
+        }
197
     }
198
 
199
     mme_ue->t3460.pkbuf = ogs_pkbuf_copy(emmbuf);
200
-    ogs_expect_or_return_val(mme_ue->t3460.pkbuf, OGS_ERROR);
201
+    if (!mme_ue->t3460.pkbuf) {
202
+        ogs_error("ogs_pkbuf_copy(mme_ue->t3460.pkbuf) failed");
203
+        return OGS_ERROR;
204
+    }
205
     ogs_timer_start(mme_ue->t3460.timer, 
206
             mme_timer_cfg(MME_TIMER_T3460)->duration);
207
 
208
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
209
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
210
+    ogs_expect(rv == OGS_OK);
211
 
212
     return rv;
213
 }
214
@@ -257,10 +302,13 @@
215
     ogs_debug("%s Authentication reject", mme_ue->imsi_bcd);
216
 
217
     emmbuf = emm_build_authentication_reject();
218
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
219
+    if (!emmbuf) {
220
+        ogs_error("emm_build_authentication_reject() failed");
221
+        return OGS_ERROR;
222
+    }
223
 
224
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
225
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
226
+    ogs_expect(rv == OGS_OK);
227
 
228
     return rv;
229
 }
230
@@ -274,19 +322,24 @@
231
 
232
     if (mme_ue->t3422.pkbuf) {
233
         emmbuf = mme_ue->t3422.pkbuf;
234
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
235
     } else {
236
         emmbuf = emm_build_detach_request(mme_ue);
237
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
238
+        if (!emmbuf) {
239
+            ogs_error("emm_build_detach_request() failed");
240
+            return OGS_ERROR;
241
+        }
242
     }
243
 
244
     mme_ue->t3422.pkbuf = ogs_pkbuf_copy(emmbuf);
245
-    ogs_expect_or_return_val(mme_ue->t3422.pkbuf, OGS_ERROR);
246
+    if (!mme_ue->t3422.pkbuf) {
247
+        ogs_error("ogs_pkbuf_copy(mme_ue->t3422.pkbuf) failed");
248
+        return OGS_ERROR;
249
+    }
250
     ogs_timer_start(mme_ue->t3422.timer, 
251
             mme_timer_cfg(MME_TIMER_T3422)->duration);    
252
 
253
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
254
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
255
+    ogs_expect(rv == OGS_OK);
256
 
257
     return rv;
258
 }
259
@@ -300,17 +353,26 @@
260
 
261
     ogs_assert(mme_ue);
262
     enb_ue = enb_ue_cycle(mme_ue->enb_ue);
263
-    ogs_expect_or_return_val(enb_ue, OGS_ERROR);
264
+    if (!enb_ue) {
265
+        ogs_error("S1 context has already been removed");
266
+        return OGS_NOTFOUND;
267
+    }
268
 
269
     ogs_debug("%s Detach accept", mme_ue->imsi_bcd);
270
 
271
     /* reply with detach accept */
272
     if (mme_ue->nas_eps.detach.switch_off == 0) {
273
         emmbuf = emm_build_detach_accept(mme_ue);
274
-        ogs_expect_or_return_val(emmbuf, OGS_ERROR);
275
+        if (!emmbuf) {
276
+            ogs_error("emm_build_detach_accept() failed");
277
+            return OGS_ERROR;
278
+        }
279
 
280
         rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
281
-        ogs_expect_or_return_val(rv == OGS_OK, rv);
282
+        if (rv != OGS_OK) {
283
+            ogs_error("nas_eps_send_to_downlink_nas_transport() failed");
284
+            return rv;
285
+        }
286
     }
287
 
288
     rv = s1ap_send_ue_context_release_command(enb_ue,
289
@@ -333,28 +395,29 @@
290
     ogs_assert(mme_ue);
291
 
292
     if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
293
-        enb_ue_t *enb_ue = NULL;
294
-
295
         /* During the UE-attach process, we'll send Attach-Reject
296
          * with pyggybacking PDN-connectivity-Reject */
297
         rv = nas_eps_send_attach_reject(mme_ue,
298
             OGS_NAS_EMM_CAUSE_ESM_FAILURE, esm_cause);
299
-        ogs_expect(rv == OGS_OK);
300
+        if (rv != OGS_OK) {
301
+            ogs_error("nas_eps_send_attach_reject() failed");
302
+            return rv;
303
+        }
304
 
305
-        enb_ue = enb_ue_cycle(mme_ue->enb_ue);
306
-        if (enb_ue) {
307
-            ogs_assert(OGS_OK ==
308
-                s1ap_send_ue_context_release_command(mme_ue->enb_ue,
309
+        rv = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
310
                 S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
311
-                S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0));
312
-        }
313
+                S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE, 0);
314
+        ogs_expect(rv == OGS_OK);
315
     } else {
316
         esmbuf = esm_build_pdn_connectivity_reject(
317
                     sess, esm_cause, create_action);
318
-        ogs_expect_or_return_val(esmbuf, OGS_ERROR);
319
+        if (!esmbuf) {
320
+            ogs_error("esm_build_pdn_connectivity_reject() failed");
321
+            return OGS_ERROR;
322
+        }
323
 
324
         rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
325
-        ogs_expect_or_return_val(rv == OGS_OK, rv);
326
+        ogs_expect(rv == OGS_OK);
327
     }
328
 
329
     return rv;
330
@@ -372,19 +435,24 @@
331
 
332
     if (bearer->t3489.pkbuf) {
333
         esmbuf = bearer->t3489.pkbuf;
334
-        ogs_expect_or_return_val(esmbuf, OGS_ERROR);
335
     } else {
336
         esmbuf = esm_build_information_request(bearer);
337
-        ogs_expect_or_return_val(esmbuf, OGS_ERROR);
338
+        if (!esmbuf) {
339
+            ogs_error("esm_build_information_request() failed");
340
+            return OGS_ERROR;
341
+        }
342
     }
343
 
344
     bearer->t3489.pkbuf = ogs_pkbuf_copy(esmbuf);
345
-    ogs_expect_or_return_val(bearer->t3489.pkbuf, OGS_ERROR);
346
+    if (!bearer->t3489.pkbuf) {
347
+        ogs_error("ogs_pkbuf_copy(bearer->t3489) failed");
348
+        return OGS_ERROR;
349
+    }
350
     ogs_timer_start(bearer->t3489.timer, 
351
             mme_timer_cfg(MME_TIMER_T3489)->duration);
352
 
353
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
354
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
355
+    ogs_expect(rv == OGS_OK);
356
 
357
     return rv;
358
 }
359
@@ -406,10 +474,16 @@
360
 
361
     esmbuf = esm_build_activate_default_bearer_context_request(
362
                 sess, create_action);
363
-    ogs_expect_or_return_val(esmbuf, OGS_ERROR);
364
+    if (!esmbuf) {
365
+        ogs_error("esm_build_activate_default_bearer_context_request() failed");
366
+        return OGS_ERROR;
367
+    }
368
 
369
     s1apbuf = s1ap_build_e_rab_setup_request(bearer, esmbuf);
370
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
371
+    if (!s1apbuf) {
372
+        ogs_error("s1ap_build_e_rab_setup_request() failed");
373
+        return OGS_ERROR;
374
+    }
375
 
376
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
377
     ogs_expect(rv == OGS_OK);
378
@@ -430,10 +504,17 @@
379
     ogs_assert(mme_ue);
380
 
381
     esmbuf = esm_build_activate_dedicated_bearer_context_request(bearer);
382
-    ogs_expect_or_return_val(esmbuf, OGS_ERROR);
383
+    if (!esmbuf) {
384
+        ogs_error(
385
+            "esm_build_activate_dedicated_bearer_context_request() failed");
386
+        return OGS_ERROR;
387
+    }
388
 
389
     s1apbuf = s1ap_build_e_rab_setup_request(bearer, esmbuf);
390
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
391
+    if (!s1apbuf) {
392
+        ogs_error("s1ap_build_e_rab_setup_request() failed");
393
+        return OGS_ERROR;
394
+    }
395
 
396
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
397
     ogs_expect(rv == OGS_OK);
398
@@ -443,12 +524,15 @@
399
 
400
 void nas_eps_send_activate_all_dedicated_bearers(mme_bearer_t *default_bearer)
401
 {
402
+    int r;
403
     ogs_assert(default_bearer);
404
 
405
     mme_bearer_t *dedicated_bearer = mme_bearer_next(default_bearer);
406
     while (dedicated_bearer) {
407
-        nas_eps_send_activate_dedicated_bearer_context_request(
408
+        r = nas_eps_send_activate_dedicated_bearer_context_request(
409
                 dedicated_bearer);
410
+        ogs_expect(r == OGS_OK);
411
+        ogs_assert(r != OGS_ERROR);
412
         dedicated_bearer = mme_bearer_next(dedicated_bearer);
413
     }
414
 }
415
@@ -467,17 +551,23 @@
416
 
417
     esmbuf = esm_build_modify_bearer_context_request(
418
             bearer, qos_presence, tft_presence);
419
-    ogs_expect_or_return_val(esmbuf, OGS_ERROR);
420
+    if (!esmbuf) {
421
+        ogs_error("esm_build_modify_bearer_context_request() failed");
422
+        return OGS_ERROR;
423
+    }
424
 
425
     if (qos_presence == 1) {
426
         s1apbuf = s1ap_build_e_rab_modify_request(bearer, esmbuf);
427
-        ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
428
+        if (!s1apbuf) {
429
+            ogs_error("s1ap_build_e_rab_modify_request() failed");
430
+            return OGS_ERROR;
431
+        }
432
 
433
         rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
434
-        ogs_expect_or_return_val(rv == OGS_OK, rv);
435
+        ogs_expect(rv == OGS_OK);
436
     } else {
437
         rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
438
-        ogs_expect_or_return_val(rv == OGS_OK, rv);
439
+        ogs_expect(rv == OGS_OK);
440
     }
441
 
442
     return rv;
443
@@ -496,11 +586,17 @@
444
 
445
     esmbuf = esm_build_deactivate_bearer_context_request(
446
             bearer, OGS_NAS_ESM_CAUSE_REGULAR_DEACTIVATION);
447
-    ogs_expect_or_return_val(esmbuf, OGS_ERROR);
448
+    if (!esmbuf) {
449
+        ogs_error("esm_build_deactivate_bearer_context_request() failed");
450
+        return OGS_ERROR;
451
+    }
452
 
453
     s1apbuf = s1ap_build_e_rab_release_command(bearer, esmbuf,
454
             S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release);
455
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
456
+    if (!s1apbuf) {
457
+        ogs_error("s1ap_build_e_rab_release_command() failed");
458
+        return OGS_ERROR;
459
+    }
460
 
461
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
462
     ogs_expect(rv == OGS_OK);
463
@@ -519,10 +615,13 @@
464
 
465
     esmbuf = esm_build_bearer_resource_allocation_reject(
466
             mme_ue, pti, esm_cause);
467
-    ogs_expect_or_return_val(esmbuf, OGS_ERROR);
468
+    if (!esmbuf) {
469
+        ogs_error("esm_build_bearer_resource_allocation_reject() failed");
470
+        return OGS_ERROR;
471
+    }
472
 
473
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
474
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
475
+    ogs_expect(rv == OGS_OK);
476
 
477
     return rv;
478
 }
479
@@ -538,10 +637,13 @@
480
 
481
     esmbuf = esm_build_bearer_resource_modification_reject(
482
             mme_ue, pti, esm_cause);
483
-    ogs_expect_or_return_val(esmbuf, OGS_ERROR);
484
+    if (!esmbuf) {
485
+        ogs_error("esm_build_bearer_resource_modification_reject() failed");
486
+        return OGS_ERROR;
487
+    }
488
 
489
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, esmbuf);
490
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
491
+    ogs_expect(rv == OGS_OK);
492
 
493
     return rv;
494
 }
495
@@ -557,12 +659,18 @@
496
     ogs_debug("%s Tracking area update accept", mme_ue->imsi_bcd);
497
 
498
     emmbuf = emm_build_tau_accept(mme_ue);
499
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
500
+    if (!emmbuf) {
501
+        ogs_error("emm_build_tau_accept() failed");
502
+        return OGS_ERROR;
503
+    }
504
 
505
     if (mme_ue->next.m_tmsi) {
506
         CLEAR_MME_UE_TIMER(mme_ue->t3450);
507
         mme_ue->t3450.pkbuf = ogs_pkbuf_copy(emmbuf);
508
-        ogs_expect_or_return_val(mme_ue->t3450.pkbuf, OGS_ERROR);
509
+        if (!mme_ue->t3450.pkbuf) {
510
+            ogs_error("ogs_pkbuf_copy(mme_ue->t3450.pkbuf) failed");
511
+            return OGS_ERROR;
512
+        }
513
         ogs_timer_start(mme_ue->t3450.timer,
514
                 mme_timer_cfg(MME_TIMER_T3450)->duration);
515
     }
516
@@ -570,13 +678,16 @@
517
     if (procedureCode == S1AP_ProcedureCode_id_InitialContextSetup) {
518
         ogs_pkbuf_t *s1apbuf = NULL;
519
         s1apbuf = s1ap_build_initial_context_setup_request(mme_ue, emmbuf);
520
-        ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
521
+        if (!s1apbuf) {
522
+            ogs_error("s1ap_build_initial_context_setup_request() failed");
523
+            return OGS_ERROR;
524
+        }
525
 
526
         rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
527
-        ogs_expect_or_return_val(rv == OGS_OK, rv);
528
+        ogs_expect(rv == OGS_OK);
529
     } else if (procedureCode == S1AP_ProcedureCode_id_downlinkNASTransport) {
530
         rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
531
-        ogs_expect_or_return_val(rv == OGS_OK, rv);
532
+        ogs_expect(rv == OGS_OK);
533
     } else
534
         ogs_assert_if_reached();
535
 
536
@@ -594,10 +705,13 @@
537
 
538
     /* Build TAU reject */
539
     emmbuf = emm_build_tau_reject(emm_cause, mme_ue);
540
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
541
+    if (!emmbuf) {
542
+        ogs_error("emm_build_tau_reject() failed");
543
+        return OGS_ERROR;
544
+    }
545
 
546
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
547
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
548
+    ogs_expect(rv == OGS_OK);
549
 
550
     return rv;
551
 }
552
@@ -614,10 +728,13 @@
553
 
554
     /* Build Service Reject */
555
     emmbuf = emm_build_service_reject(emm_cause, mme_ue);
556
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
557
+    if (!emmbuf) {
558
+        ogs_error("emm_build_service_reject() failed");
559
+        return OGS_ERROR;
560
+    }
561
 
562
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
563
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
564
+    ogs_expect(rv == OGS_OK);
565
 
566
     return rv;
567
 }
568
@@ -632,10 +749,13 @@
569
     ogs_debug("%s CS Service Notification", mme_ue->imsi_bcd);
570
 
571
     emmbuf = emm_build_cs_service_notification(mme_ue);
572
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
573
+    if (!emmbuf) {
574
+        ogs_error("emm_build_cs_service_notification() failed");
575
+        return OGS_ERROR;
576
+    }
577
 
578
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
579
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
580
+    ogs_expect(rv == OGS_OK);
581
 
582
     return rv;
583
 }
584
@@ -653,10 +773,13 @@
585
     ogs_debug("%s Downlink NAS transport", mme_ue->imsi_bcd);
586
 
587
     emmbuf = emm_build_downlink_nas_transport(mme_ue, buffer, length);
588
-    ogs_expect_or_return_val(emmbuf, OGS_ERROR);
589
+    if (!emmbuf) {
590
+        ogs_error("emm_build_downlink_nas_transport() failed");
591
+        return OGS_ERROR;
592
+    }
593
 
594
     rv = nas_eps_send_to_downlink_nas_transport(mme_ue, emmbuf);
595
-    ogs_expect_or_return_val(rv == OGS_OK, rv);
596
+    ogs_expect(rv == OGS_OK);
597
 
598
     return rv;
599
 }
600
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/s1ap-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/s1ap-handler.c Changed
2098
 
1
@@ -68,7 +68,7 @@
2
 void s1ap_handle_s1_setup_request(mme_enb_t *enb, ogs_s1ap_message_t *message)
3
 {
4
     char bufOGS_ADDRSTRLEN;
5
-    int i, j;
6
+    int i, j, r;
7
 
8
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
9
     S1AP_S1SetupRequest_t *S1SetupRequest = NULL;
10
@@ -163,7 +163,9 @@
11
         group = S1AP_Cause_PR_misc;
12
         cause = S1AP_CauseMisc_unspecified;
13
 
14
-        ogs_assert(OGS_OK == s1ap_send_s1_setup_failure(enb, group, cause));
15
+        r = s1ap_send_s1_setup_failure(enb, group, cause);
16
+        ogs_expect(r == OGS_OK);
17
+        ogs_assert(r != OGS_ERROR);
18
         return;
19
     }
20
 
21
@@ -173,7 +175,9 @@
22
         group = S1AP_Cause_PR_misc;
23
         cause = S1AP_CauseMisc_unspecified;
24
 
25
-        ogs_assert(OGS_OK == s1ap_send_s1_setup_failure(enb, group, cause));
26
+        r = s1ap_send_s1_setup_failure(enb, group, cause);
27
+        ogs_expect(r == OGS_OK);
28
+        ogs_assert(r != OGS_ERROR);
29
         return;
30
     }
31
 
32
@@ -183,17 +187,21 @@
33
         group = S1AP_Cause_PR_misc;
34
         cause = S1AP_CauseMisc_unknown_PLMN;
35
 
36
-        ogs_assert(OGS_OK == s1ap_send_s1_setup_failure(enb, group, cause));
37
+        r = s1ap_send_s1_setup_failure(enb, group, cause);
38
+        ogs_expect(r == OGS_OK);
39
+        ogs_assert(r != OGS_ERROR);
40
         return;
41
     }
42
 
43
     enb->state.s1_setup_success = true;
44
-    ogs_assert(OGS_OK == s1ap_send_s1_setup_response(enb));
45
+    r = s1ap_send_s1_setup_response(enb);
46
+    ogs_expect(r == OGS_OK);
47
+    ogs_assert(r != OGS_ERROR);
48
 }
49
 
50
 void s1ap_handle_initial_ue_message(mme_enb_t *enb, ogs_s1ap_message_t *message)
51
 {
52
-    int i;
53
+    int i, r;
54
     char bufOGS_ADDRSTRLEN;
55
 
56
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
57
@@ -251,19 +259,21 @@
58
 
59
     if (!ENB_UE_S1AP_ID) {
60
         ogs_error("No ENB_UE_S1AP_ID");
61
-        ogs_assert(OGS_OK ==
62
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
63
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
64
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
65
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
66
+        ogs_expect(r == OGS_OK);
67
+        ogs_assert(r != OGS_ERROR);
68
         return;
69
     }
70
     enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb, *ENB_UE_S1AP_ID);
71
     if (!enb_ue) {
72
         enb_ue = enb_ue_add(enb, *ENB_UE_S1AP_ID);
73
         if (enb_ue == NULL) {
74
-            ogs_assert(OGS_OK ==
75
-                s1ap_send_error_indication(enb, NULL, NULL,
76
+            r = s1ap_send_error_indication(enb, NULL, NULL,
77
                     S1AP_Cause_PR_misc,
78
-                    S1AP_CauseMisc_control_processing_overload));
79
+                    S1AP_CauseMisc_control_processing_overload);
80
+            ogs_expect(r == OGS_OK);
81
+            ogs_assert(r != OGS_ERROR);
82
             return;
83
         }
84
 
85
@@ -313,10 +323,11 @@
86
                     /* De-associate S1 with NAS/EMM */
87
                     enb_ue_deassociate(mme_ue->enb_ue);
88
 
89
-                    ogs_assert(OGS_OK ==
90
-                        s1ap_send_ue_context_release_command(mme_ue->enb_ue,
91
+                    r = s1ap_send_ue_context_release_command(mme_ue->enb_ue,
92
                             S1AP_Cause_PR_nas, S1AP_CauseNas_normal_release,
93
-                            S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0));
94
+                            S1AP_UE_CTX_REL_S1_CONTEXT_REMOVE, 0);
95
+                    ogs_expect(r == OGS_OK);
96
+                    ogs_assert(r != OGS_ERROR);
97
                 }
98
                 enb_ue_associate_mme_ue(enb_ue, mme_ue);
99
             }
100
@@ -325,25 +336,28 @@
101
 
102
     if (!NAS_PDU) {
103
         ogs_error("No NAS_PDU");
104
-        ogs_assert(OGS_OK ==
105
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
106
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
107
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
108
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
109
+        ogs_expect(r == OGS_OK);
110
+        ogs_assert(r != OGS_ERROR);
111
         return;
112
     }
113
 
114
     if (!TAI) {
115
         ogs_error("No TAI");
116
-        ogs_assert(OGS_OK ==
117
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
118
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
119
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
120
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
121
+        ogs_expect(r == OGS_OK);
122
+        ogs_assert(r != OGS_ERROR);
123
         return;
124
     }
125
 
126
     if (!EUTRAN_CGI) {
127
         ogs_error("No EUTRAN_CGI");
128
-        ogs_assert(OGS_OK ==
129
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
130
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
131
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
132
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
133
+        ogs_expect(r == OGS_OK);
134
+        ogs_assert(r != OGS_ERROR);
135
         return;
136
     }
137
 
138
@@ -371,15 +385,17 @@
139
         enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id,
140
         enb_ue->saved.tai.tac, enb_ue->saved.e_cgi.cell_id);
141
 
142
-    s1ap_send_to_nas(enb_ue,
143
+    r = s1ap_send_to_nas(enb_ue,
144
             S1AP_ProcedureCode_id_initialUEMessage, NAS_PDU);
145
+    ogs_expect(r == OGS_OK);
146
+    ogs_assert(r != OGS_ERROR);
147
 }
148
 
149
 void s1ap_handle_uplink_nas_transport(
150
         mme_enb_t *enb, ogs_s1ap_message_t *message)
151
 {
152
     char bufOGS_ADDRSTRLEN;
153
-    int i;
154
+    int i, r;
155
 
156
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
157
     S1AP_UplinkNASTransport_t *UplinkNASTransport = NULL;
158
@@ -436,9 +452,10 @@
159
 
160
     if (!MME_UE_S1AP_ID) {
161
         ogs_error("No MME_UE_S1AP_ID");
162
-        ogs_assert(OGS_OK ==
163
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
164
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
165
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
166
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
167
+        ogs_expect(r == OGS_OK);
168
+        ogs_assert(r != OGS_ERROR);
169
         return;
170
     }
171
 
172
@@ -446,18 +463,20 @@
173
     if (!enb_ue) {
174
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
175
                 (long long)*MME_UE_S1AP_ID);
176
-        ogs_assert(OGS_OK ==
177
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
178
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
179
                 S1AP_Cause_PR_radioNetwork,
180
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
181
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
182
+        ogs_expect(r == OGS_OK);
183
+        ogs_assert(r != OGS_ERROR);
184
         return;
185
     }
186
 
187
     if (!ENB_UE_S1AP_ID) {
188
         ogs_error("No ENB_UE_S1AP_ID");
189
-        ogs_assert(OGS_OK ==
190
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
191
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
192
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
193
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
194
+        ogs_expect(r == OGS_OK);
195
+        ogs_assert(r != OGS_ERROR);
196
         return;
197
     }
198
 
199
@@ -466,25 +485,28 @@
200
 
201
     if (!NAS_PDU) {
202
         ogs_error("No NAS_PDU");
203
-        ogs_assert(OGS_OK ==
204
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
205
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
206
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
207
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
208
+        ogs_expect(r == OGS_OK);
209
+        ogs_assert(r != OGS_ERROR);
210
         return;
211
     }
212
 
213
     if (!EUTRAN_CGI) {
214
         ogs_error("No EUTRAN_CGI");
215
-        ogs_assert(OGS_OK ==
216
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
217
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
218
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
219
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
220
+        ogs_expect(r == OGS_OK);
221
+        ogs_assert(r != OGS_ERROR);
222
         return;
223
     }
224
 
225
     if (!TAI) {
226
         ogs_error("No TAI");
227
-        ogs_assert(OGS_OK ==
228
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
229
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
230
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
231
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
232
+        ogs_expect(r == OGS_OK);
233
+        ogs_assert(r != OGS_ERROR);
234
         return;
235
     }
236
 
237
@@ -524,15 +546,17 @@
238
         ogs_assert_if_reached();
239
     }
240
 
241
-    s1ap_send_to_nas(enb_ue,
242
+    r = s1ap_send_to_nas(enb_ue,
243
             S1AP_ProcedureCode_id_uplinkNASTransport, NAS_PDU);
244
+    ogs_expect(r == OGS_OK);
245
+    ogs_assert(r != OGS_ERROR);
246
 }
247
 
248
 void s1ap_handle_ue_capability_info_indication(
249
         mme_enb_t *enb, ogs_s1ap_message_t *message)
250
 {
251
     char bufOGS_ADDRSTRLEN;
252
-    int i;
253
+    int i, r;
254
 
255
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
256
     S1AP_UECapabilityInfoIndication_t *UECapabilityInfoIndication = NULL;
257
@@ -578,9 +602,10 @@
258
 
259
     if (!MME_UE_S1AP_ID) {
260
         ogs_error("No MME_UE_S1AP_ID");
261
-        ogs_assert(OGS_OK ==
262
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
263
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
264
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
265
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
266
+        ogs_expect(r == OGS_OK);
267
+        ogs_assert(r != OGS_ERROR);
268
         return;
269
     }
270
 
271
@@ -588,18 +613,20 @@
272
     if (!enb_ue) {
273
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
274
                 (long long)*MME_UE_S1AP_ID);
275
-        ogs_assert(OGS_OK ==
276
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
277
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
278
                 S1AP_Cause_PR_radioNetwork,
279
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
280
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
281
+        ogs_expect(r == OGS_OK);
282
+        ogs_assert(r != OGS_ERROR);
283
         return;
284
     }
285
 
286
     if (!ENB_UE_S1AP_ID) {
287
         ogs_error("No ENB_UE_S1AP_ID");
288
-        ogs_assert(OGS_OK ==
289
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
290
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
291
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
292
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
293
+        ogs_expect(r == OGS_OK);
294
+        ogs_assert(r != OGS_ERROR);
295
         return;
296
     }
297
 
298
@@ -616,9 +643,8 @@
299
 void s1ap_handle_initial_context_setup_response(
300
         mme_enb_t *enb, ogs_s1ap_message_t *message)
301
 {
302
-    int rv;
303
+    int i, r, rv;
304
     char bufOGS_ADDRSTRLEN;
305
-    int i;
306
 
307
     S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
308
     S1AP_InitialContextSetupResponse_t *InitialContextSetupResponse = NULL;
309
@@ -666,9 +692,10 @@
310
 
311
     if (!MME_UE_S1AP_ID) {
312
         ogs_error("No MME_UE_S1AP_ID");
313
-        ogs_assert(OGS_OK ==
314
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
315
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
316
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
317
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
318
+        ogs_expect(r == OGS_OK);
319
+        ogs_assert(r != OGS_ERROR);
320
         return;
321
     }
322
 
323
@@ -676,18 +703,20 @@
324
     if (!enb_ue) {
325
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
326
                 (long long)*MME_UE_S1AP_ID);
327
-        ogs_assert(OGS_OK ==
328
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
329
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
330
                 S1AP_Cause_PR_radioNetwork,
331
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
332
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
333
+        ogs_expect(r == OGS_OK);
334
+        ogs_assert(r != OGS_ERROR);
335
         return;
336
     }
337
 
338
     if (!ENB_UE_S1AP_ID) {
339
         ogs_error("No ENB_UE_S1AP_ID");
340
-        ogs_assert(OGS_OK ==
341
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
342
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
343
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
344
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
345
+        ogs_expect(r == OGS_OK);
346
+        ogs_assert(r != OGS_ERROR);
347
         return;
348
     }
349
 
350
@@ -695,7 +724,10 @@
351
             enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
352
 
353
     mme_ue = enb_ue->mme_ue;
354
-    ogs_expect_or_return(mme_ue);
355
+    if (!mme_ue) {
356
+        ogs_error("No UE(mme-ue) context");
357
+        return;
358
+    }
359
 
360
     if (E_RABSetupListCtxtSURes) {
361
         int uli_presence = 0;
362
@@ -712,28 +744,31 @@
363
                 E_RABSetupListCtxtSURes->list.arrayi;
364
             if (!item) {
365
                 ogs_error("No S1AP_E_RABSetupItemCtxtSUResIEs_t");
366
-                ogs_assert(OGS_OK ==
367
-                    s1ap_send_error_indication2(mme_ue,
368
-                    S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
369
+                r = s1ap_send_error_indication2(mme_ue,
370
+                    S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
371
+                ogs_expect(r == OGS_OK);
372
+                ogs_assert(r != OGS_ERROR);
373
                 return;
374
             }
375
 
376
             e_rab = &item->value.choice.E_RABSetupItemCtxtSURes;
377
             if (!e_rab) {
378
                 ogs_error("No E_RABSetupItemCtxtSURes");
379
-                ogs_assert(OGS_OK ==
380
-                    s1ap_send_error_indication2(mme_ue,
381
-                    S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
382
+                r = s1ap_send_error_indication2(mme_ue,
383
+                    S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
384
+                ogs_expect(r == OGS_OK);
385
+                ogs_assert(r != OGS_ERROR);
386
                 return;
387
             }
388
 
389
             bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
390
             if (!bearer) {
391
                 ogs_error("No Bearer %d", (int)e_rab->e_RAB_ID);
392
-                ogs_assert(OGS_OK ==
393
-                    s1ap_send_error_indication2(mme_ue,
394
+                r = s1ap_send_error_indication2(mme_ue,
395
                         S1AP_Cause_PR_radioNetwork,
396
-                        S1AP_CauseRadioNetwork_unknown_E_RAB_ID));
397
+                        S1AP_CauseRadioNetwork_unknown_E_RAB_ID);
398
+                ogs_expect(r == OGS_OK);
399
+                ogs_assert(r != OGS_ERROR);
400
                 return;
401
             }
402
 
403
@@ -745,10 +780,11 @@
404
             if (rv != OGS_OK) {
405
                 ogs_error("No transportLayerAddress %d",
406
                         (int)e_rab->e_RAB_ID);
407
-                ogs_assert(OGS_OK ==
408
-                    s1ap_send_error_indication2(mme_ue,
409
+                r = s1ap_send_error_indication2(mme_ue,
410
                         S1AP_Cause_PR_protocol,
411
-                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
412
+                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
413
+                ogs_expect(r == OGS_OK);
414
+                ogs_assert(r != OGS_ERROR);
415
                 return;
416
             }
417
 
418
@@ -780,7 +816,7 @@
419
         mme_enb_t *enb, ogs_s1ap_message_t *message)
420
 {
421
     char bufOGS_ADDRSTRLEN;
422
-    int i;
423
+    int i, r;
424
 
425
     S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
426
     S1AP_InitialContextSetupFailure_t *InitialContextSetupFailure = NULL;
427
@@ -827,9 +863,10 @@
428
 
429
     if (!MME_UE_S1AP_ID) {
430
         ogs_error("No MME_UE_S1AP_ID");
431
-        ogs_assert(OGS_OK ==
432
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
433
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
434
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
435
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
436
+        ogs_expect(r == OGS_OK);
437
+        ogs_assert(r != OGS_ERROR);
438
         return;
439
     }
440
 
441
@@ -837,18 +874,20 @@
442
     if (!enb_ue) {
443
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
444
                 (long long)*MME_UE_S1AP_ID);
445
-        ogs_assert(OGS_OK ==
446
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
447
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
448
                 S1AP_Cause_PR_radioNetwork,
449
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
450
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
451
+        ogs_expect(r == OGS_OK);
452
+        ogs_assert(r != OGS_ERROR);
453
         return;
454
     }
455
 
456
     if (!ENB_UE_S1AP_ID) {
457
         ogs_error("No ENB_UE_S1AP_ID");
458
-        ogs_assert(OGS_OK ==
459
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
460
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
461
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
462
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
463
+        ogs_expect(r == OGS_OK);
464
+        ogs_assert(r != OGS_ERROR);
465
         return;
466
     }
467
 
468
@@ -857,9 +896,10 @@
469
 
470
     if (!Cause) {
471
         ogs_error("No Cause");
472
-        ogs_assert(OGS_OK ==
473
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
474
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
475
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
476
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
477
+        ogs_expect(r == OGS_OK);
478
+        ogs_assert(r != OGS_ERROR);
479
         return;
480
     }
481
 
482
@@ -894,7 +934,7 @@
483
         mme_enb_t *enb, ogs_s1ap_message_t *message)
484
 {
485
     char bufOGS_ADDRSTRLEN;
486
-    int i;
487
+    int i, r;
488
 
489
     S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
490
     S1AP_UEContextModificationResponse_t *UEContextModificationResponse = NULL;
491
@@ -938,9 +978,10 @@
492
 
493
     if (!MME_UE_S1AP_ID) {
494
         ogs_error("No MME_UE_S1AP_ID");
495
-        ogs_assert(OGS_OK ==
496
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
497
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
498
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
499
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
500
+        ogs_expect(r == OGS_OK);
501
+        ogs_assert(r != OGS_ERROR);
502
         return;
503
     }
504
 
505
@@ -948,18 +989,20 @@
506
     if (!enb_ue) {
507
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
508
                 (long long)*MME_UE_S1AP_ID);
509
-        ogs_assert(OGS_OK ==
510
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
511
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
512
                 S1AP_Cause_PR_radioNetwork,
513
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
514
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
515
+        ogs_expect(r == OGS_OK);
516
+        ogs_assert(r != OGS_ERROR);
517
         return;
518
     }
519
 
520
     if (!ENB_UE_S1AP_ID) {
521
         ogs_error("No ENB_UE_S1AP_ID");
522
-        ogs_assert(OGS_OK ==
523
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
524
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
525
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
526
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
527
+        ogs_expect(r == OGS_OK);
528
+        ogs_assert(r != OGS_ERROR);
529
         return;
530
     }
531
 
532
@@ -967,7 +1010,10 @@
533
             enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
534
 
535
     mme_ue = enb_ue->mme_ue;
536
-    ogs_expect_or_return(mme_ue);
537
+    if (!mme_ue) {
538
+        ogs_error("No UE(mme-ue) context");
539
+        return;
540
+    }
541
 
542
     CLEAR_SERVICE_INDICATOR(mme_ue);
543
 }
544
@@ -976,7 +1022,7 @@
545
         mme_enb_t *enb, ogs_s1ap_message_t *message)
546
 {
547
     char bufOGS_ADDRSTRLEN;
548
-    int i;
549
+    int i, r;
550
 
551
     S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
552
     S1AP_UEContextModificationFailure_t *UEContextModificationFailure = NULL;
553
@@ -1023,9 +1069,10 @@
554
 
555
     if (!MME_UE_S1AP_ID) {
556
         ogs_error("No MME_UE_S1AP_ID");
557
-        ogs_assert(OGS_OK ==
558
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
559
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
560
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
561
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
562
+        ogs_expect(r == OGS_OK);
563
+        ogs_assert(r != OGS_ERROR);
564
         return;
565
     }
566
 
567
@@ -1033,18 +1080,20 @@
568
     if (!enb_ue) {
569
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
570
                 (long long)*MME_UE_S1AP_ID);
571
-        ogs_assert(OGS_OK ==
572
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
573
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
574
                 S1AP_Cause_PR_radioNetwork,
575
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
576
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
577
+        ogs_expect(r == OGS_OK);
578
+        ogs_assert(r != OGS_ERROR);
579
         return;
580
     }
581
 
582
     if (!ENB_UE_S1AP_ID) {
583
         ogs_error("No ENB_UE_S1AP_ID");
584
-        ogs_assert(OGS_OK ==
585
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
586
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
587
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
588
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
589
+        ogs_expect(r == OGS_OK);
590
+        ogs_assert(r != OGS_ERROR);
591
         return;
592
     }
593
 
594
@@ -1053,9 +1102,10 @@
595
 
596
     if (!Cause) {
597
         ogs_error("No Cause");
598
-        ogs_assert(OGS_OK ==
599
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
600
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
601
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
602
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
603
+        ogs_expect(r == OGS_OK);
604
+        ogs_assert(r != OGS_ERROR);
605
         return;
606
     }
607
 
608
@@ -1063,7 +1113,10 @@
609
             Cause->present, (int)Cause->choice.radioNetwork);
610
 
611
     mme_ue = enb_ue->mme_ue;
612
-    ogs_expect_or_return(mme_ue);
613
+    if (!mme_ue) {
614
+        ogs_error("No UE(mme-ue) context");
615
+        return;
616
+    }
617
     CLEAR_SERVICE_INDICATOR(mme_ue);
618
 }
619
 
620
@@ -1071,9 +1124,8 @@
621
 void s1ap_handle_e_rab_setup_response(
622
         mme_enb_t *enb, ogs_s1ap_message_t *message)
623
 {
624
-    int rv;
625
+    int i, r, rv;
626
     char bufOGS_ADDRSTRLEN;
627
-    int i;
628
 
629
     S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
630
     S1AP_E_RABSetupResponse_t *E_RABSetupResponse = NULL;
631
@@ -1130,9 +1182,10 @@
632
 
633
     if (!MME_UE_S1AP_ID) {
634
         ogs_error("No MME_UE_S1AP_ID");
635
-        ogs_assert(OGS_OK ==
636
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
637
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
638
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
639
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
640
+        ogs_expect(r == OGS_OK);
641
+        ogs_assert(r != OGS_ERROR);
642
         return;
643
     }
644
 
645
@@ -1140,18 +1193,20 @@
646
     if (!enb_ue) {
647
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
648
                 (long long)*MME_UE_S1AP_ID);
649
-        ogs_assert(OGS_OK ==
650
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
651
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
652
                 S1AP_Cause_PR_radioNetwork,
653
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
654
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
655
+        ogs_expect(r == OGS_OK);
656
+        ogs_assert(r != OGS_ERROR);
657
         return;
658
     }
659
 
660
     if (!ENB_UE_S1AP_ID) {
661
         ogs_error("No ENB_UE_S1AP_ID");
662
-        ogs_assert(OGS_OK ==
663
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
664
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
665
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
666
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
667
+        ogs_expect(r == OGS_OK);
668
+        ogs_assert(r != OGS_ERROR);
669
         return;
670
     }
671
 
672
@@ -1159,7 +1214,10 @@
673
         enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
674
 
675
     mme_ue = enb_ue->mme_ue;
676
-    ogs_expect_or_return(mme_ue);
677
+    if (!mme_ue) {
678
+        ogs_error("No UE(mme-ue) context");
679
+        return;
680
+    }
681
 
682
     if (E_RABSetupListBearerSURes) {
683
         for (i = 0; i < E_RABSetupListBearerSURes->list.count; i++) {
684
@@ -1172,30 +1230,33 @@
685
                 E_RABSetupListBearerSURes->list.arrayi;
686
             if (!item) {
687
                 ogs_error("No S1AP_E_RABSetupItemBearerSUResIEs_t");
688
-                ogs_assert(OGS_OK ==
689
-                    s1ap_send_error_indication2(mme_ue,
690
+                r = s1ap_send_error_indication2(mme_ue,
691
                         S1AP_Cause_PR_protocol,
692
-                        S1AP_CauseProtocol_semantic_error));
693
+                        S1AP_CauseProtocol_semantic_error);
694
+                ogs_expect(r == OGS_OK);
695
+                ogs_assert(r != OGS_ERROR);
696
                 return;
697
             }
698
 
699
             e_rab = &item->value.choice.E_RABSetupItemBearerSURes;
700
             if (!e_rab) {
701
                 ogs_error("No E_RABSetupItemBearerSURes");
702
-                ogs_assert(OGS_OK ==
703
-                    s1ap_send_error_indication2(mme_ue,
704
+                r = s1ap_send_error_indication2(mme_ue,
705
                         S1AP_Cause_PR_protocol,
706
-                        S1AP_CauseProtocol_semantic_error));
707
+                        S1AP_CauseProtocol_semantic_error);
708
+                ogs_expect(r == OGS_OK);
709
+                ogs_assert(r != OGS_ERROR);
710
                 return;
711
             }
712
 
713
             bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
714
             if (!bearer) {
715
                 ogs_error("No Bearer %d", (int)e_rab->e_RAB_ID);
716
-                ogs_assert(OGS_OK ==
717
-                    s1ap_send_error_indication2(mme_ue,
718
+                r = s1ap_send_error_indication2(mme_ue,
719
                         S1AP_Cause_PR_radioNetwork,
720
-                        S1AP_CauseRadioNetwork_unknown_E_RAB_ID));
721
+                        S1AP_CauseRadioNetwork_unknown_E_RAB_ID);
722
+                ogs_expect(r == OGS_OK);
723
+                ogs_assert(r != OGS_ERROR);
724
                 return;
725
             }
726
 
727
@@ -1207,10 +1268,11 @@
728
             if (rv != OGS_OK) {
729
                 ogs_error("No transportLayerAddress %d",
730
                         (int)e_rab->e_RAB_ID);
731
-                ogs_assert(OGS_OK ==
732
-                    s1ap_send_error_indication2(mme_ue,
733
+                r = s1ap_send_error_indication2(mme_ue,
734
                         S1AP_Cause_PR_protocol,
735
-                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
736
+                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
737
+                ogs_expect(r == OGS_OK);
738
+                ogs_assert(r != OGS_ERROR);
739
                 return;
740
             }
741
 
742
@@ -1244,10 +1306,11 @@
743
 
744
             if (!item) {
745
                 ogs_error("No S1AP_E_RABItem_t");
746
-                ogs_assert(OGS_OK ==
747
-                    s1ap_send_error_indication2(mme_ue,
748
+                r = s1ap_send_error_indication2(mme_ue,
749
                         S1AP_Cause_PR_protocol,
750
-                        S1AP_CauseProtocol_semantic_error));
751
+                        S1AP_CauseProtocol_semantic_error);
752
+                ogs_expect(r == OGS_OK);
753
+                ogs_assert(r != OGS_ERROR);
754
                 return;
755
             }
756
 
757
@@ -1279,7 +1342,7 @@
758
         mme_enb_t *enb, ogs_s1ap_message_t *message)
759
 {
760
     char bufOGS_ADDRSTRLEN;
761
-    int i;
762
+    int i, r;
763
 
764
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
765
     S1AP_UEContextReleaseRequest_t *UEContextReleaseRequest = NULL;
766
@@ -1325,20 +1388,22 @@
767
 
768
     if (!MME_UE_S1AP_ID) {
769
         ogs_error("No MME_UE_S1AP_ID");
770
-        ogs_assert(OGS_OK ==
771
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
772
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
773
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
774
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
775
+        ogs_expect(r == OGS_OK);
776
+        ogs_assert(r != OGS_ERROR);
777
         return;
778
     }
779
     enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
780
     if (!enb_ue) {
781
         ogs_warn("No ENB UE Context : MME_UE_S1AP_ID%d",
782
                 (int)*MME_UE_S1AP_ID);
783
-        ogs_assert(OGS_OK ==
784
-            s1ap_send_error_indication(enb,
785
+        r = s1ap_send_error_indication(enb,
786
                 MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
787
                 S1AP_Cause_PR_radioNetwork,
788
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
789
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
790
+        ogs_expect(r == OGS_OK);
791
+        ogs_assert(r != OGS_ERROR);
792
         return;
793
     }
794
 
795
@@ -1347,9 +1412,10 @@
796
 
797
     if (!Cause) {
798
         ogs_error("No Cause");
799
-        ogs_assert(OGS_OK ==
800
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
801
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
802
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
803
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
804
+        ogs_expect(r == OGS_OK);
805
+        ogs_assert(r != OGS_ERROR);
806
         return;
807
     }
808
 
809
@@ -1377,7 +1443,7 @@
810
         mme_enb_t *enb, ogs_s1ap_message_t *message)
811
 {
812
     char bufOGS_ADDRSTRLEN;
813
-    int i;
814
+    int i, r;
815
 
816
     S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
817
     S1AP_UEContextReleaseComplete_t *UEContextReleaseComplete = NULL;
818
@@ -1419,20 +1485,22 @@
819
 
820
     if (!MME_UE_S1AP_ID) {
821
         ogs_error("No MME_UE_S1AP_ID");
822
-        ogs_assert(OGS_OK ==
823
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
824
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
825
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
826
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
827
+        ogs_expect(r == OGS_OK);
828
+        ogs_assert(r != OGS_ERROR);
829
         return;
830
     }
831
     enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
832
     if (!enb_ue) {
833
         ogs_warn("No ENB UE Context : MME_UE_S1AP_ID%d",
834
                 (int)*MME_UE_S1AP_ID);
835
-        ogs_assert(OGS_OK ==
836
-            s1ap_send_error_indication(enb,
837
+        r = s1ap_send_error_indication(enb,
838
                 MME_UE_S1AP_ID, NULL,
839
                 S1AP_Cause_PR_radioNetwork,
840
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
841
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
842
+        ogs_expect(r == OGS_OK);
843
+        ogs_assert(r != OGS_ERROR);
844
         return;
845
     }
846
 
847
@@ -1441,6 +1509,7 @@
848
 
849
 void s1ap_handle_ue_context_release_action(enb_ue_t *enb_ue)
850
 {
851
+    int r;
852
     mme_ue_t *mme_ue = NULL;
853
 
854
     ogs_assert(enb_ue);
855
@@ -1477,13 +1546,19 @@
856
     case S1AP_UE_CTX_REL_S1_REMOVE_AND_UNLINK:
857
         ogs_debug("    Action: S1 normal release");
858
         enb_ue_remove(enb_ue);
859
-        ogs_expect_or_return(mme_ue);
860
+        if (!mme_ue) {
861
+            ogs_error("No UE(mme-ue) context");
862
+            return;
863
+        }
864
         enb_ue_unlink(mme_ue);
865
         break;
866
     case S1AP_UE_CTX_REL_UE_CONTEXT_REMOVE:
867
         ogs_debug("    Action: UE context remove");
868
         enb_ue_remove(enb_ue);
869
-        ogs_expect_or_return(mme_ue);
870
+        if (!mme_ue) {
871
+            ogs_error("No UE(mme-ue) context");
872
+            return;
873
+        }
874
 
875
         if (mme_ue->location_updated_but_not_canceled_yet == true) {
876
             mme_s6a_send_pur(mme_ue);
877
@@ -1498,7 +1573,10 @@
878
         enb_ue_source_deassociate_target(enb_ue);
879
         enb_ue_remove(enb_ue);
880
 
881
-        ogs_expect_or_return(mme_ue);
882
+        if (!mme_ue) {
883
+            ogs_error("No UE(mme-ue) context");
884
+            return;
885
+        }
886
         if (mme_ue_have_indirect_tunnel(mme_ue) == true) {
887
             ogs_assert(OGS_OK ==
888
                 mme_gtp_send_delete_indirect_data_forwarding_tunnel_request(
889
@@ -1516,7 +1594,10 @@
890
         enb_ue_source_deassociate_target(enb_ue);
891
         enb_ue_remove(enb_ue);
892
 
893
-        ogs_expect_or_return(mme_ue);
894
+        if (!mme_ue) {
895
+            ogs_error("No UE(mme-ue) context");
896
+            return;
897
+        }
898
         if (mme_ue_have_indirect_tunnel(mme_ue) == true) {
899
             ogs_assert(OGS_OK ==
900
                 mme_gtp_send_delete_indirect_data_forwarding_tunnel_request(
901
@@ -1527,9 +1608,13 @@
902
             ogs_warn("  Packet could be dropped during S1-Handover");
903
             mme_ue_clear_indirect_tunnel(mme_ue);
904
 
905
-            ogs_expect_or_return(mme_ue->enb_ue);
906
-            ogs_assert(OGS_OK ==
907
-                s1ap_send_handover_cancel_ack(mme_ue->enb_ue));
908
+            if (!mme_ue->enb_ue) {
909
+                ogs_error("No S1 context");
910
+                return;
911
+            }
912
+            r = s1ap_send_handover_cancel_ack(mme_ue->enb_ue);
913
+            ogs_expect(r == OGS_OK);
914
+            ogs_assert(r != OGS_ERROR);
915
         }
916
         break;
917
     case S1AP_UE_CTX_REL_S1_HANDOVER_FAILURE:
918
@@ -1538,7 +1623,10 @@
919
         enb_ue_source_deassociate_target(enb_ue);
920
         enb_ue_remove(enb_ue);
921
 
922
-        ogs_expect_or_return(mme_ue);
923
+        if (!mme_ue) {
924
+            ogs_error("No UE(mme-ue) context");
925
+            return;
926
+        }
927
         if (mme_ue_have_indirect_tunnel(mme_ue) == true) {
928
             ogs_error("Check your eNodeB");
929
             ogs_error("  We found INDIRECT TUNNEL in HandoverFailure");
930
@@ -1548,10 +1636,15 @@
931
     case S1AP_UE_CTX_REL_S1_PAGING:
932
         ogs_debug("    Action: S1 paging");
933
         enb_ue_remove(enb_ue);
934
-        ogs_expect_or_return(mme_ue);
935
+        if (!mme_ue) {
936
+            ogs_error("No UE(mme-ue) context");
937
+            return;
938
+        }
939
         enb_ue_unlink(mme_ue);
940
 
941
-        ogs_assert(OGS_OK == s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
942
+        r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
943
+        ogs_expect(r == OGS_OK);
944
+        ogs_assert(r != OGS_ERROR);
945
         break;
946
     default:
947
         ogs_error("Invalid Action%d", enb_ue->ue_ctx_rel_action);
948
@@ -1563,7 +1656,7 @@
949
         mme_enb_t *enb, ogs_s1ap_message_t *message)
950
 {
951
     char bufOGS_ADDRSTRLEN;
952
-    int rv, i;
953
+    int i, r, rv;
954
 
955
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
956
     S1AP_E_RABModificationIndication_t *E_RABModificationIndication = NULL;
957
@@ -1611,28 +1704,31 @@
958
 
959
     if (!MME_UE_S1AP_ID) {
960
         ogs_error("No MME_UE_S1AP_ID");
961
-        ogs_assert(OGS_OK ==
962
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
963
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
964
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
965
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
966
+        ogs_expect(r == OGS_OK);
967
+        ogs_assert(r != OGS_ERROR);
968
         return;
969
     }
970
     enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
971
     if (!enb_ue) {
972
         ogs_warn("No ENB UE Context : MME_UE_S1AP_ID%d",
973
                 (int)*MME_UE_S1AP_ID);
974
-        ogs_assert(OGS_OK ==
975
-            s1ap_send_error_indication(enb,
976
+        r = s1ap_send_error_indication(enb,
977
                 MME_UE_S1AP_ID, NULL,
978
                 S1AP_Cause_PR_radioNetwork,
979
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
980
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
981
+        ogs_expect(r == OGS_OK);
982
+        ogs_assert(r != OGS_ERROR);
983
         return;
984
     }
985
 
986
     if (!ENB_UE_S1AP_ID) {
987
         ogs_error("No ENB_UE_S1AP_ID");
988
-        ogs_assert(OGS_OK ==
989
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
990
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
991
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
992
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
993
+        ogs_expect(r == OGS_OK);
994
+        ogs_assert(r != OGS_ERROR);
995
         return;
996
     }
997
 
998
@@ -1641,14 +1737,18 @@
999
 
1000
     if (!E_RABToBeModifiedListBearerModInd) {
1001
         ogs_error("No E_RABToBeModifiedListBearerModInd");
1002
-        ogs_assert(OGS_OK ==
1003
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1004
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1005
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1006
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1007
+        ogs_expect(r == OGS_OK);
1008
+        ogs_assert(r != OGS_ERROR);
1009
         return;
1010
     }
1011
 
1012
     mme_ue = enb_ue->mme_ue;
1013
-    ogs_expect_or_return(mme_ue);
1014
+    if (!mme_ue) {
1015
+        ogs_error("No UE(mme-ue) context");
1016
+        return;
1017
+    }
1018
 
1019
     ogs_list_init(&mme_ue->bearer_to_modify_list);
1020
 
1021
@@ -1662,28 +1762,31 @@
1022
                 E_RABToBeModifiedListBearerModInd->list.arrayi;
1023
         if (!item) {
1024
             ogs_error("No S1AP_E_RABToBeModifiedItemBearerModIndIEs_t");
1025
-            ogs_assert(OGS_OK ==
1026
-                s1ap_send_error_indication2(mme_ue,
1027
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1028
+            r = s1ap_send_error_indication2(mme_ue,
1029
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1030
+            ogs_expect(r == OGS_OK);
1031
+            ogs_assert(r != OGS_ERROR);
1032
             return;
1033
         }
1034
 
1035
         e_rab = &item->value.choice.E_RABToBeModifiedItemBearerModInd;
1036
         if (!e_rab) {
1037
             ogs_error("No E_RABToBeModifiedItemBearerModInd");
1038
-            ogs_assert(OGS_OK ==
1039
-                s1ap_send_error_indication2(mme_ue,
1040
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1041
+            r = s1ap_send_error_indication2(mme_ue,
1042
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1043
+            ogs_expect(r == OGS_OK);
1044
+            ogs_assert(r != OGS_ERROR);
1045
             return;
1046
         }
1047
 
1048
         bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
1049
         if (!bearer) {
1050
             ogs_error("No Bearer %d", (int)e_rab->e_RAB_ID);
1051
-            ogs_assert(OGS_OK ==
1052
-                s1ap_send_error_indication2(mme_ue,
1053
+            r = s1ap_send_error_indication2(mme_ue,
1054
                     S1AP_Cause_PR_radioNetwork,
1055
-                    S1AP_CauseRadioNetwork_unknown_E_RAB_ID));
1056
+                    S1AP_CauseRadioNetwork_unknown_E_RAB_ID);
1057
+            ogs_expect(r == OGS_OK);
1058
+            ogs_assert(r != OGS_ERROR);
1059
             return;
1060
         }
1061
 
1062
@@ -1695,10 +1798,11 @@
1063
         if (rv != OGS_OK) {
1064
             ogs_error("No transportLayerAddress %d",
1065
                     (int)e_rab->e_RAB_ID);
1066
-            ogs_assert(OGS_OK ==
1067
-                s1ap_send_error_indication2(mme_ue,
1068
+            r = s1ap_send_error_indication2(mme_ue,
1069
                     S1AP_Cause_PR_protocol,
1070
-                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
1071
+                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
1072
+            ogs_expect(r == OGS_OK);
1073
+            ogs_assert(r != OGS_ERROR);
1074
             return;
1075
         }
1076
 
1077
@@ -1714,9 +1818,8 @@
1078
 void s1ap_handle_path_switch_request(
1079
         mme_enb_t *enb, ogs_s1ap_message_t *message)
1080
 {
1081
-    int rv;
1082
+    int i, r, rv;
1083
     char bufOGS_ADDRSTRLEN;
1084
-    int i;
1085
 
1086
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
1087
     S1AP_PathSwitchRequest_t *PathSwitchRequest = NULL;
1088
@@ -1786,16 +1889,18 @@
1089
 
1090
     if (!ENB_UE_S1AP_ID) {
1091
         ogs_error("No ENB_UE_S1AP_ID");
1092
-        ogs_assert(OGS_OK ==
1093
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1094
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1095
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1096
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1097
+        ogs_expect(r == OGS_OK);
1098
+        ogs_assert(r != OGS_ERROR);
1099
         return;
1100
     }
1101
     if (!MME_UE_S1AP_ID) {
1102
         ogs_error("No MME_UE_S1AP_ID");
1103
-        ogs_assert(OGS_OK ==
1104
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1105
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1106
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1107
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1108
+        ogs_expect(r == OGS_OK);
1109
+        ogs_assert(r != OGS_ERROR);
1110
         return;
1111
     }
1112
     enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
1113
@@ -1808,10 +1913,14 @@
1114
                 *ENB_UE_S1AP_ID, *MME_UE_S1AP_ID,
1115
                 S1AP_Cause_PR_radioNetwork,
1116
                 S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
1117
-        ogs_expect_or_return(s1apbuf);
1118
+        if (!s1apbuf) {
1119
+            ogs_error("s1ap_build_path_switch_failure() failed");
1120
+            return;
1121
+        }
1122
 
1123
-        ogs_expect(OGS_OK ==
1124
-                s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING));
1125
+        r = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
1126
+        ogs_expect(r == OGS_OK);
1127
+        ogs_assert(r != OGS_ERROR);
1128
         return;
1129
     }
1130
 
1131
@@ -1820,9 +1929,10 @@
1132
 
1133
     if (!EUTRAN_CGI) {
1134
         ogs_error("No EUTRAN_CGI");
1135
-        ogs_assert(OGS_OK ==
1136
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1137
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1138
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1139
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1140
+        ogs_expect(r == OGS_OK);
1141
+        ogs_assert(r != OGS_ERROR);
1142
         return;
1143
     }
1144
 
1145
@@ -1833,9 +1943,10 @@
1146
 
1147
     if (!TAI) {
1148
         ogs_error("No TAI");
1149
-        ogs_assert(OGS_OK ==
1150
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1151
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1152
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1153
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1154
+        ogs_expect(r == OGS_OK);
1155
+        ogs_assert(r != OGS_ERROR);
1156
         return;
1157
     }
1158
 
1159
@@ -1846,23 +1957,32 @@
1160
 
1161
     if (!E_RABToBeSwitchedDLList) {
1162
         ogs_error("No E_RABToBeSwitchedDLList");
1163
-        ogs_assert(OGS_OK ==
1164
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1165
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1166
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1167
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1168
+        ogs_expect(r == OGS_OK);
1169
+        ogs_assert(r != OGS_ERROR);
1170
         return;
1171
     }
1172
 
1173
     mme_ue = enb_ue->mme_ue;
1174
-    ogs_expect_or_return(mme_ue);
1175
+    if (!mme_ue) {
1176
+        ogs_error("No UE(mme-ue) context");
1177
+        return;
1178
+    }
1179
 
1180
     if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
1181
         ogs_error("No Security Context");
1182
         s1apbuf = s1ap_build_path_switch_failure(
1183
                 *ENB_UE_S1AP_ID, *MME_UE_S1AP_ID,
1184
                 S1AP_Cause_PR_nas, S1AP_CauseNas_authentication_failure);
1185
-        ogs_expect_or_return(s1apbuf);
1186
+        if (!s1apbuf) {
1187
+            ogs_error("s1ap_build_path_switch_failure() failed");
1188
+            return;
1189
+        }
1190
 
1191
-        s1ap_send_to_enb_ue(enb_ue, s1apbuf);
1192
+        r = s1ap_send_to_enb_ue(enb_ue, s1apbuf);
1193
+        ogs_expect(r == OGS_OK);
1194
+        ogs_assert(r != OGS_ERROR);
1195
         return;
1196
     }
1197
 
1198
@@ -1940,28 +2060,31 @@
1199
             E_RABToBeSwitchedDLList->list.arrayi;
1200
         if (!item) {
1201
             ogs_error("No S1AP_E_RABToBeSwitchedDLItemIEs_t");
1202
-            ogs_assert(OGS_OK ==
1203
-                s1ap_send_error_indication2(mme_ue,
1204
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1205
+            r = s1ap_send_error_indication2(mme_ue,
1206
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1207
+            ogs_expect(r == OGS_OK);
1208
+            ogs_assert(r != OGS_ERROR);
1209
             return;
1210
         }
1211
 
1212
         e_rab = &item->value.choice.E_RABToBeSwitchedDLItem;
1213
         if (!e_rab) {
1214
             ogs_error("No E_RABToBeSwitchedDLItem");
1215
-            ogs_assert(OGS_OK ==
1216
-                s1ap_send_error_indication2(mme_ue,
1217
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1218
+            r = s1ap_send_error_indication2(mme_ue,
1219
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1220
+            ogs_expect(r == OGS_OK);
1221
+            ogs_assert(r != OGS_ERROR);
1222
             return;
1223
         }
1224
 
1225
         bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
1226
         if (!bearer) {
1227
             ogs_error("No Bearer %d", (int)e_rab->e_RAB_ID);
1228
-            ogs_assert(OGS_OK ==
1229
-                s1ap_send_error_indication2(mme_ue,
1230
+            r = s1ap_send_error_indication2(mme_ue,
1231
                     S1AP_Cause_PR_radioNetwork,
1232
-                    S1AP_CauseRadioNetwork_unknown_E_RAB_ID));
1233
+                    S1AP_CauseRadioNetwork_unknown_E_RAB_ID);
1234
+            ogs_expect(r == OGS_OK);
1235
+            ogs_assert(r != OGS_ERROR);
1236
             return;
1237
         }
1238
 
1239
@@ -1973,10 +2096,11 @@
1240
         if (rv != OGS_OK) {
1241
             ogs_error("No transportLayerAddress %d",
1242
                     (int)e_rab->e_RAB_ID);
1243
-            ogs_assert(OGS_OK ==
1244
-                s1ap_send_error_indication2(mme_ue,
1245
+            r = s1ap_send_error_indication2(mme_ue,
1246
                     S1AP_Cause_PR_protocol,
1247
-                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
1248
+                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
1249
+            ogs_expect(r == OGS_OK);
1250
+            ogs_assert(r != OGS_ERROR);
1251
             return;
1252
         }
1253
 
1254
@@ -2011,7 +2135,7 @@
1255
         mme_enb_t *enb, ogs_s1ap_message_t *message, ogs_pkbuf_t *pkbuf)
1256
 {
1257
     char bufOGS_ADDRSTRLEN;
1258
-    int i;
1259
+    int i, r;
1260
 
1261
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
1262
     S1AP_ENBConfigurationTransfer_t *ENBConfigurationTransfer = NULL;
1263
@@ -2084,23 +2208,25 @@
1264
         if (target_enb == NULL) {
1265
             ogs_error("eNB configuration transfer : "
1266
                         "cannot find target eNB-id0x%x", target_enb_id);
1267
-            ogs_assert(OGS_OK ==
1268
-                s1ap_send_error_indication(enb, NULL, NULL,
1269
+            r = s1ap_send_error_indication(enb, NULL, NULL,
1270
                     S1AP_Cause_PR_radioNetwork,
1271
-                    S1AP_CauseRadioNetwork_unknown_targetID));
1272
+                    S1AP_CauseRadioNetwork_unknown_targetID);
1273
+            ogs_expect(r == OGS_OK);
1274
+            ogs_assert(r != OGS_ERROR);
1275
             return;
1276
         }
1277
 
1278
-        ogs_assert(OGS_OK ==
1279
-            s1ap_send_mme_configuration_transfer(
1280
-                target_enb, SONConfigurationTransfer));
1281
+        r = s1ap_send_mme_configuration_transfer(
1282
+                target_enb, SONConfigurationTransfer);
1283
+        ogs_expect(r == OGS_OK);
1284
+        ogs_assert(r != OGS_ERROR);
1285
     }
1286
 }
1287
 
1288
 void s1ap_handle_handover_required(mme_enb_t *enb, ogs_s1ap_message_t *message)
1289
 {
1290
     char bufOGS_ADDRSTRLEN;
1291
-    int i;
1292
+    int i, r;
1293
 
1294
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
1295
     S1AP_HandoverRequired_t *HandoverRequired = NULL;
1296
@@ -2161,9 +2287,10 @@
1297
 
1298
     if (!MME_UE_S1AP_ID) {
1299
         ogs_error("No MME_UE_S1AP_ID");
1300
-        ogs_assert(OGS_OK ==
1301
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1302
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1303
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1304
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1305
+        ogs_expect(r == OGS_OK);
1306
+        ogs_assert(r != OGS_ERROR);
1307
         return;
1308
     }
1309
 
1310
@@ -2171,18 +2298,20 @@
1311
     if (!source_ue) {
1312
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
1313
                 (long long)*MME_UE_S1AP_ID);
1314
-        ogs_assert(OGS_OK ==
1315
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1316
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1317
                 S1AP_Cause_PR_radioNetwork,
1318
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
1319
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
1320
+        ogs_expect(r == OGS_OK);
1321
+        ogs_assert(r != OGS_ERROR);
1322
         return;
1323
     }
1324
 
1325
     if (!ENB_UE_S1AP_ID) {
1326
         ogs_error("No ENB_UE_S1AP_ID");
1327
-        ogs_assert(OGS_OK ==
1328
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1329
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1330
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1331
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1332
+        ogs_expect(r == OGS_OK);
1333
+        ogs_assert(r != OGS_ERROR);
1334
         return;
1335
     }
1336
 
1337
@@ -2191,33 +2320,37 @@
1338
 
1339
     if (!HandoverType) {
1340
         ogs_error("No HandoverType");
1341
-        ogs_assert(OGS_OK ==
1342
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1343
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1344
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1345
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1346
+        ogs_expect(r == OGS_OK);
1347
+        ogs_assert(r != OGS_ERROR);
1348
         return;
1349
     }
1350
 
1351
     if (!Cause) {
1352
         ogs_error("No Cause");
1353
-        ogs_assert(OGS_OK ==
1354
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1355
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1356
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1357
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1358
+        ogs_expect(r == OGS_OK);
1359
+        ogs_assert(r != OGS_ERROR);
1360
         return;
1361
     }
1362
 
1363
     if (!TargetID) {
1364
         ogs_error("No TargetID");
1365
-        ogs_assert(OGS_OK ==
1366
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1367
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1368
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1369
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1370
+        ogs_expect(r == OGS_OK);
1371
+        ogs_assert(r != OGS_ERROR);
1372
         return;
1373
     }
1374
 
1375
     if (!Source_ToTarget_TransparentContainer) {
1376
         ogs_error("No Source_ToTarget_TransparentContainer");
1377
-        ogs_assert(OGS_OK ==
1378
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1379
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1380
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1381
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1382
+        ogs_expect(r == OGS_OK);
1383
+        ogs_assert(r != OGS_ERROR);
1384
         return;
1385
     }
1386
 
1387
@@ -2229,9 +2362,10 @@
1388
         break;
1389
     default:
1390
         ogs_error("Not implemented(%d)", TargetID->present);
1391
-        ogs_assert(OGS_OK ==
1392
-            s1ap_send_handover_preparation_failure(source_ue,
1393
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1394
+        r = s1ap_send_handover_preparation_failure(source_ue,
1395
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1396
+        ogs_expect(r == OGS_OK);
1397
+        ogs_assert(r != OGS_ERROR);
1398
         return;
1399
     }
1400
 
1401
@@ -2239,21 +2373,26 @@
1402
     if (target_enb == NULL) {
1403
         ogs_error("Handover required : cannot find target eNB-id0x%x",
1404
                     target_enb_id);
1405
-        ogs_assert(OGS_OK ==
1406
-            s1ap_send_handover_preparation_failure(source_ue,
1407
+        r = s1ap_send_handover_preparation_failure(source_ue,
1408
                 S1AP_Cause_PR_radioNetwork,
1409
-                S1AP_CauseRadioNetwork_unknown_targetID));
1410
+                S1AP_CauseRadioNetwork_unknown_targetID);
1411
+        ogs_expect(r == OGS_OK);
1412
+        ogs_assert(r != OGS_ERROR);
1413
         return;
1414
     }
1415
 
1416
     mme_ue = source_ue->mme_ue;
1417
-    ogs_expect_or_return(mme_ue);
1418
+    if (!mme_ue) {
1419
+        ogs_error("No UE(mme-ue) context");
1420
+        return;
1421
+    }
1422
 
1423
     if (!SECURITY_CONTEXT_IS_VALID(mme_ue)) {
1424
         ogs_error("No Security Context");
1425
-        ogs_assert(OGS_OK ==
1426
-            s1ap_send_handover_preparation_failure(source_ue,
1427
-                S1AP_Cause_PR_nas, S1AP_CauseNas_authentication_failure));
1428
+        r = s1ap_send_handover_preparation_failure(source_ue,
1429
+                S1AP_Cause_PR_nas, S1AP_CauseNas_authentication_failure);
1430
+        ogs_expect(r == OGS_OK);
1431
+        ogs_assert(r != OGS_ERROR);
1432
         return;
1433
     }
1434
 
1435
@@ -2262,18 +2401,18 @@
1436
     mme_ue->nhcc++;
1437
     ogs_kdf_nh_enb(mme_ue->kasme, mme_ue->nh, mme_ue->nh);
1438
 
1439
-    ogs_assert(OGS_OK ==
1440
-        s1ap_send_handover_request(
1441
+    r = s1ap_send_handover_request(
1442
             source_ue, target_enb, HandoverType, Cause,
1443
-            Source_ToTarget_TransparentContainer));
1444
+            Source_ToTarget_TransparentContainer);
1445
+    ogs_expect(r == OGS_OK);
1446
+    ogs_assert(r != OGS_ERROR);
1447
 }
1448
 
1449
 void s1ap_handle_handover_request_ack(
1450
         mme_enb_t *enb, ogs_s1ap_message_t *message)
1451
 {
1452
-    int rv;
1453
+    int i, r, rv;
1454
     char bufOGS_ADDRSTRLEN;
1455
-    int i;
1456
 
1457
     S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
1458
     S1AP_HandoverRequestAcknowledge_t *HandoverRequestAcknowledge = NULL;
1459
@@ -2326,9 +2465,10 @@
1460
 
1461
     if (!MME_UE_S1AP_ID) {
1462
         ogs_error("No MME_UE_S1AP_ID");
1463
-        ogs_assert(OGS_OK ==
1464
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1465
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1466
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1467
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1468
+        ogs_expect(r == OGS_OK);
1469
+        ogs_assert(r != OGS_ERROR);
1470
         return;
1471
     }
1472
 
1473
@@ -2336,48 +2476,56 @@
1474
     if (!target_ue) {
1475
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
1476
                 (long long)*MME_UE_S1AP_ID);
1477
-        ogs_assert(OGS_OK ==
1478
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1479
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1480
                 S1AP_Cause_PR_radioNetwork,
1481
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
1482
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
1483
+        ogs_expect(r == OGS_OK);
1484
+        ogs_assert(r != OGS_ERROR);
1485
         return;
1486
     }
1487
 
1488
     if (!ENB_UE_S1AP_ID) {
1489
         ogs_error("No ENB_UE_S1AP_ID");
1490
-        ogs_assert(OGS_OK ==
1491
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1492
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1493
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1494
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1495
+        ogs_expect(r == OGS_OK);
1496
+        ogs_assert(r != OGS_ERROR);
1497
         return;
1498
     }
1499
 
1500
     if (!E_RABAdmittedList) {
1501
         ogs_error("No E_RABAdmittedList");
1502
-        ogs_assert(OGS_OK ==
1503
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1504
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1505
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1506
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1507
+        ogs_expect(r == OGS_OK);
1508
+        ogs_assert(r != OGS_ERROR);
1509
         return;
1510
     }
1511
 
1512
     if (!Target_ToSource_TransparentContainer) {
1513
         ogs_error("No Target_ToSource_TransparentContainer");
1514
-        ogs_assert(OGS_OK ==
1515
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1516
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1517
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1518
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1519
+        ogs_expect(r == OGS_OK);
1520
+        ogs_assert(r != OGS_ERROR);
1521
         return;
1522
     }
1523
 
1524
     source_ue = target_ue->source_ue;
1525
     if (!source_ue) {
1526
         ogs_error("No Source UE");
1527
-        ogs_assert(OGS_OK ==
1528
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1529
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1530
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1531
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1532
+        ogs_expect(r == OGS_OK);
1533
+        ogs_assert(r != OGS_ERROR);
1534
         return;
1535
     }
1536
 
1537
     mme_ue = source_ue->mme_ue;
1538
-    ogs_expect_or_return(mme_ue);
1539
+    if (!mme_ue) {
1540
+        ogs_error("No UE(mme-ue) context");
1541
+        return;
1542
+    }
1543
 
1544
     ogs_debug("    Source : ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d",
1545
             source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
1546
@@ -2395,28 +2543,31 @@
1547
         item = (S1AP_E_RABAdmittedItemIEs_t *)E_RABAdmittedList->list.arrayi;
1548
         if (!item) {
1549
             ogs_error("No S1AP_E_RABAdmittedItemIEs_t");
1550
-            ogs_assert(OGS_OK ==
1551
-                s1ap_send_error_indication2(mme_ue,
1552
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1553
+            r = s1ap_send_error_indication2(mme_ue,
1554
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1555
+            ogs_expect(r == OGS_OK);
1556
+            ogs_assert(r != OGS_ERROR);
1557
             return;
1558
         }
1559
 
1560
         e_rab = &item->value.choice.E_RABAdmittedItem;
1561
         if (!e_rab) {
1562
             ogs_error("No E_RABAdmittedItem");
1563
-            ogs_assert(OGS_OK ==
1564
-                s1ap_send_error_indication2(mme_ue,
1565
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1566
+            r = s1ap_send_error_indication2(mme_ue,
1567
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1568
+            ogs_expect(r == OGS_OK);
1569
+            ogs_assert(r != OGS_ERROR);
1570
             return;
1571
         }
1572
 
1573
         bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
1574
         if (!bearer) {
1575
             ogs_error("No Bearer %d", (int)e_rab->e_RAB_ID);
1576
-            ogs_assert(OGS_OK ==
1577
-                s1ap_send_error_indication2(mme_ue,
1578
+            r = s1ap_send_error_indication2(mme_ue,
1579
                     S1AP_Cause_PR_radioNetwork,
1580
-                    S1AP_CauseRadioNetwork_unknown_E_RAB_ID));
1581
+                    S1AP_CauseRadioNetwork_unknown_E_RAB_ID);
1582
+            ogs_expect(r == OGS_OK);
1583
+            ogs_assert(r != OGS_ERROR);
1584
             return;
1585
         }
1586
 
1587
@@ -2428,10 +2579,11 @@
1588
         if (rv != OGS_OK) {
1589
             ogs_error("No transportLayerAddress %d",
1590
                     (int)e_rab->e_RAB_ID);
1591
-            ogs_assert(OGS_OK ==
1592
-                s1ap_send_error_indication2(mme_ue,
1593
+            r = s1ap_send_error_indication2(mme_ue,
1594
                     S1AP_Cause_PR_protocol,
1595
-                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
1596
+                    S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
1597
+            ogs_expect(r == OGS_OK);
1598
+            ogs_assert(r != OGS_ERROR);
1599
             return;
1600
         }
1601
 
1602
@@ -2446,10 +2598,11 @@
1603
             if (rv != OGS_OK) {
1604
                 ogs_error("No dL_transportLayerAddress %d",
1605
                         (int)e_rab->e_RAB_ID);
1606
-                ogs_assert(OGS_OK ==
1607
-                    s1ap_send_error_indication2(mme_ue,
1608
+                r = s1ap_send_error_indication2(mme_ue,
1609
                         S1AP_Cause_PR_protocol,
1610
-                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
1611
+                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
1612
+                ogs_expect(r == OGS_OK);
1613
+                ogs_assert(r != OGS_ERROR);
1614
                 return;
1615
             }
1616
         }
1617
@@ -2465,10 +2618,11 @@
1618
             if (rv != OGS_OK) {
1619
                 ogs_error("No uL_transportLayerAddress %d",
1620
                         (int)e_rab->e_RAB_ID);
1621
-                ogs_assert(OGS_OK ==
1622
-                    s1ap_send_error_indication2(mme_ue,
1623
+                r = s1ap_send_error_indication2(mme_ue,
1624
                         S1AP_Cause_PR_protocol,
1625
-                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message));
1626
+                        S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message);
1627
+                ogs_expect(r == OGS_OK);
1628
+                ogs_assert(r != OGS_ERROR);
1629
                 return;
1630
             }
1631
         }
1632
@@ -2482,15 +2636,16 @@
1633
             mme_gtp_send_create_indirect_data_forwarding_tunnel_request(mme_ue)\
1634
         );
1635
     } else {
1636
-        ogs_assert(OGS_OK ==
1637
-            s1ap_send_handover_command(source_ue));
1638
+        r = s1ap_send_handover_command(source_ue);
1639
+        ogs_expect(r == OGS_OK);
1640
+        ogs_assert(r != OGS_ERROR);
1641
     }
1642
 }
1643
 
1644
 void s1ap_handle_handover_failure(mme_enb_t *enb, ogs_s1ap_message_t *message)
1645
 {
1646
     char bufOGS_ADDRSTRLEN;
1647
-    int i;
1648
+    int i, r;
1649
 
1650
     S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
1651
     S1AP_HandoverFailure_t *HandoverFailure = NULL;
1652
@@ -2531,9 +2686,10 @@
1653
 
1654
     if (!MME_UE_S1AP_ID) {
1655
         ogs_error("No MME_UE_S1AP_ID");
1656
-        ogs_assert(OGS_OK ==
1657
-            s1ap_send_error_indication(enb, NULL, NULL,
1658
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1659
+        r = s1ap_send_error_indication(enb, NULL, NULL,
1660
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1661
+        ogs_expect(r == OGS_OK);
1662
+        ogs_assert(r != OGS_ERROR);
1663
         return;
1664
     }
1665
 
1666
@@ -2541,27 +2697,30 @@
1667
     if (!target_ue) {
1668
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
1669
                 (long long)*MME_UE_S1AP_ID);
1670
-        ogs_assert(OGS_OK ==
1671
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1672
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1673
                 S1AP_Cause_PR_radioNetwork,
1674
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
1675
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
1676
+        ogs_expect(r == OGS_OK);
1677
+        ogs_assert(r != OGS_ERROR);
1678
         return;
1679
     }
1680
 
1681
     if (!Cause) {
1682
         ogs_error("No Cause");
1683
-        ogs_assert(OGS_OK ==
1684
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1685
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1686
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1687
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1688
+        ogs_expect(r == OGS_OK);
1689
+        ogs_assert(r != OGS_ERROR);
1690
         return;
1691
     }
1692
 
1693
     source_ue = target_ue->source_ue;
1694
     if (!source_ue) {
1695
         ogs_error("No Source UE");
1696
-        ogs_assert(OGS_OK ==
1697
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1698
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1699
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1700
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1701
+        ogs_expect(r == OGS_OK);
1702
+        ogs_assert(r != OGS_ERROR);
1703
         return;
1704
     }
1705
 
1706
@@ -2570,21 +2729,23 @@
1707
     ogs_debug("    Target : ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d",
1708
             target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
1709
 
1710
-    ogs_assert(OGS_OK ==
1711
-        s1ap_send_handover_preparation_failure(
1712
-            source_ue, Cause->present, Cause->choice.radioNetwork));
1713
+    r = s1ap_send_handover_preparation_failure(
1714
+            source_ue, Cause->present, Cause->choice.radioNetwork);
1715
+    ogs_expect(r == OGS_OK);
1716
+    ogs_assert(r != OGS_ERROR);
1717
 
1718
-    ogs_assert(OGS_OK ==
1719
-        s1ap_send_ue_context_release_command(
1720
+    r = s1ap_send_ue_context_release_command(
1721
         target_ue, S1AP_Cause_PR_radioNetwork,
1722
         S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system,
1723
-        S1AP_UE_CTX_REL_S1_HANDOVER_FAILURE, 0));
1724
+        S1AP_UE_CTX_REL_S1_HANDOVER_FAILURE, 0);
1725
+    ogs_expect(r == OGS_OK);
1726
+    ogs_assert(r != OGS_ERROR);
1727
 }
1728
 
1729
 void s1ap_handle_handover_cancel(mme_enb_t *enb, ogs_s1ap_message_t *message)
1730
 {
1731
     char bufOGS_ADDRSTRLEN;
1732
-    int i;
1733
+    int i, r;
1734
 
1735
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
1736
     S1AP_HandoverCancel_t *HandoverCancel = NULL;
1737
@@ -2629,9 +2790,10 @@
1738
 
1739
     if (!MME_UE_S1AP_ID) {
1740
         ogs_error("No MME_UE_S1AP_ID");
1741
-        ogs_assert(OGS_OK ==
1742
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1743
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1744
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1745
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1746
+        ogs_expect(r == OGS_OK);
1747
+        ogs_assert(r != OGS_ERROR);
1748
         return;
1749
     }
1750
 
1751
@@ -2639,35 +2801,39 @@
1752
     if (!source_ue) {
1753
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
1754
                 (long long)*MME_UE_S1AP_ID);
1755
-        ogs_assert(OGS_OK ==
1756
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1757
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1758
                 S1AP_Cause_PR_radioNetwork,
1759
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
1760
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
1761
+        ogs_expect(r == OGS_OK);
1762
+        ogs_assert(r != OGS_ERROR);
1763
         return;
1764
     }
1765
 
1766
     if (!ENB_UE_S1AP_ID) {
1767
         ogs_error("No ENB_UE_S1AP_ID");
1768
-        ogs_assert(OGS_OK ==
1769
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1770
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1771
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1772
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1773
+        ogs_expect(r == OGS_OK);
1774
+        ogs_assert(r != OGS_ERROR);
1775
         return;
1776
     }
1777
 
1778
     if (!Cause) {
1779
         ogs_error("No Cause");
1780
-        ogs_assert(OGS_OK ==
1781
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1782
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1783
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1784
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1785
+        ogs_expect(r == OGS_OK);
1786
+        ogs_assert(r != OGS_ERROR);
1787
         return;
1788
     }
1789
 
1790
     target_ue = source_ue->target_ue;
1791
     if (!target_ue) {
1792
         ogs_error("No Target UE");
1793
-        ogs_assert(OGS_OK ==
1794
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1795
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1796
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1797
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1798
+        ogs_expect(r == OGS_OK);
1799
+        ogs_assert(r != OGS_ERROR);
1800
         return;
1801
     }
1802
 
1803
@@ -2676,11 +2842,12 @@
1804
     ogs_debug("    Target : ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d",
1805
             target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
1806
 
1807
-    ogs_assert(OGS_OK ==
1808
-        s1ap_send_ue_context_release_command(
1809
+    r = s1ap_send_ue_context_release_command(
1810
             target_ue, S1AP_Cause_PR_radioNetwork,
1811
             S1AP_CauseRadioNetwork_handover_cancelled,
1812
-            S1AP_UE_CTX_REL_S1_HANDOVER_CANCEL, 0));
1813
+            S1AP_UE_CTX_REL_S1_HANDOVER_CANCEL, 0);
1814
+    ogs_expect(r == OGS_OK);
1815
+    ogs_assert(r != OGS_ERROR);
1816
 
1817
     ogs_debug("Handover Cancel : UEeNB-UE-S1AP-ID(%d) --> eNB%s:%d",
1818
             source_ue->enb_ue_s1ap_id,
1819
@@ -2691,7 +2858,7 @@
1820
         mme_enb_t *enb, ogs_s1ap_message_t *message)
1821
 {
1822
     char bufOGS_ADDRSTRLEN;
1823
-    int i;
1824
+    int i, r;
1825
 
1826
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
1827
     S1AP_ENBStatusTransfer_t *ENBStatusTransfer = NULL;
1828
@@ -2736,9 +2903,10 @@
1829
 
1830
     if (!MME_UE_S1AP_ID) {
1831
         ogs_error("No MME_UE_S1AP_ID");
1832
-        ogs_assert(OGS_OK ==
1833
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1834
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1835
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1836
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1837
+        ogs_expect(r == OGS_OK);
1838
+        ogs_assert(r != OGS_ERROR);
1839
         return;
1840
     }
1841
 
1842
@@ -2746,35 +2914,39 @@
1843
     if (!source_ue) {
1844
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
1845
                 (long long)*MME_UE_S1AP_ID);
1846
-        ogs_assert(OGS_OK ==
1847
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1848
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1849
                 S1AP_Cause_PR_radioNetwork,
1850
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
1851
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
1852
+        ogs_expect(r == OGS_OK);
1853
+        ogs_assert(r != OGS_ERROR);
1854
         return;
1855
     }
1856
 
1857
     if (!ENB_UE_S1AP_ID) {
1858
         ogs_error("No ENB_UE_S1AP_ID");
1859
-        ogs_assert(OGS_OK ==
1860
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1861
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1862
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1863
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1864
+        ogs_expect(r == OGS_OK);
1865
+        ogs_assert(r != OGS_ERROR);
1866
         return;
1867
     }
1868
 
1869
     if (!ENB_StatusTransfer_TransparentContainer) {
1870
         ogs_error("No ENB_StatusTransfer_TransparentContainer");
1871
-        ogs_assert(OGS_OK ==
1872
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1873
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1874
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1875
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1876
+        ogs_expect(r == OGS_OK);
1877
+        ogs_assert(r != OGS_ERROR);
1878
         return;
1879
     }
1880
 
1881
     target_ue = source_ue->target_ue;
1882
     if (!target_ue) {
1883
         ogs_error("No Target UE");
1884
-        ogs_assert(OGS_OK ==
1885
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1886
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1887
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1888
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1889
+        ogs_expect(r == OGS_OK);
1890
+        ogs_assert(r != OGS_ERROR);
1891
         return;
1892
     }
1893
 
1894
@@ -2783,16 +2955,17 @@
1895
     ogs_debug("    Target : ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d",
1896
             target_ue->enb_ue_s1ap_id, target_ue->mme_ue_s1ap_id);
1897
 
1898
-    ogs_assert(OGS_OK ==
1899
-        s1ap_send_mme_status_transfer(target_ue,
1900
-            ENB_StatusTransfer_TransparentContainer));
1901
+    r = s1ap_send_mme_status_transfer(target_ue,
1902
+            ENB_StatusTransfer_TransparentContainer);
1903
+    ogs_expect(r == OGS_OK);
1904
+    ogs_assert(r != OGS_ERROR);
1905
 }
1906
 
1907
 void s1ap_handle_handover_notification(
1908
         mme_enb_t *enb, ogs_s1ap_message_t *message)
1909
 {
1910
     char bufOGS_ADDRSTRLEN;
1911
-    int i;
1912
+    int i, r;
1913
 
1914
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
1915
     S1AP_HandoverNotify_t *HandoverNotify = NULL;
1916
@@ -2847,9 +3020,10 @@
1917
 
1918
     if (!MME_UE_S1AP_ID) {
1919
         ogs_error("No MME_UE_S1AP_ID");
1920
-        ogs_assert(OGS_OK ==
1921
-            s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1922
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1923
+        r = s1ap_send_error_indication(enb, NULL, ENB_UE_S1AP_ID,
1924
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1925
+        ogs_expect(r == OGS_OK);
1926
+        ogs_assert(r != OGS_ERROR);
1927
         return;
1928
     }
1929
 
1930
@@ -2857,26 +3031,29 @@
1931
     if (!target_ue) {
1932
         ogs_error("No eNB UE Context : MME_UE_S1AP_ID%lld",
1933
                 (long long)*MME_UE_S1AP_ID);
1934
-        ogs_assert(OGS_OK ==
1935
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1936
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, NULL,
1937
                 S1AP_Cause_PR_radioNetwork,
1938
-                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id));
1939
+                S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
1940
+        ogs_expect(r == OGS_OK);
1941
+        ogs_assert(r != OGS_ERROR);
1942
         return;
1943
     }
1944
 
1945
     if (!ENB_UE_S1AP_ID) {
1946
         ogs_error("No ENB_UE_S1AP_ID");
1947
-        ogs_assert(OGS_OK ==
1948
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1949
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1950
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1951
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1952
+        ogs_expect(r == OGS_OK);
1953
+        ogs_assert(r != OGS_ERROR);
1954
         return;
1955
     }
1956
 
1957
     if (!EUTRAN_CGI) {
1958
         ogs_error("No EUTRAN_CGI");
1959
-        ogs_assert(OGS_OK ==
1960
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1961
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1962
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1963
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1964
+        ogs_expect(r == OGS_OK);
1965
+        ogs_assert(r != OGS_ERROR);
1966
         return;
1967
     }
1968
 
1969
@@ -2887,9 +3064,10 @@
1970
 
1971
     if (!TAI) {
1972
         ogs_error("No TAI");
1973
-        ogs_assert(OGS_OK ==
1974
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1975
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1976
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1977
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1978
+        ogs_expect(r == OGS_OK);
1979
+        ogs_assert(r != OGS_ERROR);
1980
         return;
1981
     }
1982
 
1983
@@ -2901,14 +3079,18 @@
1984
     source_ue = target_ue->source_ue;
1985
     if (!source_ue) {
1986
         ogs_error("No Source UE");
1987
-        ogs_assert(OGS_OK ==
1988
-            s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1989
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
1990
+        r = s1ap_send_error_indication(enb, MME_UE_S1AP_ID, ENB_UE_S1AP_ID,
1991
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
1992
+        ogs_expect(r == OGS_OK);
1993
+        ogs_assert(r != OGS_ERROR);
1994
         return;
1995
     }
1996
 
1997
     mme_ue = source_ue->mme_ue;
1998
-    ogs_expect_or_return(mme_ue);
1999
+    if (!mme_ue) {
2000
+        ogs_error("No UE(mme-ue) context");
2001
+        return;
2002
+    }
2003
 
2004
     ogs_debug("    Source : ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d",
2005
             source_ue->enb_ue_s1ap_id, source_ue->mme_ue_s1ap_id);
2006
@@ -2949,12 +3131,13 @@
2007
     memcpy(&mme_ue->e_cgi, &target_ue->saved.e_cgi, sizeof(ogs_e_cgi_t));
2008
     mme_ue->ue_location_timestamp = ogs_time_now();
2009
 
2010
-    ogs_assert(OGS_OK ==
2011
-        s1ap_send_ue_context_release_command(source_ue,
2012
+    r = s1ap_send_ue_context_release_command(source_ue,
2013
             S1AP_Cause_PR_radioNetwork,
2014
             S1AP_CauseRadioNetwork_successful_handover,
2015
             S1AP_UE_CTX_REL_S1_HANDOVER_COMPLETE,
2016
-            ogs_app()->time.handover.duration));
2017
+            ogs_app()->time.handover.duration);
2018
+    ogs_expect(r == OGS_OK);
2019
+    ogs_assert(r != OGS_ERROR);
2020
 
2021
     ogs_list_init(&mme_ue->bearer_to_modify_list);
2022
 
2023
@@ -2979,7 +3162,7 @@
2024
         mme_enb_t *enb, ogs_s1ap_message_t *message)
2025
 {
2026
     char bufOGS_ADDRSTRLEN;
2027
-    int i;
2028
+    int i, r;
2029
 
2030
     S1AP_InitiatingMessage_t *initiatingMessage = NULL;
2031
     S1AP_Reset_t *Reset = NULL;
2032
@@ -3021,9 +3204,10 @@
2033
 
2034
     if (!Cause) {
2035
         ogs_error("No Cause");
2036
-        ogs_assert(OGS_OK ==
2037
-            s1ap_send_error_indication(enb, NULL, NULL,
2038
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
2039
+        r = s1ap_send_error_indication(enb, NULL, NULL,
2040
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
2041
+        ogs_expect(r == OGS_OK);
2042
+        ogs_assert(r != OGS_ERROR);
2043
         return;
2044
     }
2045
 
2046
@@ -3032,9 +3216,10 @@
2047
 
2048
     if (!ResetType) {
2049
         ogs_error("No ResetType");
2050
-        ogs_assert(OGS_OK ==
2051
-            s1ap_send_error_indication(enb, NULL, NULL,
2052
-                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error));
2053
+        r = s1ap_send_error_indication(enb, NULL, NULL,
2054
+                S1AP_Cause_PR_protocol, S1AP_CauseProtocol_semantic_error);
2055
+        ogs_expect(r == OGS_OK);
2056
+        ogs_assert(r != OGS_ERROR);
2057
         return;
2058
     }
2059
 
2060
@@ -3058,9 +3243,11 @@
2061
          * for new UE-associated logical S1-connections over the S1 interface,
2062
          * the MME shall respond with the RESET ACKNOWLEDGE message.
2063
          */
2064
-        if (ogs_list_count(&enb->enb_ue_list) == 0)
2065
-            ogs_assert(OGS_OK ==
2066
-                s1ap_send_s1_reset_ack(enb, NULL));
2067
+        if (ogs_list_count(&enb->enb_ue_list) == 0) {
2068
+            r = s1ap_send_s1_reset_ack(enb, NULL);
2069
+            ogs_expect(r == OGS_OK);
2070
+            ogs_assert(r != OGS_ERROR);
2071
+        }
2072
 
2073
         break;
2074
 
2075
@@ -3074,7 +3261,10 @@
2076
             ogs_pkbuf_free(enb->s1_reset_ack);
2077
 
2078
         enb->s1_reset_ack = ogs_s1ap_build_s1_reset_ack(partOfS1_Interface);
2079
-        ogs_expect_or_return(enb->s1_reset_ack);
2080
+        if (!enb->s1_reset_ack) {
2081
+            ogs_error("ogs_s1ap_build_s1_reset_ack() failed");
2082
+            return;
2083
+        }
2084
 
2085
         for (i = 0; i < partOfS1_Interface->list.count; i++) {
2086
             S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie2 = NULL;
2087
@@ -3153,7 +3343,9 @@
2088
          * where PartOfS1_interface was requested
2089
          * REMOVED */
2090
         ogs_assert(enb->s1_reset_ack);
2091
-        s1ap_send_to_enb(enb, enb->s1_reset_ack, S1AP_NON_UE_SIGNALLING);
2092
+        r = s1ap_send_to_enb(enb, enb->s1_reset_ack, S1AP_NON_UE_SIGNALLING);
2093
+        ogs_expect(r == OGS_OK);
2094
+        ogs_assert(r != OGS_ERROR);
2095
 
2096
         /* Clear S1-Reset Ack Buffer */
2097
         enb->s1_reset_ack = NULL;
2098
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/s1ap-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/s1ap-path.c Changed
324
 
1
@@ -55,16 +55,16 @@
2
 
3
     enb = mme_enb_cycle(enb);
4
     if (!enb) {
5
-        ogs_warn("eNB has already been removed");
6
+        ogs_error("eNB has already been removed");
7
         ogs_pkbuf_free(pkbuf);
8
-        return OGS_ERROR;
9
+        return OGS_NOTFOUND;
10
     }
11
 
12
     ogs_assert(enb->sctp.sock);
13
     if (enb->sctp.sock->fd == INVALID_SOCKET) {
14
         ogs_fatal("eNB SCTP socket has already been destroyed");
15
         ogs_log_hexdump(OGS_LOG_FATAL, pkbuf->data, pkbuf->len);
16
-        ogs_assert_if_reached();
17
+        ogs_pkbuf_free(pkbuf);
18
         return OGS_ERROR;
19
     }
20
 
21
@@ -84,16 +84,20 @@
22
 
23
 int s1ap_send_to_enb_ue(enb_ue_t *enb_ue, ogs_pkbuf_t *pkbuf)
24
 {
25
+    int rv;
26
     ogs_assert(pkbuf);
27
 
28
     enb_ue = enb_ue_cycle(enb_ue);
29
     if (!enb_ue) {
30
-        ogs_warn("S1 context has already been removed");
31
+        ogs_error("S1 context has already been removed");
32
         ogs_pkbuf_free(pkbuf);
33
-        return OGS_ERROR;
34
+        return OGS_NOTFOUND;
35
     }
36
 
37
-    return s1ap_send_to_enb(enb_ue->enb, pkbuf, enb_ue->enb_ostream_id);
38
+    rv = s1ap_send_to_enb(enb_ue->enb, pkbuf, enb_ue->enb_ostream_id);
39
+    ogs_expect(rv == OGS_OK);
40
+
41
+    return rv;
42
 }
43
 
44
 int s1ap_delayed_send_to_enb_ue(
45
@@ -118,10 +122,10 @@
46
 
47
         return OGS_OK;
48
     } else {
49
-        mme_enb_t *enb = NULL;
50
-        enb = enb_ue->enb;
51
-        ogs_assert(enb);
52
-        return s1ap_send_to_enb_ue(enb_ue, pkbuf);
53
+        int rv = s1ap_send_to_enb_ue(enb_ue, pkbuf);
54
+        ogs_expect(rv == OGS_OK);
55
+
56
+        return rv;
57
     }
58
 }
59
 
60
@@ -154,6 +158,7 @@
61
 int s1ap_send_to_nas(enb_ue_t *enb_ue,
62
         S1AP_ProcedureCode_t procedureCode, S1AP_NAS_PDU_t *nasPdu)
63
 {
64
+    int rv;
65
     ogs_nas_eps_security_header_t *sh = NULL;
66
     ogs_nas_security_header_type_t security_header_type;
67
 
68
@@ -244,9 +249,11 @@
69
             ogs_pkbuf_free(nasbuf);
70
             return OGS_ERROR;
71
         }
72
-        return s1ap_send_to_esm(
73
+        rv = s1ap_send_to_esm(
74
                 mme_ue, nasbuf, security_header_type.type,
75
                 OGS_GTP_CREATE_IN_UPLINK_NAS_TRANSPORT);
76
+        ogs_expect(rv == OGS_OK);
77
+        return rv;
78
     } else {
79
         ogs_error("Unknown/Unimplemented NAS Protocol discriminator 0x%02x",
80
                   h->protocol_discriminator);
81
@@ -262,7 +269,10 @@
82
 
83
     ogs_debug("S1-Setup response");
84
     s1ap_buffer = s1ap_build_setup_rsp();
85
-    ogs_expect_or_return_val(s1ap_buffer, OGS_ERROR);
86
+    if (!s1ap_buffer) {
87
+        ogs_error("s1ap_build_setup_rsp() failed");
88
+        return OGS_ERROR;
89
+    }
90
 
91
     rv = s1ap_send_to_enb(enb, s1ap_buffer, S1AP_NON_UE_SIGNALLING);
92
     ogs_expect(rv == OGS_OK);
93
@@ -278,7 +288,10 @@
94
 
95
     ogs_debug("S1-Setup failure");
96
     s1ap_buffer = s1ap_build_setup_failure(group, cause, S1AP_TimeToWait_v10s);
97
-    ogs_expect_or_return_val(s1ap_buffer, OGS_ERROR);
98
+    if (!s1ap_buffer) {
99
+        ogs_error("s1ap_build_setup_failure() failed");
100
+        return OGS_ERROR;
101
+    }
102
 
103
     rv = s1ap_send_to_enb(enb, s1ap_buffer, S1AP_NON_UE_SIGNALLING);
104
     ogs_expect(rv == OGS_OK);
105
@@ -295,7 +308,10 @@
106
 
107
     ogs_debug("InitialContextSetupRequest");
108
     s1apbuf = s1ap_build_initial_context_setup_request(mme_ue, NULL);
109
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
110
+    if (!s1apbuf) {
111
+        ogs_error("s1ap_build_initial_context_setup_request() failed");
112
+        return OGS_ERROR;
113
+    }
114
 
115
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
116
     ogs_expect(rv == OGS_OK);
117
@@ -312,7 +328,10 @@
118
 
119
     ogs_debug("UEContextModificationRequest");
120
     s1apbuf = s1ap_build_ue_context_modification_request(mme_ue);
121
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
122
+    if (!s1apbuf) {
123
+        ogs_error("s1ap_build_ue_context_modification_request() failed");
124
+        return OGS_ERROR;
125
+    }
126
 
127
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
128
     ogs_expect(rv == OGS_OK);
129
@@ -340,7 +359,10 @@
130
             group, (int)cause, action, (int)duration);
131
 
132
     s1apbuf = s1ap_build_ue_context_release_command(enb_ue, group, cause);
133
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
134
+    if (!s1apbuf) {
135
+        ogs_error("s1ap_build_ue_context_release_command() failed");
136
+        return OGS_ERROR;
137
+    }
138
 
139
     rv = s1ap_delayed_send_to_enb_ue(enb_ue, s1apbuf, duration);
140
     ogs_expect(rv == OGS_OK);
141
@@ -369,14 +391,23 @@
142
                     s1apbuf = mme_ue->t3413.pkbuf;
143
                 } else {
144
                     s1apbuf = s1ap_build_paging(mme_ue, cn_domain);
145
-                    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
146
+                    if (!s1apbuf) {
147
+                        ogs_error("s1ap_build_paging() failed");
148
+                        return OGS_ERROR;
149
+                    }
150
                 }
151
 
152
                 mme_ue->t3413.pkbuf = ogs_pkbuf_copy(s1apbuf);
153
-                ogs_expect_or_return_val(mme_ue->t3413.pkbuf, OGS_ERROR);
154
+                if (!mme_ue->t3413.pkbuf) {
155
+                    ogs_error("ogs_pkbuf_copy() failed");
156
+                    return OGS_ERROR;
157
+                }
158
 
159
                 rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
160
-                ogs_expect_or_return_val(rv == OGS_OK, rv);
161
+                if (rv != OGS_OK) {
162
+                    ogs_error("s1ap_send_to_enb() failed");
163
+                    return rv;
164
+                }
165
             }
166
         }
167
     }
168
@@ -400,7 +431,10 @@
169
 
170
     ogs_debug("MMEConfigurationTransfer");
171
     s1apbuf = s1ap_build_mme_configuration_transfer(SONConfigurationTransfer);
172
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
173
+    if (!s1apbuf) {
174
+        ogs_error("s1ap_build_mme_configuration_transfer() failed");
175
+        return OGS_ERROR;
176
+    }
177
 
178
     rv = s1ap_send_to_enb(target_enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
179
     ogs_expect(rv == OGS_OK);
180
@@ -417,7 +451,10 @@
181
 
182
     ogs_debug("E-RABModificationConfirm");
183
     s1apbuf = s1ap_build_e_rab_modification_confirm(mme_ue);
184
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
185
+    if (!s1apbuf) {
186
+        ogs_error("s1ap_build_e_rab_modification_confirm() failed");
187
+        return OGS_ERROR;
188
+    }
189
 
190
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
191
     ogs_expect(rv == OGS_OK);
192
@@ -436,7 +473,10 @@
193
     ogs_debug("PathSwitchAcknowledge");
194
     s1apbuf = s1ap_build_path_switch_ack(
195
                 mme_ue, e_rab_to_switched_in_uplink_list);
196
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
197
+    if (!s1apbuf) {
198
+        ogs_error("s1ap_build_path_switch_ack() failed");
199
+        return OGS_ERROR;
200
+    }
201
 
202
     rv = nas_eps_send_to_enb(mme_ue, s1apbuf);
203
     ogs_expect(rv == OGS_OK);
204
@@ -453,7 +493,10 @@
205
 
206
     ogs_debug("HandoverCommand");
207
     s1apbuf = s1ap_build_handover_command(source_ue);
208
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
209
+    if (!s1apbuf) {
210
+        ogs_error("s1ap_build_handover_command() failed");
211
+        return OGS_ERROR;
212
+    }
213
 
214
     rv = s1ap_send_to_enb_ue(source_ue, s1apbuf);
215
     ogs_expect(rv == OGS_OK);
216
@@ -472,7 +515,10 @@
217
 
218
     ogs_debug("HandoverPreparationFailure");
219
     s1apbuf = s1ap_build_handover_preparation_failure(source_ue, group, cause);
220
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
221
+    if (!s1apbuf) {
222
+        ogs_error("s1ap_build_handover_preparation_failure() failed");
223
+        return OGS_ERROR;
224
+    }
225
 
226
     rv = s1ap_send_to_enb_ue(source_ue, s1apbuf);
227
     ogs_expect(rv == OGS_OK);
228
@@ -489,7 +535,10 @@
229
 
230
     ogs_debug("HandoverCancelAcknowledge");
231
     s1apbuf = s1ap_build_handover_cancel_ack(source_ue);
232
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
233
+    if (!s1apbuf) {
234
+        ogs_error("s1ap_build_handover_cancel_ack() failed");
235
+        return OGS_ERROR;
236
+    }
237
 
238
     rv = s1ap_send_to_enb_ue(source_ue, s1apbuf);
239
     ogs_expect(rv == OGS_OK);
240
@@ -516,11 +565,12 @@
241
 
242
     target_ue = enb_ue_add(target_enb, INVALID_UE_S1AP_ID);
243
     if (target_ue == NULL) {
244
-        ogs_assert(OGS_OK ==
245
-            s1ap_send_error_indication(target_enb, NULL, NULL,
246
+        rv = s1ap_send_error_indication(target_enb, NULL, NULL,
247
                 S1AP_Cause_PR_misc,
248
-                S1AP_CauseMisc_control_processing_overload));
249
-        return OGS_ERROR;
250
+                S1AP_CauseMisc_control_processing_overload);
251
+        ogs_expect(rv == OGS_OK);
252
+
253
+        return rv;
254
     }
255
 
256
     ogs_info("    Source : ENB_UE_S1AP_ID%d MME_UE_S1AP_ID%d",
257
@@ -533,7 +583,10 @@
258
     s1apbuf = s1ap_build_handover_request(
259
             target_ue, handovertype, cause,
260
             source_totarget_transparentContainer);
261
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
262
+    if (!s1apbuf) {
263
+        ogs_error("s1ap_build_handover_request() failed");
264
+        return OGS_ERROR;
265
+    }
266
 
267
     rv = s1ap_send_to_enb_ue(target_ue, s1apbuf);
268
     ogs_expect(rv == OGS_OK);
269
@@ -554,7 +607,10 @@
270
     ogs_info("MMEStatusTransfer");
271
     s1apbuf = s1ap_build_mme_status_transfer(target_ue,
272
             enb_statustransfer_transparentContainer);
273
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
274
+    if (!s1apbuf) {
275
+        ogs_error("s1ap_build_mme_status_transfer() failed");
276
+        return OGS_ERROR;
277
+    }
278
 
279
     rv = s1ap_send_to_enb_ue(target_ue, s1apbuf);
280
     ogs_expect(rv == OGS_OK);
281
@@ -576,7 +632,10 @@
282
     ogs_info("ErrorIndication");
283
     s1apbuf = ogs_s1ap_build_error_indication(
284
             mme_ue_s1ap_id, enb_ue_s1ap_id, group, cause);
285
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
286
+    if (!s1apbuf) {
287
+        ogs_error("ogs_s1ap_build_error_indication() failed");
288
+        return OGS_ERROR;
289
+    }
290
 
291
     rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
292
     ogs_expect(rv == OGS_OK);
293
@@ -596,9 +655,15 @@
294
 
295
     ogs_assert(mme_ue);
296
     enb_ue = enb_ue_cycle(mme_ue->enb_ue);
297
-    ogs_expect_or_return_val(enb_ue, OGS_ERROR);
298
-    enb = enb_ue->enb;
299
-    ogs_expect_or_return_val(enb, OGS_ERROR);
300
+    if (!enb_ue) {
301
+        ogs_error("S1 context has already been removed");
302
+        return OGS_NOTFOUND;
303
+    }
304
+    enb = mme_enb_cycle(enb_ue->enb);
305
+    if (!enb) {
306
+        ogs_error("eNB has already been removed");
307
+        return OGS_NOTFOUND;
308
+    }
309
 
310
     mme_ue_s1ap_id = enb_ue->mme_ue_s1ap_id,
311
     enb_ue_s1ap_id = enb_ue->enb_ue_s1ap_id,
312
@@ -621,7 +686,10 @@
313
 
314
     ogs_info("S1-Reset Acknowledge");
315
     s1apbuf = ogs_s1ap_build_s1_reset_ack(partOfS1_Interface);
316
-    ogs_expect_or_return_val(s1apbuf, OGS_ERROR);
317
+    if (!s1apbuf) {
318
+        ogs_error("ogs_s1ap_build_s1_reset_ack() failed");
319
+        return OGS_ERROR;
320
+    }
321
 
322
     rv = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
323
     ogs_expect(rv == OGS_OK);
324
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/sbc-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/sbc-handler.c Changed
57
 
1
@@ -26,7 +26,7 @@
2
 {
3
     ogs_pkbuf_t *s1apbuf = NULL;
4
     mme_enb_t *enb = NULL;
5
-    int i, j, flag;
6
+    int i, j, flag, r;
7
 
8
     /* Find enB with matched TAI */
9
     ogs_list_for_each(&mme_self()->enb_list, enb) {
10
@@ -48,11 +48,15 @@
11
         if (flag) {
12
             /* Build S1AP Write Replace Warning Request message */
13
             s1apbuf = s1ap_build_write_replace_warning_request(sbc_pws);
14
-            ogs_expect_or_return(s1apbuf);
15
+            if (!s1apbuf) {
16
+                ogs_error("s1ap_build_kill_request() failed");
17
+                return;
18
+            }
19
 
20
             /* Send to enb */
21
-            ogs_expect(s1ap_send_to_enb(
22
-                    enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK);
23
+            r = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
24
+            ogs_expect(r == OGS_OK);
25
+            ogs_assert(r != OGS_ERROR);
26
         }
27
     }
28
 }
29
@@ -61,7 +65,7 @@
30
 {
31
     ogs_pkbuf_t *s1apbuf = NULL;
32
     mme_enb_t *enb = NULL;
33
-    int i, j, flag;
34
+    int i, j, flag, r;
35
 
36
     /* Find enB with matched TAI */
37
     ogs_list_for_each(&mme_self()->enb_list, enb) {
38
@@ -83,11 +87,15 @@
39
         if (flag) {
40
             /* Build S1AP Kill request message */
41
             s1apbuf = s1ap_build_kill_request(sbc_pws);
42
-            ogs_expect_or_return(s1apbuf);
43
+            if (!s1apbuf) {
44
+                ogs_error("s1ap_build_kill_request() failed");
45
+                return;
46
+            }
47
 
48
             /* Send to enb */
49
-            ogs_expect(s1ap_send_to_enb(
50
-                    enb, s1apbuf, S1AP_NON_UE_SIGNALLING) == OGS_OK);
51
+            r = s1ap_send_to_enb(enb, s1apbuf, S1AP_NON_UE_SIGNALLING);
52
+            ogs_expect(r == OGS_OK);
53
+            ogs_assert(r != OGS_ERROR);
54
         }
55
     }
56
 }
57
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/sgsap-handler.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/sgsap-handler.c Changed
115
 
1
@@ -30,6 +30,7 @@
2
 
3
 void sgsap_handle_location_update_accept(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
4
 {
5
+    int r;
6
     ogs_tlv_t *root = NULL, *iter = NULL;
7
     mme_ue_t *mme_ue = NULL;
8
 
9
@@ -116,21 +117,24 @@
10
         ogs_debug("    P-TMSI0x%08x", mme_ue->p_tmsi);
11
     }
12
 
13
-    ogs_assert(OGS_OK ==
14
-        nas_eps_send_attach_accept(mme_ue));
15
+    r = nas_eps_send_attach_accept(mme_ue);
16
+    ogs_expect(r == OGS_OK);
17
+    ogs_assert(r != OGS_ERROR);
18
 
19
     return;
20
 
21
 error:
22
-    ogs_assert(OGS_OK ==
23
-        nas_eps_send_attach_reject(mme_ue,
24
+    r = nas_eps_send_attach_reject(mme_ue,
25
             OGS_NAS_EMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED,
26
-            OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
27
+            OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
28
+    ogs_expect(r == OGS_OK);
29
+    ogs_assert(r != OGS_ERROR);
30
     mme_send_delete_session_or_mme_ue_context_release(mme_ue);
31
 }
32
 
33
 void sgsap_handle_location_update_reject(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
34
 {
35
+    int r;
36
     ogs_tlv_t *root = NULL, *iter = NULL;
37
     mme_ue_t *mme_ue = NULL;
38
 
39
@@ -203,9 +207,10 @@
40
                     ogs_plmn_id_hexdump(&lai->nas_plmn_id), lai->lac);
41
     }
42
 
43
-    ogs_assert(OGS_OK ==
44
-        nas_eps_send_attach_reject(mme_ue,
45
-            emm_cause, OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED));
46
+    r = nas_eps_send_attach_reject(mme_ue,
47
+            emm_cause, OGS_NAS_ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
48
+    ogs_expect(r == OGS_OK);
49
+    ogs_assert(r != OGS_ERROR);
50
     mme_send_delete_session_or_mme_ue_context_release(mme_ue);
51
 
52
     return;
53
@@ -277,6 +282,7 @@
54
 
55
 void sgsap_handle_paging_request(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
56
 {
57
+    int r;
58
     ogs_tlv_t *root = NULL, *iter = NULL;
59
     mme_ue_t *mme_ue = NULL;
60
 
61
@@ -354,22 +360,25 @@
62
                 /* UE will respond Extended Service Request in PS CNDomain*/
63
                 MME_STORE_PAGING_INFO(mme_ue,
64
                         MME_PAGING_TYPE_CS_CALL_SERVICE, NULL);
65
-                ogs_assert(OGS_OK ==
66
-                    s1ap_send_paging(mme_ue, S1AP_CNDomain_cs));
67
+                r = s1ap_send_paging(mme_ue, S1AP_CNDomain_cs);
68
+                ogs_expect(r == OGS_OK);
69
+                ogs_assert(r != OGS_ERROR);
70
 
71
             } else if (SMS_SERVICE_INDICATOR(mme_ue)) {
72
                 /* UE will respond Service Request in PS CNDomain*/
73
                 MME_STORE_PAGING_INFO(mme_ue,
74
                         MME_PAGING_TYPE_SMS_SERVICE, NULL);
75
-                ogs_assert(OGS_OK ==
76
-                    s1ap_send_paging(mme_ue, S1AP_CNDomain_ps));
77
+                r = s1ap_send_paging(mme_ue, S1AP_CNDomain_ps);
78
+                ogs_expect(r == OGS_OK);
79
+                ogs_assert(r != OGS_ERROR);
80
             } else
81
                 goto paging_reject;
82
 
83
         } else {
84
             if (CS_CALL_SERVICE_INDICATOR(mme_ue)) {
85
-                ogs_assert(OGS_OK ==
86
-                    nas_eps_send_cs_service_notification(mme_ue));
87
+                r = nas_eps_send_cs_service_notification(mme_ue);
88
+                ogs_expect(r == OGS_OK);
89
+                ogs_assert(r != OGS_ERROR);
90
             } else if (SMS_SERVICE_INDICATOR(mme_ue)) {
91
                 ogs_assert(OGS_OK ==
92
                     sgsap_send_service_request(
93
@@ -395,6 +404,7 @@
94
 
95
 void sgsap_handle_downlink_unitdata(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
96
 {
97
+    int r;
98
     ogs_tlv_t *root = NULL, *iter = NULL;
99
     mme_ue_t *mme_ue = NULL;
100
 
101
@@ -455,9 +465,10 @@
102
             nas_message_container_buffer,
103
             nas_message_container_length);
104
 
105
-    ogs_assert(OGS_OK ==
106
-        nas_eps_send_downlink_nas_transport(mme_ue,
107
-            nas_message_container_buffer, nas_message_container_length));
108
+    r = nas_eps_send_downlink_nas_transport(mme_ue,
109
+            nas_message_container_buffer, nas_message_container_length);
110
+    ogs_expect(r == OGS_OK);
111
+    ogs_assert(r != OGS_ERROR);
112
 }
113
 
114
 void sgsap_handle_reset_indication(mme_vlr_t *vlr, ogs_pkbuf_t *pkbuf)
115
open5gs_2.5.5.100.a8f8.tar.xz/src/mme/sgsap-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/mme/sgsap-path.c Changed
109
 
1
@@ -120,7 +120,10 @@
2
     ogs_debug("    IMSI%s", mme_ue->imsi_bcd);
3
 
4
     pkbuf = sgsap_build_location_update_request(mme_ue);
5
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
6
+    if (!pkbuf) {
7
+        ogs_error("sgsap_build_location_update_request() failed");
8
+        return OGS_ERROR;
9
+    }
10
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
11
     ogs_expect(rv == OGS_OK);
12
 
13
@@ -137,7 +140,10 @@
14
     ogs_debug("    IMSI%s", mme_ue->imsi_bcd);
15
 
16
     pkbuf = sgsap_build_tmsi_reallocation_complete(mme_ue);
17
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
18
+    if (!pkbuf) {
19
+        ogs_error("sgsap_build_tmsi_reallocation_complete() failed");
20
+        return OGS_ERROR;
21
+    }
22
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
23
     ogs_expect(rv == OGS_OK);
24
 
25
@@ -151,7 +157,10 @@
26
     ogs_assert(mme_ue);
27
 
28
     pkbuf = sgsap_build_detach_indication(mme_ue);
29
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
30
+    if (!pkbuf) {
31
+        ogs_error("sgsap_build_detach_indication() failed");
32
+        return OGS_ERROR;
33
+    }
34
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
35
     ogs_expect(rv == OGS_OK);
36
 
37
@@ -168,7 +177,10 @@
38
     ogs_debug("    IMSI%s", mme_ue->imsi_bcd);
39
 
40
     pkbuf = sgsap_build_mo_csfb_indication(mme_ue);
41
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
42
+    if (!pkbuf) {
43
+        ogs_error("sgsap_build_mo_csfb_indication() failed");
44
+        return OGS_ERROR;
45
+    }
46
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
47
     ogs_expect(rv == OGS_OK);
48
 
49
@@ -187,7 +199,10 @@
50
     pkbuf = sgsap_build_paging_reject(
51
                 &mme_ue->nas_mobile_identity_imsi,
52
                 SGSAP_IE_IMSI_LEN, sgs_cause);
53
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
54
+    if (!pkbuf) {
55
+        ogs_error("sgsap_build_paging_reject() failed");
56
+        return OGS_ERROR;
57
+    }
58
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
59
     ogs_expect(rv == OGS_OK);
60
 
61
@@ -206,7 +221,10 @@
62
     ogs_debug("    EMM_MODE%d", emm_mode);
63
 
64
     pkbuf = sgsap_build_service_request(mme_ue, emm_mode);
65
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
66
+    if (!pkbuf) {
67
+        ogs_error("sgsap_build_service_request() failed");
68
+        return OGS_ERROR;
69
+    }
70
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
71
     ogs_expect(rv == OGS_OK);
72
 
73
@@ -222,7 +240,10 @@
74
     ogs_debug("SGSAP RESET-ACK");
75
 
76
     pkbuf = sgsap_build_reset_ack(vlr);
77
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
78
+    if (!pkbuf) {
79
+        ogs_error("sgsap_build_reset_ack() failed");
80
+        return OGS_ERROR;
81
+    }
82
     rv =  sgsap_send_to_vlr_with_sid(vlr, pkbuf, 0);
83
     ogs_expect(rv == OGS_OK);
84
 
85
@@ -243,7 +264,10 @@
86
             nas_message_container->buffer, nas_message_container->length);
87
 
88
     pkbuf = sgsap_build_uplink_unidata(mme_ue, nas_message_container);
89
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
90
+    if (!pkbuf) {
91
+        ogs_error("sgsap_build_uplink_unidata() failed");
92
+        return OGS_ERROR;
93
+    }
94
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
95
     ogs_expect(rv == OGS_OK);
96
 
97
@@ -261,7 +285,10 @@
98
     ogs_debug("    CAUSE%d", sgs_cause);
99
 
100
     pkbuf = sgsap_build_ue_unreachable(mme_ue, sgs_cause);
101
-    ogs_expect_or_return_val(pkbuf, OGS_ERROR);
102
+    if (!pkbuf) {
103
+        ogs_error("sgsap_build_ue_unreachable() failed");
104
+        return OGS_ERROR;
105
+    }
106
     rv = sgsap_send_to_vlr(mme_ue, pkbuf);
107
     ogs_expect(rv == OGS_OK);
108
 
109
open5gs_2.5.5.100.a8f8.tar.xz/src/nrf/sbi-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/nrf/sbi-path.c Changed
46
 
1
@@ -84,11 +84,17 @@
2
 
3
     ogs_assert(subscription_data);
4
     client = subscription_data->client;
5
-    ogs_expect_or_return_val(client, false);
6
+    if (!client) {
7
+        ogs_error("No Client");
8
+        return false;
9
+    }
10
 
11
     request = nrf_nnrf_nfm_build_nf_status_notify(
12
                 subscription_data, event, nf_instance);
13
-    ogs_expect_or_return_val(request, false);
14
+    if (!request) {
15
+        ogs_error("nrf_nnrf_nfm_build_nf_status_notify() failed");
16
+        return false;
17
+    }
18
 
19
     rc = ogs_sbi_send_request_to_client(
20
             client, client_notify_cb, request, NULL);
21
@@ -103,6 +109,7 @@
22
         OpenAPI_notification_event_type_e event,
23
         ogs_sbi_nf_instance_t *nf_instance)
24
 {
25
+    bool rc;
26
     ogs_sbi_subscription_data_t *subscription_data = NULL;
27
 
28
     ogs_assert(nf_instance);
29
@@ -135,10 +142,12 @@
30
                 continue;
31
         }
32
 
33
-        ogs_expect_or_return_val(true ==
34
-            nrf_nnrf_nfm_send_nf_status_notify(
35
-                subscription_data, event, nf_instance),
36
-            false);
37
+        rc = nrf_nnrf_nfm_send_nf_status_notify(
38
+                subscription_data, event, nf_instance);
39
+        if (rc == false) {
40
+            ogs_error("nrf_nnrf_nfm_send_nf_status_notify() failed");
41
+            return rc;
42
+        }
43
     }
44
 
45
     return true;
46
open5gs_2.5.5.100.a8f8.tar.xz/src/pcf/sbi-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/pcf/sbi-path.c Changed
86
 
1
@@ -139,7 +139,10 @@
2
     xact = ogs_sbi_xact_add(
3
             sbi_object, service_type, discovery_option,
4
             build, context, data);
5
-    ogs_expect_or_return_val(xact, false);
6
+    if (!xact) {
7
+        ogs_error("ogs_sbi_xact_add() failed");
8
+        return false;
9
+    }
10
 
11
     xact->assoc_stream = stream;
12
 
13
@@ -182,7 +185,10 @@
14
     ogs_assert(service_type);
15
 
16
     xact = ogs_sbi_xact_add(&sess->sbi, service_type, NULL, NULL, NULL, NULL);
17
-    ogs_expect_or_return_val(xact, false);
18
+    if (!xact) {
19
+        ogs_error("ogs_sbi_xact_add() failed");
20
+        return false;
21
+    }
22
 
23
     xact->assoc_stream = stream;
24
 
25
@@ -265,7 +271,10 @@
26
     ogs_assert(client);
27
 
28
     request = pcf_namf_callback_build_am_policy_control(pcf_ue, NULL);
29
-    ogs_expect_or_return_val(request, false);
30
+    if (!request) {
31
+        ogs_error("pcf_namf_callback_build_am_policy_control() failed");
32
+        return false;
33
+    }
34
 
35
     rc = ogs_sbi_send_request_to_client(
36
             client, client_notify_cb, request, NULL);
37
@@ -289,7 +298,10 @@
38
 
39
     request = pcf_nsmf_callback_build_smpolicycontrol_update(
40
                 sess, SmPolicyDecision);
41
-    ogs_expect_or_return_val(request, false);
42
+    if (!request) {
43
+        ogs_error("pcf_nsmf_callback_build_smpolicycontrol_update() failed");
44
+        return false;
45
+    }
46
 
47
     rc = ogs_sbi_send_request_to_client(
48
             client, client_notify_cb, request, NULL);
49
@@ -314,7 +326,10 @@
50
 
51
     request = pcf_nsmf_callback_build_smpolicycontrol_update(
52
                 sess, SmPolicyDecision);
53
-    ogs_expect_or_return_val(request, false);
54
+    if (!request) {
55
+        ogs_error("pcf_nsmf_callback_build_smpolicycontrol_update() failed");
56
+        return false;
57
+    }
58
 
59
     rc = ogs_sbi_send_request_to_client(
60
             client, client_delete_notify_cb, request, app_session);
61
@@ -336,7 +351,10 @@
62
     ogs_assert(client);
63
 
64
     request = pcf_nsmf_callback_build_smpolicycontrol_terminate(sess, NULL);
65
-    ogs_expect_or_return_val(request, false);
66
+    if (!request) {
67
+        ogs_error("pcf_nsmf_callback_build_smpolicycontrol_terminate() failed");
68
+        return false;
69
+    }
70
 
71
     rc = ogs_sbi_send_request_to_client(
72
             client, client_notify_cb, request, NULL);
73
@@ -358,7 +376,11 @@
74
     ogs_assert(client);
75
 
76
     request = pcf_naf_callback_build_policyauthorization_terminate(app, NULL);
77
-    ogs_expect_or_return_val(request, false);
78
+    if (!request) {
79
+        ogs_error("pcf_naf_callback_build_policyauthorization_terminate() "
80
+                "failed");
81
+        return false;
82
+    }
83
 
84
     rc = ogs_sbi_send_request_to_client(
85
             client, client_notify_cb, request, NULL);
86
open5gs_2.5.5.100.a8f8.tar.xz/src/smf/sbi-path.c -> open5gs_2.5.5.101.6895.tar.xz/src/smf/sbi-path.c Changed
13
 
1
@@ -392,7 +392,10 @@
2
     ogs_assert(client);
3
 
4
     request = smf_namf_callback_build_sm_context_status(sess, NULL);
5
-    ogs_expect_or_return_val(request, false);
6
+    if (!request) {
7
+        ogs_error("smf_namf_callback_build_sm_context_status() failed");
8
+        return false;
9
+    }
10
 
11
     rc = ogs_sbi_send_request_to_client(
12
             client, client_notify_cb, request, NULL);
13