Changes of Revision 3

open5gs_2.4.8.202206271119.dsc -> open5gs_2.4.8.202206281008.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-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg
4
 Architecture: any
5
-Version: 2.4.8.202206271119
6
+Version: 2.4.8.202206281008
7
 Maintainer: Harald Welte <laforge@gnumonks.org>
8
 Uploaders: Sukchan Lee <acetcom@gmail.com>
9
 Homepage: https://open5gs.org
10
@@ -30,8 +30,8 @@
11
  open5gs-udr deb net optional arch=any
12
  open5gs-upf deb net optional arch=any
13
 Checksums-Sha1:
14
- b33b28597d7a680df1213da2b9ad805967b690bd 11442952 open5gs_2.4.8.202206271119.tar.xz
15
+ 7c8afd01b73ce39a3f9537177165d9ee1c7841e3 11443376 open5gs_2.4.8.202206281008.tar.xz
16
 Checksums-Sha256:
17
- d06a4332e9f017c82cf3c32ea975af83f2d69b1cb292db2982f8053b1003b9f6 11442952 open5gs_2.4.8.202206271119.tar.xz
18
+ 341be8271c61702bc4de9387c6f5cba745f999149a94a0525b41a7100f681472 11443376 open5gs_2.4.8.202206281008.tar.xz
19
 Files:
20
- 66429e904664ee2e43f0eed434d13758 11442952 open5gs_2.4.8.202206271119.tar.xz
21
+ dca61de6c6298fe583dcb1f648909dd1 11443376 open5gs_2.4.8.202206281008.tar.xz
22
open5gs_2.4.8.202206271119.tar.xz/debian/changelog -> open5gs_2.4.8.202206281008.tar.xz/debian/changelog Changed
12
 
1
@@ -1,8 +1,8 @@
2
-open5gs (2.4.8.202206271119) UNRELEASED; urgency=medium
3
+open5gs (2.4.8.202206281008) UNRELEASED; urgency=medium
4
 
5
   * Snapshot build
6
 
7
- -- Sukchan Lee <acetcom@gmail.com>  Mon, 27 Jun 2022 11:26:00 +0000
8
+ -- Sukchan Lee <acetcom@gmail.com>  Tue, 28 Jun 2022 10:15:17 +0000
9
 
10
 open5gs (2.4.8) unstable; urgency=medium
11
 
12
open5gs_2.4.8.202206271119.tar.xz/debian/control -> open5gs_2.4.8.202206281008.tar.xz/debian/control Changed
163
 
1
@@ -31,7 +31,7 @@
2
 Package: open5gs-common
3
 Architecture: any
4
 Multi-Arch: same
5
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
6
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
7
          ${misc:Depends}
8
 Description: 5G Core and EPC (Shared Files)
9
  Open5GS is a C-language implementation of 5G Core and EPC
10
@@ -43,7 +43,7 @@
11
 Package: open5gs-mme
12
 Architecture: any
13
 Multi-Arch: same
14
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
15
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
16
          ${misc:Depends},
17
          open5gs-common (= ${binary:Version})
18
 Description: MME (Mobility Management Entity)
19
@@ -58,7 +58,7 @@
20
 Package: open5gs-sgwc
21
 Architecture: any
22
 Multi-Arch: same
23
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
24
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
25
          ${misc:Depends},
26
          open5gs-common (= ${binary:Version})
27
 Description: SGW-C (Serving Gateway - Control Plane)
28
@@ -72,7 +72,7 @@
29
 Package: open5gs-smf
30
 Architecture: any
31
 Multi-Arch: same
32
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
33
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
34
          ${misc:Depends},
35
          open5gs-common (= ${binary:Version})
36
 Description: SMF (Session Management Function)
37
@@ -84,7 +84,7 @@
38
 Package: open5gs-amf
39
 Architecture: any
40
 Multi-Arch: same
41
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
42
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
43
          ${misc:Depends},
44
          open5gs-common (= ${binary:Version})
45
 Description: AMF (Access and Mobility Management Function)
46
@@ -96,7 +96,7 @@
47
 Package: open5gs-sgwu
48
 Architecture: any
49
 Multi-Arch: same
50
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
51
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
52
          ${misc:Depends},
53
          open5gs-common (= ${binary:Version})
54
 Description: SGW-U (Serving Gateway - User Plane)
55
@@ -110,7 +110,7 @@
56
 Package: open5gs-upf
57
 Architecture: any
58
 Multi-Arch: same
59
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
60
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
61
          ${misc:Depends},
62
          udev,
63
          open5gs-common (= ${binary:Version})
64
@@ -123,7 +123,7 @@
65
 Package: open5gs-hss
66
 Architecture: any
67
 Multi-Arch: same
68
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
69
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
70
          ${misc:Depends},
71
          mongodb-org | mongodb,
72
          open5gs-common (= ${binary:Version})
73
@@ -140,7 +140,7 @@
74
 Package: open5gs-pcrf
75
 Architecture: any
76
 Multi-Arch: same
77
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
78
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
79
          ${misc:Depends},
80
          mongodb-org | mongodb,
81
          open5gs-common (= ${binary:Version})
82
@@ -156,7 +156,7 @@
83
 Package: open5gs-nrf
84
 Architecture: any
85
 Multi-Arch: same
86
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
87
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
88
          ${misc:Depends},
89
          open5gs-common (= ${binary:Version})
90
 Description: NRF (Network Repository Function)
91
@@ -168,7 +168,7 @@
92
 Package: open5gs-ausf
93
 Architecture: any
94
 Multi-Arch: same
95
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
96
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
97
          ${misc:Depends},
98
          open5gs-common (= ${binary:Version})
99
 Description: AUSF (Authentication Server Function)
100
@@ -180,7 +180,7 @@
101
 Package: open5gs-udm
102
 Architecture: any
103
 Multi-Arch: same
104
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
105
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
106
          ${misc:Depends},
107
          open5gs-common (= ${binary:Version})
108
 Description: UDM (Unified Data Management)
109
@@ -192,7 +192,7 @@
110
 Package: open5gs-pcf
111
 Architecture: any
112
 Multi-Arch: same
113
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
114
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
115
          ${misc:Depends},
116
          open5gs-common (= ${binary:Version})
117
 Description: PCF (Policy Control Function)
118
@@ -204,7 +204,7 @@
119
 Package: open5gs-nssf
120
 Architecture: any
121
 Multi-Arch: same
122
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
123
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
124
          ${misc:Depends},
125
          open5gs-common (= ${binary:Version})
126
 Description: NSSF (Network Slice Selection Function)
127
@@ -216,7 +216,7 @@
128
 Package: open5gs-bsf
129
 Architecture: any
130
 Multi-Arch: same
131
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
132
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
133
          ${misc:Depends},
134
          open5gs-common (= ${binary:Version})
135
 Description: BSF (Binding Support Function)
136
@@ -228,7 +228,7 @@
137
 Package: open5gs-udr
138
 Architecture: any
139
 Multi-Arch: same
140
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${shlibs:Depends},
141
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${shlibs:Depends},
142
          ${misc:Depends},
143
          open5gs-common (= ${binary:Version})
144
 Description: UDR (Unified Data Repository)
145
@@ -240,7 +240,7 @@
146
 Package: open5gs
147
 Architecture: any
148
 Multi-Arch: same
149
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${misc:Depends},
150
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${misc:Depends},
151
          open5gs-common (= ${binary:Version}),
152
          open5gs-mme (= ${binary:Version}),
153
          open5gs-sgwc (= ${binary:Version}),
154
@@ -266,7 +266,7 @@
155
 Package: open5gs-dbg
156
 Architecture: any
157
 Multi-Arch: same
158
-Depends: osmocom-nightly (= 1.0.0.202206271119), ${misc:Depends},
159
+Depends: osmocom-nightly (= 1.0.0.202206281008), ${misc:Depends},
160
          open5gs (= ${binary:Version})
161
 Description: Debug symbols for Open5GS
162
  Open5GS is a C-language implementation of 5G Core and EPC
163
open5gs_2.4.8.202206271119.tar.xz/lib/gtp/v1/types.h -> open5gs_2.4.8.202206281008.tar.xz/lib/gtp/v1/types.h Changed
20
 
1
@@ -277,6 +277,18 @@
2
 #define OGS_GTP1_QOS_SRC_STATS_DESC_UNKNOWN 0
3
 #define OGS_GTP1_QOS_SRC_STATS_DESC_SPEECH 1
4
 
5
+/* 7.7.48 Common Flags */
6
+typedef struct ogs_gtp1_common_flags_s {
7
+ED8(uint8_t dual_address_bearer_flag:1;,
8
+    uint8_t upgrade_qos_supported:1;,
9
+    uint8_t nrsn:1;,
10
+    uint8_t no_qos_negotiation:1;,
11
+    uint8_t mbms_counting_information:1;,
12
+    uint8_t ran_procedures_ready:1;,
13
+    uint8_t mbms_service_type:1;,
14
+    uint8_t prohibit_payload_compression:1;)
15
+} __attribute__ ((packed)) ogs_gtp1_common_flags_t;
16
+
17
 /* 7.7.98 APN Aggregate Maximum Bit Rate (APN-AMBR) */
18
 typedef struct ogs_gtp1_apn_ambr_s {
19
     uint32_t uplink;
20
open5gs_2.4.8.202206271119.tar.xz/lib/gtp/xact.h -> open5gs_2.4.8.202206281008.tar.xz/lib/gtp/xact.h Changed
11
 
1
@@ -86,6 +86,9 @@
2
     ogs_timer_t     *tm_holding;    /**< Timer waiting for holding message */
3
     uint8_t         holding_rcount;
4
 
5
+    uint32_t        local_teid;     /**< Local TEID,
6
+                                         expected in reply from peer */
7
+
8
     void            *assoc_xact;    /**< Associated GTP transaction */
9
     void            *pfcp_xact;     /**< Associated PFCP transaction */
10
 
11
open5gs_2.4.8.202206271119.tar.xz/lib/pfcp/xact.h -> open5gs_2.4.8.202206281008.tar.xz/lib/pfcp/xact.h Changed
11
 
1
@@ -65,6 +65,9 @@
2
 
3
     ogs_timer_t     *tm_delayed_commit; /**< Timer waiting for commit xact */
4
 
5
+    uint64_t        local_seid;     /**< Local SEID,
6
+                                         expected in reply from peer */
7
+
8
     void            *assoc_xact;    /**< Associated GTP transaction */
9
     ogs_pkbuf_t     *gtpbuf;        /**< GTP packet buffer */
10
 
11
open5gs_2.4.8.202206271119.tar.xz/src/amf/ngap-sctp.c -> open5gs_2.4.8.202206281008.tar.xz/src/amf/ngap-sctp.c Changed
18
 
1
@@ -238,8 +238,14 @@
2
         ngap_event_push(AMF_EVT_NGAP_MESSAGE, sock, addr, pkbuf, 0, 0);
3
         return;
4
     } else {
5
-        ogs_fatal("Invalid flag(0x%x)", flags);
6
-        ogs_assert_if_reached();
7
+        if (ogs_socket_errno != OGS_EAGAIN) {
8
+            ogs_fatal("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)",
9
+                    size, errno, strerror(errno), flags);
10
+            ogs_assert_if_reached();
11
+        } else {
12
+            ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)",
13
+                    size, errno, strerror(errno), flags);
14
+        }
15
     }
16
 
17
     ogs_pkbuf_free(pkbuf);
18
open5gs_2.4.8.202206271119.tar.xz/src/mme/mme-gtp-path.c -> open5gs_2.4.8.202206281008.tar.xz/src/mme/mme-gtp-path.c Changed
57
 
1
@@ -228,6 +228,7 @@
2
     xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, sess);
3
     ogs_expect_or_return_val(xact, OGS_ERROR);
4
     xact->create_action = create_action;
5
+    xact->local_teid = mme_ue->mme_s11_teid;
6
 
7
     rv = ogs_gtp_xact_commit(xact);
8
     ogs_expect(rv == OGS_OK);
9
@@ -260,6 +261,7 @@
10
     xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
11
     ogs_expect_or_return_val(xact, OGS_ERROR);
12
     xact->modify_action = modify_action;
13
+    xact->local_teid = mme_ue->mme_s11_teid;
14
 
15
     rv = ogs_gtp_xact_commit(xact);
16
     ogs_expect(rv == OGS_OK);
17
@@ -292,6 +294,7 @@
18
     xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, s11buf, timeout, sess);
19
     ogs_expect_or_return_val(xact, OGS_ERROR);
20
     xact->delete_action = action;
21
+    xact->local_teid = mme_ue->mme_s11_teid;
22
 
23
     rv = ogs_gtp_xact_commit(xact);
24
     ogs_expect(rv == OGS_OK);
25
@@ -470,6 +473,7 @@
26
     xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
27
     ogs_expect_or_return_val(xact, OGS_ERROR);
28
     xact->release_action = action;
29
+    xact->local_teid = mme_ue->mme_s11_teid;
30
 
31
     rv = ogs_gtp_xact_commit(xact);
32
     ogs_expect(rv == OGS_OK);
33
@@ -586,6 +590,7 @@
34
 
35
     xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
36
     ogs_expect_or_return_val(xact, OGS_ERROR);
37
+    xact->local_teid = mme_ue->mme_s11_teid;
38
 
39
     rv = ogs_gtp_xact_commit(xact);
40
     ogs_expect(rv == OGS_OK);
41
@@ -618,6 +623,7 @@
42
     xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, mme_ue);
43
     ogs_expect_or_return_val(xact, OGS_ERROR);
44
     xact->delete_indirect_action = action;
45
+    xact->local_teid = mme_ue->mme_s11_teid;
46
 
47
     rv = ogs_gtp_xact_commit(xact);
48
     ogs_expect(rv == OGS_OK);
49
@@ -652,6 +658,7 @@
50
     xact = ogs_gtp_xact_local_create(sgw_ue->gnode, &h, pkbuf, timeout, bearer);
51
     ogs_expect_or_return_val(xact, OGS_ERROR);
52
     xact->xid |= OGS_GTP_CMD_XACT_ID;
53
+    xact->local_teid = mme_ue->mme_s11_teid;
54
 
55
     rv = ogs_gtp_xact_commit(xact);
56
     ogs_expect(rv == OGS_OK);
57
open5gs_2.4.8.202206271119.tar.xz/src/mme/mme-s11-handler.c -> open5gs_2.4.8.202206281008.tar.xz/src/mme/mme-s11-handler.c Changed
201
 
1
@@ -78,7 +78,7 @@
2
 }
3
 
4
 void mme_s11_handle_create_session_response(
5
-        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
6
+        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
7
         ogs_gtp2_create_session_response_t *rsp)
8
 {
9
     int rv, i;
10
@@ -91,7 +91,6 @@
11
 
12
     mme_bearer_t *bearer = NULL;
13
     mme_sess_t *sess = NULL;
14
-    mme_ue_t *mme_ue = NULL;
15
     sgw_ue_t *source_ue = NULL, *target_ue = NULL;
16
     ogs_session_t *session = NULL;
17
     ogs_gtp2_bearer_qos_t bearer_qos;
18
@@ -99,6 +98,7 @@
19
     uint16_t decoded = 0;
20
     int create_action = 0;
21
 
22
+    ogs_assert(mme_ue);
23
     ogs_assert(rsp);
24
 
25
     ogs_debug("Create Session Response");
26
@@ -110,8 +110,6 @@
27
     create_action = xact->create_action;
28
     sess = xact->data;
29
     ogs_assert(sess);
30
-    mme_ue = sess->mme_ue;
31
-    ogs_assert(mme_ue);
32
     source_ue = sgw_ue_cycle(mme_ue->sgw_ue);
33
     ogs_assert(source_ue);
34
 
35
@@ -131,11 +129,6 @@
36
      ************************/
37
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
38
 
39
-    if (!mme_ue_from_teid) {
40
-        ogs_error("No Context in TEID");
41
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
42
-    }
43
-
44
     if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
45
         if (create_action == OGS_GTP_CREATE_IN_ATTACH_REQUEST) {
46
             ogs_error("%s Attach reject", mme_ue->imsi_bcd);
47
@@ -400,7 +393,7 @@
48
 }
49
 
50
 void mme_s11_handle_modify_bearer_response(
51
-        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
52
+        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
53
         ogs_gtp2_modify_bearer_response_t *rsp)
54
 {
55
     int rv;
56
@@ -408,9 +401,9 @@
57
     int modify_action = 0;
58
     ogs_gtp2_cause_t *cause = NULL;
59
 
60
-    mme_ue_t *mme_ue = NULL;
61
     sgw_ue_t *sgw_ue = NULL;
62
 
63
+    ogs_assert(mme_ue);
64
     ogs_assert(rsp);
65
 
66
     ogs_debug("Modify Bearer Response");
67
@@ -420,8 +413,6 @@
68
      ********************/
69
     ogs_assert(xact);
70
     modify_action = xact->modify_action;
71
-    mme_ue = xact->data;
72
-    ogs_assert(mme_ue);
73
     sgw_ue = sgw_ue_cycle(mme_ue->sgw_ue);
74
     ogs_assert(sgw_ue);
75
 
76
@@ -433,11 +424,6 @@
77
      ************************/
78
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
79
 
80
-    if (!mme_ue_from_teid) {
81
-        ogs_error("No Context in TEID");
82
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
83
-    }
84
-
85
     if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
86
         mme_send_delete_session_or_mme_ue_context_release(mme_ue);
87
         return;
88
@@ -494,7 +480,7 @@
89
 }
90
 
91
 void mme_s11_handle_delete_session_response(
92
-        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
93
+        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
94
         ogs_gtp2_delete_session_response_t *rsp)
95
 {
96
     int rv;
97
@@ -502,8 +488,8 @@
98
     int action = 0;
99
     sgw_ue_t *source_ue = NULL, *target_ue = NULL;
100
     mme_sess_t *sess = NULL;
101
-    mme_ue_t *mme_ue = NULL;
102
 
103
+    ogs_assert(mme_ue);
104
     ogs_assert(rsp);
105
 
106
     ogs_debug("Delete Session Response");
107
@@ -516,8 +502,6 @@
108
     ogs_assert(action);
109
     sess = xact->data;
110
     ogs_assert(sess);
111
-    mme_ue = sess->mme_ue;
112
-    ogs_assert(mme_ue);
113
     target_ue = sgw_ue_cycle(mme_ue->sgw_ue);
114
     ogs_assert(target_ue);
115
 
116
@@ -532,13 +516,6 @@
117
     rv = ogs_gtp_xact_commit(xact);
118
     ogs_expect_or_return(rv == OGS_OK);
119
 
120
-    /************************
121
-     * Check MME-UE Context
122
-     ************************/
123
-    if (!mme_ue_from_teid) {
124
-        ogs_error("No Context in TEID");
125
-    }
126
-
127
     /********************
128
      * Check Cause Value
129
      ********************/
130
@@ -1076,7 +1053,7 @@
131
 }
132
 
133
 void mme_s11_handle_release_access_bearers_response(
134
-        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
135
+        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
136
         ogs_gtp2_release_access_bearers_response_t *rsp)
137
 {
138
     int rv;
139
@@ -1085,10 +1062,10 @@
140
     enb_ue_t *enb_ue = NULL;
141
 
142
     sgw_ue_t *sgw_ue = NULL;;
143
-    mme_ue_t *mme_ue = NULL;
144
     mme_sess_t *sess = NULL;
145
     mme_bearer_t *bearer = NULL;
146
 
147
+    ogs_assert(mme_ue);
148
     ogs_assert(rsp);
149
 
150
     ogs_debug("Release Access Bearers Response");
151
@@ -1099,21 +1076,12 @@
152
     ogs_assert(xact);
153
     action = xact->release_action;
154
     ogs_assert(action);
155
-    mme_ue = xact->data;
156
-    ogs_assert(mme_ue);
157
     sgw_ue = sgw_ue_cycle(mme_ue->sgw_ue);
158
     ogs_assert(sgw_ue);
159
 
160
     rv = ogs_gtp_xact_commit(xact);
161
     ogs_expect_or_return(rv == OGS_OK);
162
 
163
-    /***********************
164
-     * Check MME-UE Context
165
-     ***********************/
166
-    if (!mme_ue_from_teid) {
167
-        ogs_error("No Context in TEID");
168
-    }
169
-
170
     /********************
171
      * Check Cause Value
172
      ********************/
173
@@ -1365,7 +1333,7 @@
174
 }
175
 
176
 void mme_s11_handle_create_indirect_data_forwarding_tunnel_response(
177
-        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue_from_teid,
178
+        ogs_gtp_xact_t *xact, mme_ue_t *mme_ue,
179
         ogs_gtp2_create_indirect_data_forwarding_tunnel_response_t *rsp)
180
 {
181
     int rv;
182
@@ -1373,12 +1341,12 @@
183
     ogs_gtp2_cause_t *cause = NULL;
184
     sgw_ue_t *sgw_ue = NULL;
185
     mme_bearer_t *bearer = NULL;
186
-    mme_ue_t *mme_ue = NULL;
187
     enb_ue_t *source_ue = NULL;
188
     int i;
189
 
190
     ogs_gtp2_f_teid_t *teid = NULL;
191
 
192
+    ogs_assert(mme_ue);
193
     ogs_assert(rsp);
194
 
195
     ogs_debug("Create Indirect Data Forwarding Tunnel Response");
196
@@ -1386,9 +1354,6 @@
197
     /********************
198
      * Check Transaction
199
      ********************/
200
-    ogs_assert(xact);
201
open5gs_2.4.8.202206271119.tar.xz/src/mme/mme-sm.c -> open5gs_2.4.8.202206281008.tar.xz/src/mme/mme-sm.c Changed
61
 
1
@@ -562,6 +562,13 @@
2
         if (gtp_message.h.teid_presence && gtp_message.h.teid != 0) {
3
             /* Cause is not "Context not found" */
4
             mme_ue = mme_ue_find_by_teid(gtp_message.h.teid);
5
+        } else if (xact->local_teid) { /* rx no TEID or TEID=0 */
6
+            /* 3GPP TS 29.274 5.5.2: we receive TEID=0 under some
7
+             * conditions, such as cause "Session context not found". In those
8
+             * cases, we still want to identify the local session which
9
+             * originated the message, so try harder by using the TEID we
10
+             * locally stored in xact when sending the original request: */
11
+            mme_ue = mme_ue_find_by_teid(xact->local_teid);
12
         }
13
 
14
         switch (gtp_message.h.type) {
15
@@ -572,14 +579,17 @@
16
             mme_s11_handle_echo_response(xact, &gtp_message.echo_response);
17
             break;
18
         case OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE:
19
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
20
             mme_s11_handle_create_session_response(
21
                 xact, mme_ue, &gtp_message.create_session_response);
22
             break;
23
         case OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE:
24
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
25
             mme_s11_handle_modify_bearer_response(
26
                 xact, mme_ue, &gtp_message.modify_bearer_response);
27
             break;
28
         case OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE:
29
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
30
             mme_s11_handle_delete_session_response(
31
                 xact, mme_ue, &gtp_message.delete_session_response);
32
             break;
33
@@ -596,6 +606,7 @@
34
                 xact, mme_ue, &gtp_message.delete_bearer_request);
35
             break;
36
         case OGS_GTP2_RELEASE_ACCESS_BEARERS_RESPONSE_TYPE:
37
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
38
             mme_s11_handle_release_access_bearers_response(
39
                 xact, mme_ue, &gtp_message.release_access_bearers_response);
40
             break;
41
@@ -604,16 +615,19 @@
42
                 xact, mme_ue, &gtp_message.downlink_data_notification);
43
             break;
44
         case OGS_GTP2_CREATE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE:
45
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
46
             mme_s11_handle_create_indirect_data_forwarding_tunnel_response(
47
                 xact, mme_ue,
48
                 &gtp_message.create_indirect_data_forwarding_tunnel_response);
49
             break;
50
         case OGS_GTP2_DELETE_INDIRECT_DATA_FORWARDING_TUNNEL_RESPONSE_TYPE:
51
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
52
             mme_s11_handle_delete_indirect_data_forwarding_tunnel_response(
53
                 xact, mme_ue,
54
                 &gtp_message.delete_indirect_data_forwarding_tunnel_response);
55
             break;
56
         case OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE:
57
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
58
             mme_s11_handle_bearer_resource_failure_indication(
59
                 xact, mme_ue,
60
                 &gtp_message.bearer_resource_failure_indication);
61
open5gs_2.4.8.202206271119.tar.xz/src/mme/s1ap-sctp.c -> open5gs_2.4.8.202206281008.tar.xz/src/mme/s1ap-sctp.c Changed
18
 
1
@@ -240,8 +240,14 @@
2
         s1ap_event_push(MME_EVT_S1AP_MESSAGE, sock, addr, pkbuf, 0, 0);
3
         return;
4
     } else {
5
-        ogs_fatal("Invalid flag(0x%x)", flags);
6
-        ogs_assert_if_reached();
7
+        if (ogs_socket_errno != OGS_EAGAIN) {
8
+            ogs_fatal("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)",
9
+                    size, errno, strerror(errno), flags);
10
+            ogs_assert_if_reached();
11
+        } else {
12
+            ogs_error("ogs_sctp_recvmsg(%d) failed(%d:%s-0x%x)",
13
+                    size, errno, strerror(errno), flags);
14
+        }
15
     }
16
 
17
     ogs_pkbuf_free(pkbuf);
18
open5gs_2.4.8.202206271119.tar.xz/src/sgwc/pfcp-path.c -> open5gs_2.4.8.202206281008.tar.xz/src/sgwc/pfcp-path.c Changed
42
 
1
@@ -212,6 +212,8 @@
2
     ogs_assert(sess);
3
     ogs_assert(xact);
4
 
5
+    xact->local_seid = sess->sgwc_sxa_seid;
6
+
7
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
8
     h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
9
     h.seid = sess->sgwu_sxa_seid;
10
@@ -246,6 +248,7 @@
11
         xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
12
         ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
13
     }
14
+    xact->local_seid = sess->sgwc_sxa_seid;
15
 
16
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
17
     h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE;
18
@@ -311,6 +314,7 @@
19
         xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
20
         ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
21
     }
22
+    xact->local_seid = sess->sgwc_sxa_seid;
23
 
24
     ogs_list_add(&xact->bearer_to_modify_list, &bearer->to_modify_node);
25
 
26
@@ -348,6 +352,7 @@
27
         xact->gtpbuf = ogs_pkbuf_copy(gtpbuf);
28
         ogs_expect_or_return_val(xact->gtpbuf, OGS_ERROR);
29
     }
30
+    xact->local_seid = sess->sgwc_sxa_seid;
31
 
32
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
33
     h.type = OGS_PFCP_SESSION_DELETION_REQUEST_TYPE;
34
@@ -373,6 +378,7 @@
35
     ogs_pfcp_header_t h;
36
 
37
     ogs_assert(xact);
38
+    xact->local_seid = sess->sgwc_sxa_seid;
39
 
40
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
41
     h.type = OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE;
42
open5gs_2.4.8.202206271119.tar.xz/src/sgwc/pfcp-sm.c -> open5gs_2.4.8.202206281008.tar.xz/src/sgwc/pfcp-sm.c Changed
68
 
1
@@ -183,8 +183,16 @@
2
         xact = e->pfcp_xact;
3
         ogs_assert(xact);
4
 
5
-        if (message->h.seid_presence && message->h.seid != 0)
6
+        if (message->h.seid_presence && message->h.seid != 0) {
7
             sess = sgwc_sess_find_by_seid(message->h.seid);
8
+        } else if (xact->local_seid) { /* rx no SEID or SEID=0 */
9
+            /* 3GPP TS 29.244 7.2.2.4.2: we receive SEID=0 under some
10
+             * conditions, such as cause "Session context not found". In those
11
+             * cases, we still want to identify the local session which
12
+             * originated the message, so try harder by using the SEID we
13
+             * locally stored in xact when sending the original request: */
14
+            sess = sgwc_sess_find_by_seid(xact->local_seid);
15
+        }
16
 
17
         switch (message->h.type) {
18
         case OGS_PFCP_HEARTBEAT_REQUEST_TYPE:
19
@@ -208,44 +216,28 @@
20
                     &message->pfcp_association_setup_response);
21
             break;
22
         case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE:
23
-            if (!message->h.seid_presence) {
24
-                ogs_error("No SEID");
25
-                break;
26
-            }
27
-
28
+            if (!message->h.seid_presence) ogs_error("No SEID");
29
             sgwc_sxa_handle_session_establishment_response(
30
                 sess, xact, e->gtp_message,
31
                 &message->pfcp_session_establishment_response);
32
             break;
33
 
34
         case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE:
35
-            if (!message->h.seid_presence) {
36
-                ogs_error("No SEID");
37
-                break;
38
-            }
39
-
40
+            if (!message->h.seid_presence) ogs_error("No SEID");
41
             sgwc_sxa_handle_session_modification_response(
42
                 sess, xact, e->gtp_message,
43
                 &message->pfcp_session_modification_response);
44
             break;
45
 
46
         case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE:
47
-            if (!message->h.seid_presence) {
48
-                ogs_error("No SEID");
49
-                break;
50
-            }
51
-
52
+            if (!message->h.seid_presence) ogs_error("No SEID");
53
             sgwc_sxa_handle_session_deletion_response(
54
                 sess, xact, e->gtp_message,
55
                 &message->pfcp_session_deletion_response);
56
             break;
57
 
58
         case OGS_PFCP_SESSION_REPORT_REQUEST_TYPE:
59
-            if (!message->h.seid_presence) {
60
-                ogs_error("No SEID");
61
-                break;
62
-            }
63
-
64
+            if (!message->h.seid_presence) ogs_error("No SEID");
65
             sgwc_sxa_handle_session_report_request(
66
                 sess, xact, &message->pfcp_session_report_request);
67
             break;
68
open5gs_2.4.8.202206271119.tar.xz/src/sgwc/s11-handler.c -> open5gs_2.4.8.202206281008.tar.xz/src/sgwc/s11-handler.c Changed
118
 
1
@@ -688,6 +688,7 @@
2
     ogs_gtp2_f_teid_t *sgw_s1u_teid = NULL, *enb_s1u_teid = NULL;
3
     ogs_gtp2_uli_t uli;
4
 
5
+    ogs_assert(sgwc_ue);
6
     ogs_assert(message);
7
     rsp = &message->create_bearer_response;
8
     ogs_assert(rsp);
9
@@ -714,30 +715,10 @@
10
     rv = ogs_gtp_xact_commit(s11_xact);
11
     ogs_expect(rv == OGS_OK);
12
 
13
-    /************************
14
-     * Check SGWC-UE Context
15
-     ************************/
16
-    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
17
-
18
-    if (!sgwc_ue) {
19
-        ogs_error("No Context in TEID");
20
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
21
-    }
22
-
23
-    if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
24
-        ogs_assert(OGS_OK ==
25
-            sgwc_pfcp_send_bearer_modification_request(
26
-                bearer, NULL, NULL,
27
-                OGS_PFCP_MODIFY_UL_ONLY|OGS_PFCP_MODIFY_REMOVE));
28
-        ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
29
-                OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE, cause_value);
30
-        return;
31
-    }
32
-
33
     /*****************************************
34
      * Check Mandatory/Conditional IE Missing
35
      *****************************************/
36
-    ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED);
37
+    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
38
 
39
     if (rsp->bearer_contexts.presence == 0) {
40
         ogs_error("No Bearer");
41
@@ -872,6 +853,7 @@
42
     sgwc_bearer_t *bearer = NULL;
43
     ogs_gtp2_update_bearer_response_t *rsp = NULL;
44
 
45
+    ogs_assert(sgwc_ue);
46
     ogs_assert(message);
47
     rsp = &message->update_bearer_response;
48
     ogs_assert(rsp);
49
@@ -898,26 +880,10 @@
50
     rv = ogs_gtp_xact_commit(s11_xact);
51
     ogs_expect(rv == OGS_OK);
52
 
53
-    /************************
54
-     * Check SGWC-UE Context
55
-     ************************/
56
-    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
57
-
58
-    if (!sgwc_ue) {
59
-        ogs_error("No Context in TEID");
60
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
61
-    }
62
-
63
-    if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
64
-        ogs_gtp_send_error_message(s5c_xact, sess ? sess->pgw_s5c_teid : 0,
65
-                OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE, cause_value);
66
-        return;
67
-    }
68
-
69
     /*****************************************
70
      * Check Mandatory/Conditional IE Missing
71
      *****************************************/
72
-    ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED);
73
+    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
74
 
75
     if (rsp->bearer_contexts.presence == 0) {
76
         ogs_error("No Bearer");
77
@@ -1004,6 +970,7 @@
78
     sgwc_bearer_t *bearer = NULL;
79
     ogs_gtp2_delete_bearer_response_t *rsp = NULL;
80
 
81
+    ogs_assert(sgwc_ue);
82
     ogs_assert(message);
83
     rsp = &message->delete_bearer_response;
84
     ogs_assert(rsp);
85
@@ -1035,11 +1002,6 @@
86
      ************************/
87
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
88
 
89
-    if (!sgwc_ue) {
90
-        ogs_error("No Context in TEID");
91
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
92
-    }
93
-
94
     if (rsp->linked_eps_bearer_id.presence) {
95
        /*
96
         * << Linked EPS Bearer ID >>
97
@@ -1111,10 +1073,8 @@
98
             ogs_error("No Cause");
99
         }
100
 
101
-        if (sgwc_ue) {
102
-            ogs_debug("    MME_S11_TEID%d SGW_S11_TEID%d",
103
-                sgwc_ue->mme_s11_teid, sgwc_ue->sgw_s11_teid);
104
-        }
105
+        ogs_debug("    MME_S11_TEID%d SGW_S11_TEID%d",
106
+            sgwc_ue->mme_s11_teid, sgwc_ue->sgw_s11_teid);
107
         ogs_debug("    SGW_S5C_TEID0x%x PGW_S5C_TEID0x%x",
108
             sess->sgw_s5c_teid, sess->pgw_s5c_teid);
109
 
110
@@ -1513,6 +1473,7 @@
111
     s5c_xact = ogs_gtp_xact_local_create(
112
             sess->gnode, &message->h, pkbuf, gtp_bearer_timeout, bearer);
113
     ogs_expect_or_return(s5c_xact);
114
+    s5c_xact->local_teid = sess->sgw_s5c_teid;
115
 
116
     ogs_gtp_xact_associate(s11_xact, s5c_xact);
117
 
118
open5gs_2.4.8.202206271119.tar.xz/src/sgwc/s5c-handler.c -> open5gs_2.4.8.202206281008.tar.xz/src/sgwc/s5c-handler.c Changed
201
 
1
@@ -79,6 +79,9 @@
2
     ogs_gtp_xact_t *s11_xact = NULL;
3
     ogs_gtp_node_t *pgw = NULL;
4
 
5
+    ogs_assert(sess);
6
+    sgwc_ue = sess->sgwc_ue;
7
+    ogs_assert(sgwc_ue);
8
     ogs_assert(gtpbuf);
9
     ogs_assert(message);
10
     rsp = &message->create_session_response;
11
@@ -96,30 +99,10 @@
12
     rv = ogs_gtp_xact_commit(s5c_xact);
13
     ogs_expect(rv == OGS_OK);
14
 
15
-    /************************
16
-     * Check Session Context
17
-     ************************/
18
-    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
19
-
20
-    if (!sess) {
21
-        ogs_error("No Context in TEID");
22
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
23
-    } else {
24
-        sgwc_ue = sess->sgwc_ue;
25
-        ogs_assert(sgwc_ue);
26
-    }
27
-
28
-    if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
29
-        ogs_gtp_send_error_message(
30
-                s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
31
-                OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
32
-        return;
33
-    }
34
-
35
     /*****************************************
36
      * Check Mandatory/Conditional IE Missing
37
      *****************************************/
38
-    ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED);
39
+    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
40
 
41
     if (rsp->pgw_s5_s8__s2a_s2b_f_teid_for_pmip_based_interface_or_for_gtp_based_control_plane_interface.presence == 0) {
42
         ogs_error("No GTP TEID");
43
@@ -282,24 +265,29 @@
44
             OGS_PFCP_MODIFY_UL_ONLY|OGS_PFCP_MODIFY_ACTIVATE));
45
 }
46
 
47
-void sgwc_s5c_handle_delete_session_response(
48
+void sgwc_s5c_handle_modify_bearer_response(
49
         sgwc_sess_t *sess, ogs_gtp_xact_t *s5c_xact,
50
         ogs_pkbuf_t *gtpbuf, ogs_gtp2_message_t *message)
51
 {
52
     int rv;
53
     ogs_gtp2_cause_t *cause = NULL;
54
     uint8_t cause_value;
55
+    int modify_action;
56
 
57
     sgwc_ue_t *sgwc_ue = NULL;
58
+    ogs_pkbuf_t *pkbuf = NULL;
59
 
60
     ogs_gtp_xact_t *s11_xact = NULL;
61
-    ogs_gtp2_delete_session_response_t *rsp = NULL;
62
+    ogs_gtp2_modify_bearer_response_t *rsp = NULL;
63
 
64
+    ogs_assert(sess);
65
+    sgwc_ue = sess->sgwc_ue;
66
+    ogs_assert(sgwc_ue);
67
     ogs_assert(message);
68
-    rsp = &message->delete_session_response;
69
+    rsp = &message->modify_bearer_response;
70
     ogs_assert(rsp);
71
 
72
-    ogs_debug("Delete Session Response");
73
+    ogs_debug("Modify Bearer Response");
74
 
75
     /********************
76
      * Check Transaction
77
@@ -307,34 +295,15 @@
78
     ogs_assert(s5c_xact);
79
     s11_xact = s5c_xact->assoc_xact;
80
     ogs_assert(s11_xact);
81
+    modify_action = s5c_xact->modify_action;
82
 
83
     rv = ogs_gtp_xact_commit(s5c_xact);
84
     ogs_expect(rv == OGS_OK);
85
 
86
-    /************************
87
-     * Check Session Context
88
-     ************************/
89
-    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
90
-
91
-    if (!sess) {
92
-        ogs_error("No Context in TEID");
93
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
94
-    } else {
95
-        sgwc_ue = sess->sgwc_ue;
96
-        ogs_assert(sgwc_ue);
97
-    }
98
-
99
-    if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
100
-        ogs_gtp_send_error_message(
101
-                s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
102
-                OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value);
103
-        return;
104
-    }
105
-
106
     /*****************************************
107
      * Check Mandatory/Conditional IE Missing
108
      *****************************************/
109
-    ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED);
110
+    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
111
 
112
     if (rsp->cause.presence == 0) {
113
         ogs_error("No Cause");
114
@@ -342,9 +311,14 @@
115
     }
116
 
117
     if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
118
-        ogs_gtp_send_error_message(
119
-                s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
120
-                OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value);
121
+        if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST)
122
+            ogs_gtp_send_error_message(
123
+                    s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
124
+                    OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
125
+        else
126
+            ogs_gtp_send_error_message(
127
+                    s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
128
+                    OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
129
         return;
130
     }
131
 
132
@@ -358,52 +332,67 @@
133
     cause_value = cause->value;
134
     if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
135
         ogs_error("GTP Failed CAUSE:%d", cause_value);
136
-        ogs_gtp_send_error_message(
137
-                s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
138
-                OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE, cause_value);
139
+        if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST)
140
+            ogs_gtp_send_error_message(
141
+                    s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
142
+                    OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE, cause_value);
143
+        else
144
+            ogs_gtp_send_error_message(
145
+                    s11_xact, sgwc_ue ? sgwc_ue->mme_s11_teid : 0,
146
+                    OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE, cause_value);
147
         return;
148
     }
149
 
150
     /********************
151
      * Check ALL Context
152
      ********************/
153
-    ogs_assert(sess);
154
     ogs_assert(sgwc_ue);
155
+    ogs_assert(sess);
156
 
157
-    /* Remove a pgw session */
158
     ogs_debug("    MME_S11_TEID%d SGW_S11_TEID%d",
159
         sgwc_ue->mme_s11_teid, sgwc_ue->sgw_s11_teid);
160
     ogs_debug("    SGW_S5C_TEID0x%x PGW_S5C_TEID0x%x",
161
         sess->sgw_s5c_teid, sess->pgw_s5c_teid);
162
 
163
-    /*
164
-     * 1. MME sends Delete Session Request to SGW/SMF.
165
-     * 2. SMF sends Delete Session Response to SGW/MME.
166
-     */
167
-    ogs_assert(OGS_OK ==
168
-        sgwc_pfcp_send_session_deletion_request(sess, s11_xact, gtpbuf));
169
+    if (modify_action == OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST) {
170
+        ogs_assert(OGS_OK ==
171
+            sgwc_gtp_send_create_session_response(sess, s11_xact));
172
+    } else {
173
+        message->h.type = OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE;
174
+        message->h.teid = sgwc_ue->mme_s11_teid;
175
+
176
+        pkbuf = ogs_gtp2_build_msg(message);
177
+        ogs_expect_or_return(pkbuf);
178
+
179
+        rv = ogs_gtp_xact_update_tx(s11_xact, &message->h, pkbuf);
180
+        ogs_expect_or_return(rv == OGS_OK);
181
+
182
+        rv = ogs_gtp_xact_commit(s11_xact);
183
+        ogs_expect(rv == OGS_OK);
184
+    }
185
 }
186
 
187
-void sgwc_s5c_handle_modify_bearer_response(
188
+void sgwc_s5c_handle_delete_session_response(
189
         sgwc_sess_t *sess, ogs_gtp_xact_t *s5c_xact,
190
         ogs_pkbuf_t *gtpbuf, ogs_gtp2_message_t *message)
191
 {
192
     int rv;
193
     ogs_gtp2_cause_t *cause = NULL;
194
     uint8_t cause_value;
195
-    int modify_action;
196
 
197
     sgwc_ue_t *sgwc_ue = NULL;
198
-    ogs_pkbuf_t *pkbuf = NULL;
199
 
200
     ogs_gtp_xact_t *s11_xact = NULL;
201
open5gs_2.4.8.202206271119.tar.xz/src/sgwc/sgwc-sm.c -> open5gs_2.4.8.202206281008.tar.xz/src/sgwc/sgwc-sm.c Changed
80
 
1
@@ -157,6 +157,13 @@
2
         if (gtp_message.h.teid_presence && gtp_message.h.teid != 0) {
3
             /* Cause is not "Context not found" */
4
             sgwc_ue = sgwc_ue_find_by_teid(gtp_message.h.teid);
5
+        } else if (gtp_xact->local_teid) { /* rx no TEID or TEID=0 */
6
+            /* 3GPP TS 29.274 5.5.2: we receive TEID=0 under some
7
+             * conditions, such as cause "Session context not found". In those
8
+             * cases, we still want to identify the local session which
9
+             * originated the message, so try harder by using the TEID we
10
+             * locally stored in xact when sending the original request: */
11
+            sgwc_ue = sgwc_ue_find_by_teid(gtp_xact->local_teid);
12
         }
13
 
14
         switch(gtp_message.h.type) {
15
@@ -185,14 +192,17 @@
16
                     sgwc_ue, gtp_xact, recvbuf, &gtp_message);
17
             break;
18
         case OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE:
19
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
20
             sgwc_s11_handle_create_bearer_response(
21
                     sgwc_ue, gtp_xact, recvbuf, &gtp_message);
22
             break;
23
         case OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE:
24
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
25
             sgwc_s11_handle_update_bearer_response(
26
                     sgwc_ue, gtp_xact, recvbuf, &gtp_message);
27
             break;
28
         case OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE:
29
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
30
             sgwc_s11_handle_delete_bearer_response(
31
                     sgwc_ue, gtp_xact, recvbuf, &gtp_message);
32
             break;
33
@@ -245,6 +255,13 @@
34
 
35
         if (gtp_message.h.teid_presence && gtp_message.h.teid != 0) {
36
             sess = sgwc_sess_find_by_teid(gtp_message.h.teid);
37
+        } else if (gtp_xact->local_teid) { /* rx no TEID or TEID=0 */
38
+            /* 3GPP TS 29.274 5.5.2: we receive TEID=0 under some
39
+             * conditions, such as cause "Session context not found". In those
40
+             * cases, we still want to identify the local session which
41
+             * originated the message, so try harder by using the TEID we
42
+             * locally stored in xact when sending the original request: */
43
+            sess = sgwc_sess_find_by_teid(gtp_xact->local_teid);
44
         }
45
 
46
         switch(gtp_message.h.type) {
47
@@ -255,17 +272,20 @@
48
             sgwc_handle_echo_response(gtp_xact, &gtp_message.echo_response);
49
             break;
50
         case OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE:
51
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
52
             sgwc_s5c_handle_create_session_response(
53
                     sess, gtp_xact, recvbuf, &gtp_message);
54
             break;
55
-        case OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE:
56
-            sgwc_s5c_handle_delete_session_response(
57
-                    sess, gtp_xact, recvbuf, &gtp_message);
58
-            break;
59
         case OGS_GTP2_MODIFY_BEARER_RESPONSE_TYPE:
60
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
61
             sgwc_s5c_handle_modify_bearer_response(
62
                     sess, gtp_xact, recvbuf, &gtp_message);
63
             break;
64
+        case OGS_GTP2_DELETE_SESSION_RESPONSE_TYPE:
65
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
66
+            sgwc_s5c_handle_delete_session_response(
67
+                    sess, gtp_xact, recvbuf, &gtp_message);
68
+            break;
69
         case OGS_GTP2_CREATE_BEARER_REQUEST_TYPE:
70
             sgwc_s5c_handle_create_bearer_request(
71
                     sess, gtp_xact, recvbuf, &gtp_message);
72
@@ -279,6 +299,7 @@
73
                     sess, gtp_xact, recvbuf, &gtp_message);
74
             break;
75
         case OGS_GTP2_BEARER_RESOURCE_FAILURE_INDICATION_TYPE:
76
+            if (!gtp_message.h.teid_presence) ogs_error("No TEID");
77
             sgwc_s5c_handle_bearer_resource_failure_indication(
78
                     sess, gtp_xact, recvbuf, &gtp_message);
79
             break;
80
open5gs_2.4.8.202206271119.tar.xz/src/sgwc/sxa-handler.c -> open5gs_2.4.8.202206281008.tar.xz/src/sgwc/sxa-handler.c Changed
128
 
1
@@ -157,6 +157,7 @@
2
 
3
     ogs_debug("Session Establishment Response");
4
 
5
+    ogs_assert(sess);
6
     ogs_assert(pfcp_xact);
7
     ogs_assert(pfcp_rsp);
8
     ogs_assert(recv_message);
9
@@ -171,11 +172,6 @@
10
 
11
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
12
 
13
-    if (!sess) {
14
-        ogs_warn("No Context");
15
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
16
-    }
17
-
18
     if (pfcp_rsp->up_f_seid.presence == 0) {
19
         ogs_error("No UP F-SEID");
20
         cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
21
@@ -382,6 +378,7 @@
22
         s5c_xact = ogs_gtp_xact_local_create(
23
                 sess->gnode, &send_message.h, pkbuf, sess_timeout, sess);
24
         ogs_expect_or_return(s5c_xact);
25
+        s5c_xact->local_teid = sess->sgw_s5c_teid;
26
 
27
         s5c_xact->modify_action = OGS_GTP_MODIFY_IN_PATH_SWITCH_REQUEST;
28
 
29
@@ -419,6 +416,7 @@
30
         s5c_xact = ogs_gtp_xact_local_create(
31
                 sess->gnode, &recv_message->h, pkbuf, sess_timeout, sess);
32
         ogs_expect_or_return(s5c_xact);
33
+        s5c_xact->local_teid = sess->sgw_s5c_teid;
34
     }
35
 
36
     ogs_gtp_xact_associate(s11_xact, s5c_xact);
37
@@ -451,6 +449,7 @@
38
 
39
     ogs_debug("Session Modification Response");
40
 
41
+    ogs_assert(sess);
42
     ogs_assert(pfcp_xact);
43
     ogs_assert(pfcp_rsp);
44
 
45
@@ -460,30 +459,12 @@
46
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
47
 
48
     if (flags & OGS_PFCP_MODIFY_SESSION) {
49
-        if (!sess) {
50
-            ogs_warn("No Context");
51
-
52
-            sess = pfcp_xact->data;
53
-            ogs_assert(sess);
54
-
55
-            cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
56
-        }
57
         sgwc_ue = sess->sgwc_ue;
58
         ogs_assert(sgwc_ue);
59
 
60
     } else {
61
         bearer = pfcp_xact->data;
62
         ogs_assert(bearer);
63
-
64
-        if (!sess) {
65
-            ogs_warn("No Context");
66
-
67
-            sess = bearer->sess;
68
-            ogs_assert(sess);
69
-
70
-            cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
71
-        }
72
-
73
         sgwc_ue = bearer->sgwc_ue;
74
         ogs_assert(sgwc_ue);
75
     }
76
@@ -752,6 +733,7 @@
77
             s11_xact = ogs_gtp_xact_local_create(sgwc_ue->gnode,
78
                     &recv_message->h, pkbuf, bearer_timeout, bearer);
79
             ogs_expect_or_return(s11_xact);
80
+            s11_xact->local_teid = sgwc_ue->sgw_s11_teid;
81
 
82
             ogs_gtp_xact_associate(s5c_xact, s11_xact);
83
 
84
@@ -1041,6 +1023,7 @@
85
                             sess->gnode, &recv_message->h, pkbuf,
86
                             sess_timeout, sess);
87
                     ogs_expect_or_return(s5c_xact);
88
+                    s5c_xact->local_teid = sess->sgw_s5c_teid;
89
 
90
                     ogs_gtp_xact_associate(s11_xact, s5c_xact);
91
 
92
@@ -1202,16 +1185,12 @@
93
 
94
     ogs_debug("Session Deletion Response");
95
 
96
+    ogs_assert(sess);
97
     ogs_assert(pfcp_xact);
98
     ogs_assert(pfcp_rsp);
99
 
100
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
101
 
102
-    if (!sess) {
103
-        ogs_warn("No Context");
104
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
105
-    }
106
-
107
     if (pfcp_rsp->cause.presence) {
108
         if (pfcp_rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
109
             ogs_warn("PFCP Cause%d : Not Accepted", pfcp_rsp->cause.u8);
110
@@ -1320,16 +1299,12 @@
111
 
112
     ogs_debug("Session Report Request");
113
 
114
+    ogs_assert(sess);
115
     ogs_assert(pfcp_xact);
116
     ogs_assert(pfcp_req);
117
 
118
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
119
 
120
-    if (!sess) {
121
-        ogs_warn("No Context");
122
-        cause_value = OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND;
123
-    }
124
-
125
     if (pfcp_req->report_type.presence == 0) {
126
         ogs_error("No Report Type");
127
         cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
128
open5gs_2.4.8.202206271119.tar.xz/src/smf/binding.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/binding.c Changed
17
 
1
@@ -369,6 +369,7 @@
2
                 xact = ogs_gtp_xact_local_create(
3
                         sess->gnode, &h, pkbuf, gtp_bearer_timeout, bearer);
4
                 ogs_expect_or_return(xact);
5
+                xact->local_teid = sess->smf_n4_teid;
6
 
7
                 if (ogs_list_count(&bearer->pf_to_add_list) > 0)
8
                     xact->update_flags |= OGS_GTP_MODIFY_TFT_UPDATE;
9
@@ -438,6 +439,7 @@
10
     xact = ogs_gtp_xact_local_create(
11
             sess->gnode, &h, pkbuf, gtp_bearer_timeout, bearer);
12
     ogs_expect_or_return_val(xact, OGS_ERROR);
13
+    xact->local_teid = sess->smf_n4_teid;
14
 
15
     rv = ogs_gtp_xact_commit(xact);
16
     ogs_expect(rv == OGS_OK);
17
open5gs_2.4.8.202206271119.tar.xz/src/smf/context.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/context.c Changed
9
 
1
@@ -1606,6 +1606,7 @@
2
     OGS_TLV_CLEAR_DATA(&sess->gtp.user_location_information);
3
     OGS_TLV_CLEAR_DATA(&sess->gtp.ue_timezone);
4
     OGS_TLV_CLEAR_DATA(&sess->gtp.charging_characteristics);
5
+    OGS_TLV_CLEAR_DATA(&sess->gtp.v1.qos);
6
 
7
     OGS_NAS_CLEAR_DATA(&sess->nas.ue_pco);
8
 
9
open5gs_2.4.8.202206271119.tar.xz/src/smf/context.h -> open5gs_2.4.8.202206281008.tar.xz/src/smf/context.h Changed
11
 
1
@@ -333,6 +333,9 @@
2
         uint8_t selection_mode; /* OGS_GTP{1,2}_SELECTION_MODE_*, same in GTPv1C and 2C. */
3
         struct {
4
             uint8_t nsapi;
5
+            ogs_gtp1_common_flags_t common_flags;
6
+            ogs_tlv_octet_t qos; /* Encoded GTPv1C "QoS Profile" IE */
7
+            ogs_gtp1_qos_profile_decoded_t qos_pdec;
8
             bool peer_supports_apn_ambr;
9
         } v1;  /* GTPv1C specific fields */
10
     } gtp; /* Saved from S5-C/Gn */
11
open5gs_2.4.8.202206271119.tar.xz/src/smf/gn-build.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/gn-build.c Changed
103
 
1
@@ -27,19 +27,10 @@
2
 static void build_qos_profile_from_session(ogs_gtp1_qos_profile_decoded_t *qos_pdec,
3
         const smf_sess_t *sess, const smf_bearer_t *bearer)
4
 {
5
-    memset(qos_pdec, 0, sizeof(*qos_pdec));
6
+    /* Initialize with defaults retrieved from MS/SGSN: */
7
+    memcpy(qos_pdec, &sess->gtp.v1.qos_pdec, sizeof(*qos_pdec));
8
 
9
     qos_pdec->qos_profile.arp = sess->session.qos.arp.priority_level;
10
-    qos_pdec->qos_profile.data.reliability_class = 3; /* Unacknowledged GTP and LLC; Acknowledged RLC, Protected data */
11
-    qos_pdec->qos_profile.data.precedence_class = 2; /* Normal priority */
12
-    qos_pdec->qos_profile.data.peak_throughput = 9; /* Up to 256 000 octet/s */
13
-    qos_pdec->qos_profile.data.mean_throughput = 0x1f; /* Best effort */
14
-    qos_pdec->qos_profile.data.delivery_erroneous_sdu = 2; /* Erroneous SDUs are delivered ('yes') */
15
-    qos_pdec->qos_profile.data.delivery_order = 2; /* Without delivery order ('no') */
16
-    qos_pdec->qos_profile.data.max_sdu_size = 0x96; /* 1500 octets */
17
-    qos_pdec->qos_profile.data.residual_ber = 5; /* 1*10^-4,  <= 2*10^-4 */
18
-    qos_pdec->qos_profile.data.sdu_error_ratio = 4; /* 1*10^-4 */
19
-
20
 
21
      /* 3GPP TS 23.401 Annex E table Table E.3 */
22
     /* Also take into account table 7 in 3GPP TS 23.107 9.1.2.2 */
23
@@ -102,6 +93,22 @@
24
     qos_pdec->dec_mbr_kbps_ul = sess->session.ambr.uplink / 1000;
25
     qos_pdec->dec_gbr_kbps_dl = bearer->qos.gbr.downlink / 1000;
26
     qos_pdec->dec_gbr_kbps_ul = bearer->qos.gbr.uplink / 1000;
27
+
28
+    /* Don't upgrade values if Common Flags "Upgrade QoS Supported" is 0: */
29
+    if (!sess->gtp.v1.common_flags.upgrade_qos_supported) {
30
+        if (sess->gtp.v1.qos_pdec.dec_mbr_kbps_dl > 0)
31
+            qos_pdec->dec_mbr_kbps_dl = ogs_min(qos_pdec->dec_mbr_kbps_dl,
32
+                                            sess->gtp.v1.qos_pdec.dec_mbr_kbps_dl);
33
+        if (sess->gtp.v1.qos_pdec.dec_mbr_kbps_ul > 0)
34
+            qos_pdec->dec_mbr_kbps_ul = ogs_min(qos_pdec->dec_mbr_kbps_ul,
35
+                                            sess->gtp.v1.qos_pdec.dec_mbr_kbps_ul);
36
+        if (sess->gtp.v1.qos_pdec.dec_gbr_kbps_dl > 0)
37
+            qos_pdec->dec_gbr_kbps_dl = ogs_min(qos_pdec->dec_gbr_kbps_dl,
38
+                                            sess->gtp.v1.qos_pdec.dec_gbr_kbps_dl);
39
+        if (sess->gtp.v1.qos_pdec.dec_gbr_kbps_ul > 0)
40
+            qos_pdec->dec_gbr_kbps_ul = ogs_min(qos_pdec->dec_gbr_kbps_ul,
41
+                                            sess->gtp.v1.qos_pdec.dec_gbr_kbps_ul);
42
+    }
43
 }
44
 
45
 ogs_pkbuf_t *smf_gn_build_create_pdp_context_response(
46
@@ -246,12 +253,16 @@
47
     rsp->ggsn_address_for_user_traffic.data = &pgw_gnu_gsnaddr;
48
     rsp->ggsn_address_for_user_traffic.len = gsn_len;
49
 
50
-    /* QoS Profile: if PCRF changes Bearer QoS, this should be included. */
51
+    /* QoS Profile: if PCRF changes Bearer QoS, apply changes. */
52
     if (sess->gtp.create_session_response_bearer_qos == true) {
53
         build_qos_profile_from_session(&qos_pdec, sess, bearer);
54
         rsp->quality_of_service_profile.presence = 1;
55
         ogs_gtp1_build_qos_profile(&rsp->quality_of_service_profile,
56
                &qos_pdec, qos_pdec_buf, OGS_GTP1_QOS_PROFILE_MAX_LEN);
57
+    } else {
58
+        /* Copy over received QoS Profile from originating Request: */
59
+        memcpy(&rsp->quality_of_service_profile, &sess->gtp.v1.qos,
60
+               sizeof(rsp->quality_of_service_profile));
61
     }
62
 
63
     /* TODO: Charging Gateway Address */
64
@@ -365,9 +376,14 @@
65
     rsp->charging_id.presence = 1;
66
     rsp->charging_id.u32 = sess->charging.id;
67
 
68
-    /* Protocol Configuration Options (PCO) */
69
-    if (sess->gtp.ue_pco.presence &&
70
-            sess->gtp.ue_pco.len && sess->gtp.ue_pco.data) {
71
+    /* Protocol Configuration Options (PCO):
72
+     * If the "No QoS negotiation" bit of the Common Flags IE in the Update PDP
73
+     * Context Request message was set to 1, then the GGSN ... shall not
74
+     * include the Protocol Configuration Options (PCO) information element in
75
+     * the message) */
76
+    if (!sess->gtp.v1.common_flags.no_qos_negotiation &&
77
+        sess->gtp.ue_pco.presence &&
78
+        sess->gtp.ue_pco.len && sess->gtp.ue_pco.data) {
79
         pco_len = smf_pco_build(
80
                 pco_buf, sess->gtp.ue_pco.data, sess->gtp.ue_pco.len);
81
         ogs_assert(pco_len > 0);
82
@@ -437,12 +453,18 @@
83
     rsp->ggsn_address_for_user_traffic.data = &pgw_gnu_gsnaddr;
84
     rsp->ggsn_address_for_user_traffic.len = gsn_len;
85
 
86
-    /* QoS Profile: if PCRF changes Bearer QoS, this should be included. */
87
-    if (sess->gtp.create_session_response_bearer_qos == true) {
88
+    /* QoS Profile: if SGSN supports QoS re-negotiation and PCRF changes Bearer
89
+     * QoS, apply changes: */
90
+    if (!sess->gtp.v1.common_flags.no_qos_negotiation &&
91
+        sess->gtp.create_session_response_bearer_qos == true) {
92
         build_qos_profile_from_session(&qos_pdec, sess, bearer);
93
         rsp->quality_of_service_profile.presence = 1;
94
         ogs_gtp1_build_qos_profile(&rsp->quality_of_service_profile,
95
                &qos_pdec, qos_pdec_buf, OGS_GTP1_QOS_PROFILE_MAX_LEN);
96
+    } else {
97
+        /* Copy over received QoS Profile from originating Request: */
98
+        memcpy(&rsp->quality_of_service_profile, &sess->gtp.v1.qos,
99
+               sizeof(rsp->quality_of_service_profile));
100
     }
101
 
102
    /* TODO: Charging Gateway Address */
103
open5gs_2.4.8.202206271119.tar.xz/src/smf/gn-handler.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/gn-handler.c Changed
140
 
1
@@ -62,7 +62,7 @@
2
     smf_ue_t *smf_ue = NULL;
3
     ogs_eua_t *eua = NULL;
4
     smf_bearer_t *bearer = NULL;
5
-    ogs_gtp1_qos_profile_decoded_t qos_pdec;
6
+    ogs_gtp1_qos_profile_decoded_t *qos_pdec;
7
     uint8_t qci = 9;
8
 
9
     ogs_assert(sess);
10
@@ -178,27 +178,33 @@
11
             smf_ue->msisdn, smf_ue->msisdn_len, smf_ue->msisdn_bcd);
12
     }
13
 
14
-    /* Set some sane default if infomation not present in Qos Profile or APN-AMBR: */
15
+    /* Common Flags 7.7.48 */
16
+    if (req->common_flags.presence) {
17
+        sess->gtp.v1.common_flags = *(ogs_gtp1_common_flags_t*)req->common_flags.data;
18
+    }
19
+
20
+    /* Set some sane default if information not present in QoS Profile or APN-AMBR: */
21
     sess->session.ambr.downlink = 102400000;
22
     sess->session.ambr.uplink = 102400000;
23
 
24
     /* Set Bearer QoS */
25
-    rv = ogs_gtp1_parse_qos_profile(&qos_pdec,
26
-        &req->quality_of_service_profile);
27
+    OGS_TLV_STORE_DATA(&sess->gtp.v1.qos, &req->quality_of_service_profile);
28
+    qos_pdec = &sess->gtp.v1.qos_pdec;
29
+    rv = ogs_gtp1_parse_qos_profile(qos_pdec, &req->quality_of_service_profile);
30
     if(rv < 0)
31
         return OGS_GTP1_CAUSE_MANDATORY_IE_INCORRECT;
32
 
33
     /* 3GPP TS 23.060 section 9.2.1A: "The QoS profiles of the PDP context and EPS bearer are mapped as specified in TS 23.401"
34
      * 3GPP TS 23.401 Annex E: "Mapping between EPS and Release 99 QoS parameters"
35
      */
36
-    ogs_gtp1_qos_profile_to_qci(&qos_pdec, &qci);
37
+    ogs_gtp1_qos_profile_to_qci(qos_pdec, &qci);
38
     sess->session.qos.index = qci;
39
-    sess->session.qos.arp.priority_level = qos_pdec.qos_profile.arp; /* 3GPP TS 23.401 Annex E Table E.2 */
40
+    sess->session.qos.arp.priority_level = qos_pdec->qos_profile.arp; /* 3GPP TS 23.401 Annex E Table E.2 */
41
     sess->session.qos.arp.pre_emption_capability = 0; /* ignored as per 3GPP TS 23.401 Annex E */
42
     sess->session.qos.arp.pre_emption_vulnerability = 0; /* ignored as per 3GPP TS 23.401 Annex E */
43
-    if (qos_pdec.data_octet6_to_13_present) {
44
-        sess->session.ambr.downlink = qos_pdec.dec_mbr_kbps_dl * 1000;
45
-        sess->session.ambr.uplink = qos_pdec.dec_mbr_kbps_ul * 1000;
46
+    if (qos_pdec->data_octet6_to_13_present) {
47
+        sess->session.ambr.downlink = qos_pdec->dec_mbr_kbps_dl * 1000;
48
+        sess->session.ambr.uplink = qos_pdec->dec_mbr_kbps_ul * 1000;
49
     }
50
 
51
     /* APN-AMBR, 7.7.98 */
52
@@ -266,9 +272,9 @@
53
     ogs_assert(rv == OGS_OK);
54
     ogs_debug("    SGW_S5U_TEID0x%x PGW_S5U_TEID0x%x",
55
             bearer->sgw_s5u_teid, bearer->pgw_s5u_teid);
56
-    if (qos_pdec.data_octet6_to_13_present) {
57
-        bearer->qos.gbr.downlink = qos_pdec.dec_gbr_kbps_dl * 1000;
58
-        bearer->qos.gbr.uplink = qos_pdec.dec_gbr_kbps_ul * 1000;
59
+    if (qos_pdec->data_octet6_to_13_present) {
60
+        bearer->qos.gbr.downlink = qos_pdec->dec_gbr_kbps_dl * 1000;
61
+        bearer->qos.gbr.uplink = qos_pdec->dec_gbr_kbps_ul * 1000;
62
     } else {
63
         /* Set some sane default if infomation not present in Qos Profile IE: */
64
         bearer->qos.gbr.downlink = sess->session.ambr.downlink;
65
@@ -324,6 +330,8 @@
66
     ogs_pfcp_pdr_t *pdr = NULL;
67
     smf_bearer_t *bearer = NULL;
68
     smf_ue_t *smf_ue = NULL;
69
+    ogs_gtp1_qos_profile_decoded_t *qos_pdec;
70
+    uint8_t qci;
71
 
72
     ogs_debug("Update PDP Context Request");
73
 
74
@@ -382,6 +390,14 @@
75
         }
76
     }
77
 
78
+    /* Common Flags 7.7.48 */
79
+    if (req->common_flags.presence) {
80
+        sess->gtp.v1.common_flags = *(ogs_gtp1_common_flags_t*)req->common_flags.data;
81
+    } else {
82
+        /* Reset it to overwrite what was received during CreatePDPCtxReq time */
83
+        sess->gtp.v1.common_flags = (ogs_gtp1_common_flags_t){0};
84
+    }
85
+
86
     /* Control Plane(DL) : SGW-S5C */
87
     if (req->tunnel_endpoint_identifier_control_plane.presence) {
88
         sess->sgw_s5c_teid = req->tunnel_endpoint_identifier_control_plane.u32;
89
@@ -402,6 +418,50 @@
90
     ogs_debug("    Updated SGW_S5U_TEID0x%x PGW_S5U_TEID0x%x",
91
             bearer->sgw_s5u_teid, bearer->pgw_s5u_teid);
92
 
93
+
94
+    /* Set Bearer QoS */
95
+    OGS_TLV_STORE_DATA(&sess->gtp.v1.qos, &req->quality_of_service_profile);
96
+    qos_pdec = &sess->gtp.v1.qos_pdec;
97
+    rv = ogs_gtp1_parse_qos_profile(qos_pdec, &req->quality_of_service_profile);
98
+    if(rv < 0) {
99
+        ogs_gtp1_send_error_message(xact, sess->sgw_s5c_teid,
100
+                OGS_GTP1_UPDATE_PDP_CONTEXT_RESPONSE_TYPE,
101
+                OGS_GTP1_CAUSE_MANDATORY_IE_INCORRECT);
102
+        return;
103
+    }
104
+
105
+    /* 3GPP TS 23.060 section 9.2.1A: "The QoS profiles of the PDP context and EPS bearer are mapped as specified in TS 23.401"
106
+     * 3GPP TS 23.401 Annex E: "Mapping between EPS and Release 99 QoS parameters"
107
+     */
108
+    ogs_gtp1_qos_profile_to_qci(qos_pdec, &qci);
109
+    sess->session.qos.index = qci;
110
+    sess->session.qos.arp.priority_level = qos_pdec->qos_profile.arp; /* 3GPP TS 23.401 Annex E Table E.2 */
111
+    sess->session.qos.arp.pre_emption_capability = 0; /* ignored as per 3GPP TS 23.401 Annex E */
112
+    sess->session.qos.arp.pre_emption_vulnerability = 0; /* ignored as per 3GPP TS 23.401 Annex E */
113
+    if (qos_pdec->data_octet6_to_13_present) {
114
+        sess->session.ambr.downlink = qos_pdec->dec_mbr_kbps_dl * 1000;
115
+        sess->session.ambr.uplink = qos_pdec->dec_mbr_kbps_ul * 1000;
116
+    }
117
+
118
+    /* APN-AMBR, 7.7.98 */
119
+    if (req->apn_ambr.presence) {
120
+        /* "The APN-AMBR IE shall be included as the authorized APN-AMBR if the
121
+         * GGSN supports this IE and if the APN-AMBR IE has been included in the
122
+         * corresponding request message." */
123
+        sess->gtp.v1.peer_supports_apn_ambr = true;
124
+        if (req->apn_ambr.len >= sizeof(ogs_gtp1_apn_ambr_t)) {
125
+            ogs_gtp1_apn_ambr_t *ambr = req->apn_ambr.data;
126
+            sess->session.ambr.uplink = be32toh(ambr->uplink) * 1000;
127
+            sess->session.ambr.downlink = be32toh(ambr->downlink) * 1000;
128
+        }
129
+    }
130
+
131
+    /* PCO */
132
+    if (req->protocol_configuration_options.presence) {
133
+        OGS_TLV_STORE_DATA(&sess->gtp.ue_pco,
134
+                &req->protocol_configuration_options);
135
+    }
136
+
137
     memset(&h, 0, sizeof(ogs_gtp2_header_t));
138
     h.type = OGS_GTP1_UPDATE_PDP_CONTEXT_RESPONSE_TYPE;
139
     h.teid = sess->sgw_s5c_teid;
140
open5gs_2.4.8.202206271119.tar.xz/src/smf/gtp-path.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/gtp-path.c Changed
9
 
1
@@ -542,6 +542,7 @@
2
     xact = ogs_gtp_xact_local_create(
3
             sess->gnode, &h, pkbuf, bearer_timeout, bearer);
4
     ogs_expect_or_return_val(xact, OGS_ERROR);
5
+    xact->local_teid = sess->smf_n4_teid;
6
 
7
     rv = ogs_gtp_xact_commit(xact);
8
     ogs_expect(rv == OGS_OK);
9
open5gs_2.4.8.202206271119.tar.xz/src/smf/n4-handler.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/n4-handler.c Changed
90
 
1
@@ -255,6 +255,7 @@
2
 
3
     ogs_debug("Session Modification Response 5gc");
4
 
5
+    ogs_assert(sess);
6
     ogs_assert(xact);
7
     ogs_assert(rsp);
8
 
9
@@ -279,11 +280,6 @@
10
 
11
     status = OGS_SBI_HTTP_STATUS_OK;
12
 
13
-    if (!sess) {
14
-        ogs_warn("No Context");
15
-        status = OGS_SBI_HTTP_STATUS_NOT_FOUND;
16
-    }
17
-
18
     if (rsp->cause.presence) {
19
         if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
20
             ogs_warn("PFCP Cause %d : Not Accepted", rsp->cause.u8);
21
@@ -624,10 +620,7 @@
22
 
23
     status = OGS_SBI_HTTP_STATUS_OK;
24
 
25
-    if (!sess) {
26
-        ogs_warn("No Context");
27
-        status = OGS_SBI_HTTP_STATUS_NOT_FOUND;
28
-    }
29
+    ogs_assert(sess);
30
 
31
     if (rsp->cause.presence) {
32
         if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
33
@@ -669,8 +662,6 @@
34
         return status;
35
     }
36
 
37
-    ogs_assert(sess);
38
-
39
     return status;
40
 }
41
 
42
@@ -803,6 +794,7 @@
43
 
44
     OGS_LIST(pdr_to_create_list);
45
 
46
+    ogs_assert(sess);
47
     ogs_assert(xact);
48
     ogs_assert(rsp);
49
 
50
@@ -831,11 +823,6 @@
51
 
52
     ogs_pfcp_xact_commit(xact);
53
 
54
-    if (!sess) {
55
-        ogs_error("No Context");
56
-        return;
57
-    }
58
-
59
     if (rsp->cause.presence) {
60
         if (rsp->cause.u8 != OGS_PFCP_CAUSE_REQUEST_ACCEPTED) {
61
             ogs_error("PFCP Cause %d : Not Accepted", rsp->cause.u8);
62
@@ -1111,6 +1098,7 @@
63
     uint16_t pdr_id = 0;
64
     unsigned int i;
65
 
66
+    ogs_assert(sess);
67
     ogs_assert(pfcp_xact);
68
     ogs_assert(pfcp_req);
69
 
70
@@ -1118,11 +1106,6 @@
71
 
72
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
73
 
74
-    if (!sess) {
75
-        ogs_warn("No Context");
76
-        cause_value = OGS_PFCP_CAUSE_SESSION_CONTEXT_NOT_FOUND;
77
-    }
78
-
79
     if (pfcp_req->report_type.presence == 0) {
80
         ogs_error("No Report Type");
81
         cause_value = OGS_GTP2_CAUSE_MANDATORY_IE_MISSING;
82
@@ -1135,7 +1118,6 @@
83
         return;
84
     }
85
 
86
-    ogs_assert(sess);
87
     report_type.value = pfcp_req->report_type.u8;
88
 
89
     if (report_type.downlink_data_report) {
90
open5gs_2.4.8.202206271119.tar.xz/src/smf/pfcp-path.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/pfcp-path.c Changed
50
 
1
@@ -329,6 +329,8 @@
2
     ogs_assert(sess);
3
     ogs_assert(xact);
4
 
5
+    xact->local_seid = sess->smf_n4_seid;
6
+
7
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
8
     h.type = OGS_PFCP_SESSION_MODIFICATION_REQUEST_TYPE;
9
     h.seid = sess->upf_n4_seid;
10
@@ -366,6 +368,7 @@
11
     ogs_expect_or_return_val(xact, OGS_ERROR);
12
 
13
     xact->assoc_stream = stream;
14
+    xact->local_seid = sess->smf_n4_seid;
15
 
16
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
17
     h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE;
18
@@ -450,6 +453,7 @@
19
 
20
     xact->assoc_stream = stream;
21
     xact->delete_trigger = trigger;
22
+    xact->local_seid = sess->smf_n4_seid;
23
 
24
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
25
     h.type = OGS_PFCP_SESSION_DELETION_REQUEST_TYPE;
26
@@ -482,6 +486,7 @@
27
 
28
     xact->epc = true; /* EPC PFCP transaction */
29
     xact->assoc_xact = gtp_xact;
30
+    xact->local_seid = sess->smf_n4_seid;
31
 
32
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
33
     h.type = OGS_PFCP_SESSION_ESTABLISHMENT_REQUEST_TYPE;
34
@@ -604,6 +609,7 @@
35
      * - Delete Bearer Request/Response with DEDICATED BEARER.
36
      */
37
     xact->assoc_xact = gtp_xact;
38
+    xact->local_seid = sess->smf_n4_seid;
39
 
40
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
41
     h.type = OGS_PFCP_SESSION_DELETION_REQUEST_TYPE;
42
@@ -683,6 +689,7 @@
43
     ogs_pfcp_header_t h;
44
 
45
     ogs_assert(xact);
46
+    xact->local_seid = sess->smf_n4_seid;
47
 
48
     memset(&h, 0, sizeof(ogs_pfcp_header_t));
49
     h.type = OGS_PFCP_SESSION_REPORT_RESPONSE_TYPE;
50
open5gs_2.4.8.202206271119.tar.xz/src/smf/pfcp-sm.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/pfcp-sm.c Changed
90
 
1
@@ -185,8 +185,16 @@
2
         xact = e->pfcp_xact;
3
         ogs_assert(xact);
4
 
5
-        if (message->h.seid_presence && message->h.seid != 0)
6
-            sess = smf_sess_find_by_seid(message->h.seid);
7
+        if (message->h.seid_presence && message->h.seid != 0) {
8
+               sess = smf_sess_find_by_seid(message->h.seid);
9
+        } else if (xact->local_seid) { /* rx no SEID or SEID=0 */
10
+            /* 3GPP TS 29.244 7.2.2.4.2: we receive SEID=0 under some
11
+             * conditions, such as cause "Session context not found". In those
12
+             * cases, we still want to identify the local session which
13
+             * originated the message, so try harder by using the SEID we
14
+             * locally stored in xact when sending the original request: */
15
+            sess = smf_sess_find_by_seid(xact->local_seid);
16
+        }
17
         if (sess)
18
             e->sess = sess;
19
 
20
@@ -212,30 +220,13 @@
21
                     &message->pfcp_association_setup_response);
22
             break;
23
         case OGS_PFCP_SESSION_ESTABLISHMENT_RESPONSE_TYPE:
24
-            if (!message->h.seid_presence)
25
-                ogs_error("No SEID");
26
-            if (!sess) {
27
-                ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
28
-                ogs_assert(gtp_xact);
29
-                if (gtp_xact->gtp_version == 1)
30
-                    ogs_gtp1_send_error_message(gtp_xact, 0,
31
-                            OGS_GTP1_CREATE_PDP_CONTEXT_RESPONSE_TYPE,
32
-                            OGS_GTP1_CAUSE_CONTEXT_NOT_FOUND);
33
-                else
34
-                    ogs_gtp2_send_error_message(gtp_xact, 0,
35
-                            OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
36
-                            OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
37
-                break;
38
-            }
39
+            if (!message->h.seid_presence) ogs_error("No SEID");
40
+            ogs_assert(sess);
41
             ogs_fsm_dispatch(&sess->sm, e);
42
             break;
43
 
44
         case OGS_PFCP_SESSION_MODIFICATION_RESPONSE_TYPE:
45
-            if (!message->h.seid_presence) {
46
-                ogs_error("No SEID");
47
-                break;
48
-            }
49
-
50
+            if (!message->h.seid_presence) ogs_error("No SEID");
51
             if (xact->epc)
52
                 smf_epc_n4_handle_session_modification_response(
53
                     sess, xact, e->gtp2_message,
54
@@ -246,32 +237,13 @@
55
             break;
56
 
57
         case OGS_PFCP_SESSION_DELETION_RESPONSE_TYPE:
58
-            if (!message->h.seid_presence)
59
-                ogs_error("No SEID");
60
-            if (!sess) {
61
-                ogs_gtp_xact_t *gtp_xact = xact->assoc_xact;
62
-                if (!gtp_xact)
63
-                        break;
64
-                if (gtp_xact->gtp_version == 1)
65
-                    ogs_gtp1_send_error_message(gtp_xact, 0,
66
-                            OGS_GTP1_CREATE_PDP_CONTEXT_RESPONSE_TYPE,
67
-                            OGS_GTP1_CAUSE_CONTEXT_NOT_FOUND);
68
-                else
69
-                    ogs_gtp2_send_error_message(gtp_xact, 0,
70
-                            OGS_GTP2_CREATE_SESSION_RESPONSE_TYPE,
71
-                            OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND);
72
-                break;
73
-            }
74
-
75
+            if (!message->h.seid_presence) ogs_error("No SEID");
76
+            ogs_assert(sess);
77
             ogs_fsm_dispatch(&sess->sm, e);
78
             break;
79
 
80
         case OGS_PFCP_SESSION_REPORT_REQUEST_TYPE:
81
-            if (!message->h.seid_presence) {
82
-                ogs_error("No SEID");
83
-                break;
84
-            }
85
-
86
+            if (!message->h.seid_presence) ogs_error("No SEID");
87
             smf_n4_handle_session_report_request(
88
                 sess, xact, &message->pfcp_session_report_request);
89
             break;
90
open5gs_2.4.8.202206271119.tar.xz/src/smf/s5c-handler.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/s5c-handler.c Changed
82
 
1
@@ -595,6 +595,7 @@
2
     smf_bearer_t *bearer = NULL;
3
     ogs_pfcp_far_t *dl_far = NULL;
4
 
5
+    ogs_assert(sess);
6
     ogs_assert(rsp);
7
 
8
     ogs_debug("Create Bearer Response");
9
@@ -614,11 +615,6 @@
10
      ************************/
11
     cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
12
 
13
-    if (!sess) {
14
-        ogs_error("No Context in TEID");
15
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
16
-    }
17
-
18
     if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
19
         ogs_assert(OGS_OK ==
20
             smf_epc_pfcp_send_one_bearer_modification_request(
21
@@ -770,6 +766,7 @@
22
     uint64_t pfcp_flags = 0;
23
     smf_bearer_t *bearer = NULL;
24
 
25
+    ogs_assert(sess);
26
     ogs_assert(rsp);
27
 
28
     ogs_debug("Update Bearer Response");
29
@@ -786,24 +783,10 @@
30
     rv = ogs_gtp_xact_commit(xact);
31
     ogs_expect(rv == OGS_OK);
32
 
33
-    /************************
34
-     * Check Session Context
35
-     ************************/
36
-    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
37
-
38
-    if (!sess) {
39
-        ogs_error("No Context in TEID");
40
-        cause_value = OGS_GTP2_CAUSE_CONTEXT_NOT_FOUND;
41
-    }
42
-
43
-    if (cause_value != OGS_GTP2_CAUSE_REQUEST_ACCEPTED) {
44
-        return;
45
-    }
46
-
47
     /*****************************************
48
      * Check Mandatory/Conditional IE Missing
49
      *****************************************/
50
-    ogs_assert(cause_value == OGS_GTP2_CAUSE_REQUEST_ACCEPTED);
51
+    cause_value = OGS_GTP2_CAUSE_REQUEST_ACCEPTED;
52
 
53
     if (rsp->bearer_contexts.presence == 0) {
54
         ogs_error("No Bearer");
55
@@ -887,6 +870,7 @@
56
     uint8_t cause_value;
57
     smf_bearer_t *bearer = NULL;
58
 
59
+    ogs_assert(sess);
60
     ogs_assert(rsp);
61
 
62
     ogs_debug("Delete Bearer Response");
63
@@ -901,18 +885,10 @@
64
     rv = ogs_gtp_xact_commit(xact);
65
     ogs_expect(rv == OGS_OK);
66
 
67
-    /************************
68
-     * Check Session Context
69
-     ************************/
70
-    if (!sess)
71
-        ogs_error("No Context in TEID");
72
-
73
     /********************
74
      * Check ALL Context
75
      ********************/
76
     ogs_assert(bearer);
77
-    sess = bearer->sess;
78
-    ogs_assert(sess);
79
 
80
     if (rsp->linked_eps_bearer_id.presence) {
81
         /*
82
open5gs_2.4.8.202206271119.tar.xz/src/smf/smf-sm.c -> open5gs_2.4.8.202206281008.tar.xz/src/smf/smf-sm.c Changed
41
 
1
@@ -115,8 +115,15 @@
2
         }
3
         e->gtp_xact = gtp_xact;
4
 
5
-        if (gtp2_message.h.teid != 0) {
6
+        if (gtp2_message.h.teid_presence && gtp2_message.h.teid != 0) {
7
             sess = smf_sess_find_by_teid(gtp2_message.h.teid);
8
+        } else if (gtp_xact->local_teid) { /* rx no TEID or TEID=0 */
9
+            /* 3GPP TS 29.274 5.5.2: we receive TEID=0 under some
10
+             * conditions, such as cause "Session context not found". In those
11
+             * cases, we still want to identify the local session which
12
+             * originated the message, so try harder by using the TEID we
13
+             * locally stored in xact when sending the original request: */
14
+            sess = smf_sess_find_by_teid(gtp_xact->local_teid);
15
         }
16
 
17
         switch(gtp2_message.h.type) {
18
@@ -161,18 +168,18 @@
19
                 sess, gtp_xact, recvbuf, &gtp2_message.modify_bearer_request);
20
             break;
21
         case OGS_GTP2_CREATE_BEARER_RESPONSE_TYPE:
22
+            if (!gtp2_message.h.teid_presence) ogs_error("No TEID");
23
             smf_s5c_handle_create_bearer_response(
24
                 sess, gtp_xact, &gtp2_message.create_bearer_response);
25
             break;
26
         case OGS_GTP2_UPDATE_BEARER_RESPONSE_TYPE:
27
+            if (!gtp2_message.h.teid_presence) ogs_error("No TEID");
28
             smf_s5c_handle_update_bearer_response(
29
                 sess, gtp_xact, &gtp2_message.update_bearer_response);
30
             break;
31
         case OGS_GTP2_DELETE_BEARER_RESPONSE_TYPE:
32
-            if (!sess) {
33
-                /* TODO: NACK the message */
34
-                break;
35
-            }
36
+            if (!gtp2_message.h.teid_presence) ogs_error("No TEID");
37
+            ogs_assert(sess);
38
             e->sess = sess;
39
             ogs_fsm_dispatch(&sess->sm, e);
40
             break;
41