blob: 7a7ff974a0aede77a1bcc382470cda594e4ce796 [file] [log] [blame]
Harald Welte379d45a2017-08-03 09:55:15 +02001module GGSN_Tests {
2
Harald Welte34b5a952019-05-27 11:54:11 +02003/* GGSN test suite in TTCN-3
4 * (C) 2017-2019 Harald Welte <laforge@gnumonks.org>
5 * (C) 2018-2019 sysmocom - s.f.m.c. GmbH
6 * All rights reserved.
7 *
8 * Released under the terms of GNU General Public License, Version 2 or
9 * (at your option) any later version.
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 */
13
14
Harald Welte94ade362017-08-04 00:36:55 +020015 import from General_Types all;
Harald Welte811651e2017-08-05 15:25:06 +020016 import from Osmocom_Types all;
Pau Espin Pedrolc04c69e2020-03-03 16:46:29 +010017 import from Misc_Helpers all;
Harald Welte94ade362017-08-04 00:36:55 +020018 import from IPL4asp_PortType all;
19 import from IPL4asp_Types all;
20 import from GTP_CodecPort all;
21 import from GTP_CodecPort_CtrlFunct all;
Harald Weltec69cf4e2018-02-17 20:57:02 +010022 import from GTP_Templates all;
Harald Welte94ade362017-08-04 00:36:55 +020023 import from GTPC_Types all;
24 import from GTPU_Types all;
Harald Welte71a36022017-12-04 18:55:58 +010025 import from IPCP_Types all;
Harald Weltef8298542019-04-10 10:15:28 +020026 import from PAP_Types all;
Harald Welte231b9412017-08-09 17:16:31 +020027 import from IP_Types all;
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +010028 import from ICMP_Types all;
Harald Welte231b9412017-08-09 17:16:31 +020029 import from ICMPv6_Types all;
Harald Welteddeecbb2017-08-18 22:53:30 +020030 import from Native_Functions all;
Stefan Sperlingc479e4f2018-04-03 19:34:16 +020031 import from Osmocom_VTY_Functions all;
32 import from TELNETasp_PortType all;
Harald Welte94ade362017-08-04 00:36:55 +020033
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +010034 import from DIAMETER_Types all;
35 import from DIAMETER_Templates all;
36 import from DIAMETER_Emulation all;
37
Harald Welte94ade362017-08-04 00:36:55 +020038 const integer GTP0_PORT := 3386;
39 const integer GTP1C_PORT := 2123;
40 const integer GTP1U_PORT := 2152;
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +010041 const integer PCRF_PORT := 3868;
Harald Welteddeecbb2017-08-18 22:53:30 +020042
Pau Espin Pedrolc1b1ddf2022-01-19 18:10:30 +010043 type enumerated GGSN_Impl {
44 GGSN_IMPL_OSMOCOM,
45 GGSN_IMPL_OPEN5GS
46 };
47
Harald Welteddeecbb2017-08-18 22:53:30 +020048 modulepar {
Stefan Sperlingcb782b92018-04-03 16:03:15 +020049 /* Default IP addresses. May be overridden by GGSN_Tests configuration files. */
50
51 /* The SGSN simulated by TTCN3 will bind to these addresses for GTP control and GTP user planes. */
Harald Welteddeecbb2017-08-18 22:53:30 +020052 charstring m_bind_ip_gtpc := "127.23.42.1";
53 charstring m_bind_ip_gtpu := "127.23.42.1";
54
Stefan Sperlingcb782b92018-04-03 16:03:15 +020055 /* Addresses the GGSN which is being tested is listening on for SGSN connections. */
Harald Welteddeecbb2017-08-18 22:53:30 +020056 charstring m_ggsn_ip_gtpc := "127.0.0.6";
57 charstring m_ggsn_ip_gtpu := "127.0.0.6";
Pau Espin Pedrolf69a4382018-01-29 13:09:00 +010058
Stefan Sperlingcb782b92018-04-03 16:03:15 +020059 /*
60 * Our tests expect to see these DNS servers in 'Create PDP context responses' sent by the GGSN.
61 * These addresses must therefore match 'ip[v6] dns' options configured in osmo-ggsn.conf.
62 *
63 * These addresses are not expected to serve actual DNS requests. However, tests may expect to be
64 * able to ping these addresses (currently, IPv4 addresses must respond with an ICMP 'echo reply',
65 * and IPv6 addresses may respond with either ICMPv6 'echo reply' or 'destination unreachable').
66 */
Pau Espin Pedrolf69a4382018-01-29 13:09:00 +010067 charstring m_ggsn_ip4_dns1 := "192.168.100.1"
68 charstring m_ggsn_ip4_dns2 := "8.8.8.8"
Pau Espin Pedrol363ba482018-01-29 18:42:00 +010069 charstring m_ggsn_ip6_dns1 := "2001:4860:4860::8888"
70 charstring m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
Stefan Sperlingcb782b92018-04-03 16:03:15 +020071
72 /*
73 * Additional address ranges are defined in osmo-ggsn.conf from which addresses are assigned
74 * to MS "behind" the simulated SGSN. These addresses appear on tun devices used by osmo-ggsn.
75 * The tests expect to be able to send ping packets between any two simulated MS within the same
76 * address range. This requires IP forwarding to be enabled on the corresponding tun interfaces.
77 */
Pau Espin Pedrolc1b1ddf2022-01-19 18:10:30 +010078
79 GGSN_Impl m_ggsn_impl := GGSN_IMPL_OSMOCOM;
Harald Welteddeecbb2017-08-18 22:53:30 +020080 }
Harald Welte94ade362017-08-04 00:36:55 +020081
Harald Welte811651e2017-08-05 15:25:06 +020082 type set PdpContext {
83 hexstring imsi,
84 octetstring msisdn optional,
85 octetstring apn,
Harald Welteed7a1772017-08-09 20:26:20 +020086 ProtConfigOptions pco_req optional,
87 ProtConfigOptions pco_neg optional,
Harald Welte811651e2017-08-05 15:25:06 +020088 EndUserAddress eua,
Harald Welte231b9412017-08-09 17:16:31 +020089 OCT16 ip6_prefix optional,
Harald Welte811651e2017-08-05 15:25:06 +020090 BIT4 nsapi,
91 /* TEI (Data) local side */
92 OCT4 teid,
93 /* TEI (Control) local side */
94 OCT4 teic,
95 /* TEI (Data) remote side */
96 OCT4 teid_remote,
97 /* TEI (Control) remote side */
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +010098 OCT4 teic_remote,
Pau Espin Pedrolca587f12022-02-02 10:42:01 +010099 OCT1 ratType optional,
100 UserLocationInformation uli optional
Harald Welte811651e2017-08-05 15:25:06 +0200101 }
102
Harald Welte94ade362017-08-04 00:36:55 +0200103 type component GT_CT {
104 port GTPC_PT GTPC;
105 port GTPU_PT GTPU;
106
Harald Welte0be142b2017-08-13 13:28:10 +0200107 var boolean g_initialized := false;
108
Harald Welte94ade362017-08-04 00:36:55 +0200109 var OCT1 g_restart_ctr := '01'O;
110 /* FIXME: unify with g_bind_ip + parse from config file */
Harald Welteddeecbb2017-08-18 22:53:30 +0200111 var OCT4 g_sgsn_ip_c;
112 var OCT4 g_sgsn_ip_u;
Harald Welte94ade362017-08-04 00:36:55 +0200113 /* FIXME: parse remName from config file */
Harald Welteddeecbb2017-08-18 22:53:30 +0200114 var GtpPeer g_peer_c := { connId := 0, remName := m_ggsn_ip_gtpc, remPort := GTP1C_PORT };
115 var GtpPeer g_peer_u := { connId := 0, remName := m_ggsn_ip_gtpu, remPort := GTP1U_PORT };
Harald Welte94ade362017-08-04 00:36:55 +0200116 timer T_default := 3.0;
Harald Welte5438b9d2017-08-13 13:27:48 +0200117
118 /* next to-be-sent GTP-C sequence number */
119 var uint16_t g_c_seq_nr;
120 /* next to-be-sent GTP-U sequence number */
121 var uint16_t g_d_seq_nr;
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200122
123 port TELNETasp_PT GGSNVTY;
Harald Welted2394e92018-04-26 10:21:49 +0200124 var boolean use_gtpu_txseq := false;
Pau Espin Pedrol05118022022-02-17 19:49:13 +0100125 var integer g_use_echo_intval := 0; /* 0 = disabled */
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100126
127 /* emulated PCRF, used with m_ggsn_impl = GGSN_IMPL_OPEN5GS */
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100128 var DIAMETER_Emulation_CT vc_Gx;
129 port DIAMETER_PT Gx_UNIT;
130 port DIAMETEREM_PROC_PT Gx_PROC;
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200131 }
132
133 private function f_init_vty() runs on GT_CT {
134 map(self:GGSNVTY, system:GGSNVTY);
135 f_vty_set_prompts(GGSNVTY);
136 f_vty_transceive(GGSNVTY, "enable");
137 }
138
139 private function f_vty_set_gpdu_txseq(boolean enable) runs on GT_CT {
140 f_vty_enter_config(GGSNVTY);
141 f_vty_transceive(GGSNVTY, "ggsn ggsn0");
Pau Espin Pedrol205a3842018-07-06 13:24:14 +0200142
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200143 f_vty_transceive(GGSNVTY, "apn internet");
144 if (enable) {
145 f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers");
146 } else {
147 f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers");
148 }
Pau Espin Pedrol205a3842018-07-06 13:24:14 +0200149 f_vty_transceive(GGSNVTY, "exit");
150
151 f_vty_transceive(GGSNVTY, "apn inet6");
152 if (enable) {
153 f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers");
154 } else {
155 f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers");
156 }
157 f_vty_transceive(GGSNVTY, "exit");
158
159 f_vty_transceive(GGSNVTY, "apn inet46");
160 if (enable) {
161 f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers");
162 } else {
163 f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers");
164 }
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200165 f_vty_transceive(GGSNVTY, "end");
166 }
167
168 private function f_verify_gtpu_txseq(in PDU_GTPU gtpu, in boolean expect_gptu_txseq) return boolean {
169 if (expect_gptu_txseq) {
170 if (gtpu.s_bit != '1'B) {
171 log("GTPU sequence number expected but not present")
172 return false;
173 }
174 } else {
175 if (gtpu.s_bit != '0'B) {
176 log("GTPU sequence number not expected but present")
177 return false;
178 }
179 }
180 return true;
Harald Welte94ade362017-08-04 00:36:55 +0200181 }
182
Pau Espin Pedrol05118022022-02-17 19:49:13 +0100183 private function f_vty_enable_echo_interval(integer intval_sec) runs on GT_CT {
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +0200184 f_vty_enter_config(GGSNVTY);
185 f_vty_transceive(GGSNVTY, "ggsn ggsn0");
Pau Espin Pedrol05118022022-02-17 19:49:13 +0100186 if (intval_sec > 0) {
187 f_vty_transceive(GGSNVTY, "echo-interval " & int2str(intval_sec));
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +0200188 } else {
189 f_vty_transceive(GGSNVTY, "no echo-interval");
190 }
191 f_vty_transceive(GGSNVTY, "end");
192 }
193
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100194 private function DiameterForwardUnitdataCallback(PDU_DIAMETER msg)
195 runs on DIAMETER_Emulation_CT return template PDU_DIAMETER {
196 DIAMETER_UNIT.send(msg);
197 return omit;
198 }
199
200 private function f_init_diameter(charstring id) runs on GT_CT {
201 var DIAMETEROps ops := {
202 create_cb := refers(DIAMETER_Emulation.ExpectedCreateCallback),
203 unitdata_cb := refers(DiameterForwardUnitdataCallback),
204 raw := true /* handler mode (single component for all IMSI)) */
205 };
206 var DIAMETER_conn_parameters pars := {
207 remote_ip := m_ggsn_ip_gtpc,
208 remote_sctp_port := -1,
209 local_ip := m_bind_ip_gtpc,
210 local_sctp_port := PCRF_PORT,
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100211 origin_host := "pcrf.localdomain",
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100212 origin_realm := "localdomain",
213 vendor_app_id := c_DIAMETER_3GPP_Gx_AID
214 };
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100215 vc_Gx := DIAMETER_Emulation_CT.create(id);
216 map(vc_Gx:DIAMETER, system:DIAMETER_CODEC_PT);
217 connect(vc_Gx:DIAMETER_UNIT, self:Gx_UNIT);
218 connect(vc_Gx:DIAMETER_PROC, self:Gx_PROC);
219 vc_Gx.start(DIAMETER_Emulation.main(ops, pars, id));
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100220
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100221 f_diameter_wait_capability(Gx_UNIT);
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100222 /* Give some time for our emulation to get out of SUSPECT list of SUT (3 watchdong ping-pongs):
223 * RFC6733 sec 5.1
224 * RFC3539 sec 3.4.1 [5]
225 * https://github.com/freeDiameter/freeDiameter/blob/master/libfdcore/p_psm.c#L49
226 */
227 f_sleep(1.0);
228 }
229
Harald Welte94ade362017-08-04 00:36:55 +0200230 function f_init() runs on GT_CT {
Harald Welte0be142b2017-08-13 13:28:10 +0200231 if (g_initialized == true) {
232 return;
233 }
234 g_initialized := true;
235
Harald Welteddeecbb2017-08-18 22:53:30 +0200236 g_sgsn_ip_c := f_inet_addr(m_bind_ip_gtpc);
237 g_sgsn_ip_u := f_inet_addr(m_bind_ip_gtpu);
238
Harald Welte94ade362017-08-04 00:36:55 +0200239 var Result res;
240 map(self:GTPC, system:GTPC);
Harald Welteddeecbb2017-08-18 22:53:30 +0200241 res := GTP_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, m_bind_ip_gtpc, GTP1C_PORT, {udp:={}});
Harald Welte94ade362017-08-04 00:36:55 +0200242 log("GTP1C ConnectionID: ", res.connId);
Harald Welte811651e2017-08-05 15:25:06 +0200243 g_peer_c.connId := res.connId;
Harald Welte94ade362017-08-04 00:36:55 +0200244
245 map(self:GTPU, system:GTPU);
Harald Welteddeecbb2017-08-18 22:53:30 +0200246 res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, m_bind_ip_gtpu, GTP1U_PORT, {udp:={}});
Harald Welte811651e2017-08-05 15:25:06 +0200247 g_peer_u.connId:= res.connId;
Harald Welte5438b9d2017-08-13 13:27:48 +0200248
249 g_restart_ctr := f_rnd_octstring(1);
Harald Welte11dbc7b2017-08-13 18:57:56 +0200250 g_c_seq_nr := f_rnd_int(65535);
251 g_d_seq_nr := f_rnd_int(65535);
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200252
Pau Espin Pedrolc1b1ddf2022-01-19 18:10:30 +0100253 if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) {
254 f_init_vty();
255 f_vty_set_gpdu_txseq(use_gtpu_txseq);
Pau Espin Pedrol05118022022-02-17 19:49:13 +0100256 f_vty_enable_echo_interval(g_use_echo_intval);
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100257 } else if (m_ggsn_impl == GGSN_IMPL_OPEN5GS) {
258 f_init_diameter(testcasename());
Pau Espin Pedrolc1b1ddf2022-01-19 18:10:30 +0100259 }
Harald Welte94ade362017-08-04 00:36:55 +0200260 }
261
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +0100262 function f_shutdown_helper() runs on GT_CT {
263 /* Sleep N3_REQUESTS * T3_REQUEST seconds, nowadays 5*3=15s.
264 * This ensures all retransmit queues are cleared before jumping
265 * into next tests, hence avoding situation where a test resuses
266 * a seqnum still in the GGSN's resp queue (dup req detector).
267 * See OS#5485 avout decreasing time. We could also add a new
268 * VTY command that calls gtp_clear_queues() */
269 f_sleep(15.0);
270 setverdict(pass);
271 }
272
Harald Welte94ade362017-08-04 00:36:55 +0200273 /* Altstep implementing responses to any incoming echo requests */
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100274 private altstep pingpong() runs on GT_CT {
Harald Welte94ade362017-08-04 00:36:55 +0200275 var Gtp1cUnitdata ud;
Harald Welte3af89482017-08-04 16:20:23 +0200276 var Gtp1uUnitdata udu;
Pau Espin Pedrol05118022022-02-17 19:49:13 +0100277 [g_use_echo_intval > 0] GTPC.receive(tr_GTPC_PING(?)) -> value ud {
Harald Welte811651e2017-08-05 15:25:06 +0200278 var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber);
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +0200279 GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr));
Harald Welte94ade362017-08-04 00:36:55 +0200280 repeat;
281 };
Pau Espin Pedrol05118022022-02-17 19:49:13 +0100282 [g_use_echo_intval == 0] GTPC.receive(tr_GTPC_PING(?)) {
Pau Espin Pedrolc04c69e2020-03-03 16:46:29 +0100283 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
284 "GTP Echo Req rceived but not enabled in VTY");
Harald Welte3af89482017-08-04 16:20:23 +0200285 };
Pau Espin Pedrolc04c69e2020-03-03 16:46:29 +0100286 [] T_default.timeout {
287 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
288 "pinpong T_default timeout");
289 };
Harald Welte94ade362017-08-04 00:36:55 +0200290 }
291
Harald Welte811651e2017-08-05 15:25:06 +0200292 /* 'internet' in DNS encoding */
Harald Welteed097432017-08-13 13:28:49 +0200293 const octetstring c_ApnInternet := '08696E7465726E6574'O;
294 const octetstring c_ApnInet6 := '05696E657436'O;
295 const octetstring c_ApnInet46 := '06696E65743436'O;
Harald Welte94ade362017-08-04 00:36:55 +0200296
Harald Welte811651e2017-08-05 15:25:06 +0200297 /* return random NSAPI */
298 function f_rnd_nsapi() return BIT4 {
299 return int2bit(f_rnd_int(16), 4);
300 }
301
302 /* return random TEI[DC] */
303 function f_rnd_tei() return OCT4 {
304 return int2oct(f_rnd_int(4294967296), 4);
305 }
306
307 /* define an (internal) representation of a PDP context */
308 template PdpContext t_DefinePDP(hexstring imsi, octetstring msisdn, octetstring apn,
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100309 EndUserAddress eua, OCT1 ratType := '02'O /* GERAN */) := {
Harald Welte811651e2017-08-05 15:25:06 +0200310 imsi := imsi,
311 msisdn := msisdn,
312 nsapi := f_rnd_nsapi(),
313 apn := apn,
Harald Welteed7a1772017-08-09 20:26:20 +0200314 pco_req := omit,
Harald Welte811651e2017-08-05 15:25:06 +0200315 eua := eua,
316 teid := f_rnd_tei(),
Pau Espin Pedrol38aeffb2022-02-01 20:46:29 +0100317 teic := f_rnd_tei(),
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100318 ratType := ratType,
319 uli := {
320 type_gtpc := '98'O,
321 lengthf := 0 /* filled in by encoder */,
322 geographicLocationType := '00'O /* CGI */,
323 geographicLocation := {
324 geographicLocationCGI := ts_GeographicLocationCGI('262'H, '42F'H, '0001'O, '0002'O)
325 }
326 }
Harald Welte811651e2017-08-05 15:25:06 +0200327 }
328
329 /* send GTP-C for a given context and increment sequence number */
Harald Welte41575e92017-08-13 13:49:57 +0200330 function f_send_gtpc(in template Gtp1cUnitdata data) runs on GT_CT {
Harald Welte811651e2017-08-05 15:25:06 +0200331 GTPC.send(data);
Harald Welte5438b9d2017-08-13 13:27:48 +0200332 g_c_seq_nr := g_c_seq_nr + 1;
Harald Welte811651e2017-08-05 15:25:06 +0200333 }
334
335 /* send GTP-U for a given context and increment sequence number */
Harald Welte231b9412017-08-09 17:16:31 +0200336 function f_send_gtpu(inout PdpContext ctx, in octetstring data) runs on GT_CT {
Harald Welte3e0b0392018-04-26 09:46:21 +0200337 if (use_gtpu_txseq) {
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200338 GTPU.send(ts_GTP1U_GPDU(g_peer_u, g_d_seq_nr, ctx.teid_remote, data));
339 g_d_seq_nr := g_d_seq_nr + 1;
340 } else {
341 GTPU.send(ts_GTP1U_GPDU(g_peer_u, omit, ctx.teid_remote, data));
342 }
Harald Welte811651e2017-08-05 15:25:06 +0200343 }
344
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100345 function f_handle_create_req(inout PdpContext ctx, in Gtp1cUnitdata ud, in template OCT1 exp_cause := '80'O) runs on GT_CT {
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200346 var CreatePDPContextResponse cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse;
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100347
348 if (not match(cpr.cause.causevalue, exp_cause)) {
349 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
350 "CreatePDPContextResp: cause expectancies didn't match");
351 }
352
353 if (cpr.cause.causevalue == '80'O) { /* Accepted */
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200354 /* Check if EUA type corresponds to requested type */
355 if (match(ctx.eua, t_EuaIPv4(?)) and
356 not match(cpr.endUserAddress, tr_EuaIPv4(?))){
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100357 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
358 "EUAv4 expectancies didn't match");
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200359 }
360 if (match(ctx.eua, t_EuaIPv6(?)) and
361 not match(cpr.endUserAddress, tr_EuaIPv6(?))) {
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100362 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
363 "EUAv6 expectancies didn't match");
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200364 }
365 if (match(ctx.eua, t_EuaIPv4v6(?, ?)) and
366 not match(cpr.endUserAddress, tr_EuaIPv4v6(?, ?))) {
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100367 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
368 "EUAv4v6 expectancies didn't match");
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200369 }
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100370 } else if (cpr.cause.causevalue == '81'O) { /* Cause: New PDP type due to network preference */
371 /* ETSI TS 129 060 7.3.2 Create PDP Context Response. OS#5449 */
372 /* This should only happen if EUA requested type is v4v6: */
373 if (not ischosen(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6)) {
374 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
375 "Cause not expected when requesting a non v4v6 EUA");
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200376 }
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100377 if (not match(cpr.endUserAddress, (tr_EuaIPv4(?), tr_EuaIPv6(?)))) {
378 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
379 "Cause not expected when requesting+receiving EUAv4v6");
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200380 }
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200381 } else {
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100382 if (ispresent(cpr.endUserAddress)) {
383 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
384 "EUA received on createPDPContextResponse cause=" & oct2str(cpr.cause.causevalue));
385 }
386 setverdict(pass);
387 return;
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200388 }
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100389
390 /* Check if PCO response corresponds to request */
391 if (ispresent(ctx.pco_req)) {
392 if (match(ctx.pco_req, ts_PCO_IPv4_DNS_CONT) and
393 not match(cpr.protConfigOptions, tr_PCO_IPv4_DNS_CONT_resp(?))) {
394 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
395 "IPv4 DNS Container requested, but missing");
396 }
397 if (match(ctx.pco_req, ts_PCO_IPv6_DNS) and
398 not match(cpr.protConfigOptions, tr_PCO_IPv6_DNS_resp(?))) {
399 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
400 "IPv6 DNS Container requested, but missing");
401 }
402 }
403 ctx.teid_remote := cpr.teidDataI.teidDataI;
404 ctx.teic_remote := cpr.teidControlPlane.teidControlPlane;
405 ctx.eua := cpr.endUserAddress;
406 ctx.pco_neg := cpr.protConfigOptions;
407 setverdict(pass);
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200408 }
409
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100410 function f_handle_update_req(inout PdpContext ctx, in Gtp1cUnitdata ud, in OCT1 exp_cause := '80'O) runs on GT_CT {
411 var UpdatePDPContextResponseGGSN upr := ud.gtpc.gtpc_pdu.updatePDPContextResponse.updatePDPContextResponseGGSN;
412 if (exp_cause == '80'O and exp_cause == upr.cause.causevalue) {
413 ctx.teid_remote := upr.teidDataI.teidDataI;
414 ctx.teic_remote := upr.teidControlPlane.teidControlPlane;
415 if (ispresent(upr.protConfigOptions)) {
416 ctx.pco_neg := upr.protConfigOptions;
417 }
418 setverdict(pass);
419 } else if (exp_cause != '80'O and exp_cause == upr.cause.causevalue) {
420 setverdict(pass);
421 } else {
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100422 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
423 "UpdatePDPContextResp: cause expectancies didn't match");
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100424 }
425 }
426
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100427 private altstep as_DIA_CCR(DCC_NONE_CC_Request_Type req_type) runs on GT_CT {
428 var PDU_DIAMETER rx_dia;
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100429 [] Gx_UNIT.receive(tr_DIA_CCR(req_type := req_type)) -> value rx_dia {
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100430 var template (omit) AVP avp;
431 var octetstring sess_id;
432 var AVP_Unsigned32 req_num;
433
434 avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_BASE_NONE_Session_Id);
435 sess_id := valueof(avp.avp_data.avp_BASE_NONE_Session_Id);
436
437 avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_DCC_NONE_CC_Request_Number);
438 req_num := valueof(avp.avp_data.avp_DCC_NONE_CC_Request_Number);
439
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100440 Gx_UNIT.send(ts_DIA_CCA(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id, sess_id,
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100441 req_type, req_num));
442 }
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100443 [] Gx_UNIT.receive(PDU_DIAMETER:?) -> value rx_dia {
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100444 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
445 log2str("Received unexpected DIAMETER ", rx_dia));
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100446 }
447 }
448
Harald Welte811651e2017-08-05 15:25:06 +0200449 /* send a PDP context activation */
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100450 function f_pdp_ctx_act(inout PdpContext ctx, template OCT1 exp_cause := '80'O) runs on GT_CT return CreatePDPContextResponse {
Harald Welte94ade362017-08-04 00:36:55 +0200451 var Gtp1cUnitdata ud;
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100452 var CreatePDPContextResponse cpr;
Harald Welte94ade362017-08-04 00:36:55 +0200453 var default d;
454
455 log("sending CreatePDP");
Harald Welte41575e92017-08-13 13:49:57 +0200456 f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx.imsi, g_restart_ctr,
Harald Welte811651e2017-08-05 15:25:06 +0200457 ctx.teid, ctx.teic, ctx.nsapi, ctx.eua, ctx.apn,
Pau Espin Pedrolca587f12022-02-02 10:42:01 +0100458 g_sgsn_ip_c, g_sgsn_ip_u, ctx.msisdn, ctx.pco_req, ctx.ratType, ctx.uli));
Harald Welte94ade362017-08-04 00:36:55 +0200459 T_default.start;
Harald Welte94ade362017-08-04 00:36:55 +0200460 d := activate(pingpong());
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100461 if (Gx_PROC.checkstate("Connected")) {
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100462 as_DIA_CCR(INITIAL_REQUEST);
463 }
Harald Welte94ade362017-08-04 00:36:55 +0200464 alt {
Harald Welte811651e2017-08-05 15:25:06 +0200465 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctx.teic)) -> value ud {
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +0200466 f_handle_create_req(ctx, ud, exp_cause);
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100467 cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse;
Harald Welte94ade362017-08-04 00:36:55 +0200468 }
469 }
470 deactivate(d);
Harald Welte811651e2017-08-05 15:25:06 +0200471 T_default.stop;
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +0100472 return cpr;
Harald Welte94ade362017-08-04 00:36:55 +0200473 }
474
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +0200475 function f_pdp_ctx_exp_del_req(PdpContext ctx, template (omit) OCT1 expect_cause := omit, boolean expect_teardown := false) runs on GT_CT {
476 var Gtp1cUnitdata ud;
477 var default d;
478
479 T_default.start;
480 d := activate(pingpong());
481 alt {
482 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctx.teic)) -> value ud {
483 if (istemplatekind(expect_cause, "omit") and not ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue)) {
484 setverdict(pass);
485 } else if (not istemplatekind(expect_cause, "omit") and
486 ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue) and
487 ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue == valueof(expect_cause)) {
488 setverdict(pass);
489 } else {
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100490 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
491 "DeletePDPContextReq: cause expectancies didn't match");
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +0200492 }
493
494 if (expect_teardown == ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.tearDownIndicator)) {
495 setverdict(pass);
496 } else {
497 setverdict(fail);
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100498 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
499 "DeletePDPContextReq: tearDownIndicator expectancies didn't match");
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +0200500 }
501 }
502 }
503 deactivate(d);
504 T_default.stop;
505 }
506
Pau Espin Pedrol10ec96e2022-02-09 17:03:15 +0100507 function f_pdp_ctx_del(PdpContext ctx, template BIT1 teardown_ind, OCT1 expect_causevalue := '80'O, boolean expect_diameter := true) runs on GT_CT {
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200508 var Gtp1cUnitdata ud;
509 var default d;
Pau Espin Pedrol9a5f42f2019-05-27 20:04:35 +0200510 var OCT4 expect_teid;
511
512 /* 3GPP TS 29.060 sec 7.3.6 specifies TEID used in response
513 message with cause value "Non existent" shall be zero. */
514 if (expect_causevalue == 'C0'O) {
515 expect_teid := '00000000'O;
516 } else {
517 expect_teid := ctx.teic;
518 }
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200519
Harald Welte41575e92017-08-13 13:49:57 +0200520 f_send_gtpc(ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, ctx.teic_remote, ctx.nsapi, teardown_ind));
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200521 T_default.start;
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200522 d := activate(pingpong());
Pau Espin Pedrol45d57022022-03-08 13:49:02 +0100523 if (Gx_PROC.checkstate("Connected") and expect_diameter) {
Pau Espin Pedrol0bcfd9d2022-02-02 11:01:35 +0100524 as_DIA_CCR(TERMINATION_REQUEST);
525 }
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200526 alt {
Pau Espin Pedrol9a5f42f2019-05-27 20:04:35 +0200527 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextResponse, expect_teid)) -> value ud {
528 if (ud.gtpc.gtpc_pdu.deletePDPContextResponse.cause.causevalue == expect_causevalue) {
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200529 setverdict(pass);
530 } else {
Pau Espin Pedrol8ad031a2022-02-16 17:33:43 +0100531 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
532 "DeletePDPContextResp: cause expectancies didn't match");
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200533 }
534 }
535 }
536 deactivate(d);
Harald Welte811651e2017-08-05 15:25:06 +0200537 T_default.stop;
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200538 }
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100539
540 /* send a Update PdP Context Request, expect Response */
541 function f_pdp_ctx_update(inout PdpContext ctx, OCT1 exp_cause := '80'O, template (omit) OCT4 new_teid := omit, template (omit) OCT4 new_teic := omit) runs on GT_CT {
542 var Gtp1cUnitdata ud;
543 var default d;
544
545 if (not istemplatekind(new_teid, "omit")) {
546 ctx.teid := valueof(new_teid);
547 }
548 if (not istemplatekind(new_teic, "omit")) {
549 ctx.teic := valueof(new_teic);
550 }
551
552 log("sending UpdatePDP");
553 f_send_gtpc(ts_GTPC_UpdatePDP(g_peer_c, ctx.teic_remote, g_c_seq_nr, ctx.imsi, g_restart_ctr,
554 ctx.teid, ctx.teic, ctx.nsapi, g_sgsn_ip_c, g_sgsn_ip_u,
555 ctx.pco_req, ctx.ratType, ctx.uli));
556 T_default.start;
557 d := activate(pingpong());
558 alt {
559 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, updatePDPContextResponse, ctx.teic)) -> value ud {
560 f_handle_update_req(ctx, ud, exp_cause);
561 }
562 }
563 deactivate(d);
564 T_default.stop;
565 }
566
Harald Welte811651e2017-08-05 15:25:06 +0200567 /* IPv6 router solicitation fe80::2 -> ff02::2 from 02:88:b5:1f:25:59 */
568 const octetstring c_router_solicit := '6000000000103afffe800000000000000000000000000002ff02000000000000000000000000000285009f2b0000000001010288b51f2559'O;
569 /* IPv6 neighbor solicitation fe80::2 -> ff02::1:ff00:2 from 02:88:b5:1f:25:59 */
570 const octetstring c_neigh_solicit:= '6000000000203afffe800000000000000000000000000002ff0200000000000000000001ff00000287009f9600000000fe80000000000000000000000000000201010288b51f2559'O;
Harald Weltef1e0d5a2017-08-05 08:51:22 +0200571
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200572 /* template for sending an ICMPv4 echo request */
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100573 template PDU_ICMP ts_ICMPv4_ERQ := {
574 echo := {
575 type_field := 8,
576 code := 0,
577 checksum := '0000'O,
578 identifier := '0345'O,
579 sequence_number := '0001'O,
580 data := ''O
581 }
582 }
583
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200584 /* template for receiving/matching an ICMPv4 echo request */
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +0100585 template PDU_ICMP tr_ICMPv4_ERQ := {
586 echo := {
587 type_field := 8,
588 code := 0,
589 checksum := ?,
590 identifier := ?,
591 sequence_number := ?,
592 data := ?
593 }
594 }
595
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200596 /* template for receiving/matching an ICMPv4 echo reply */
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100597 template PDU_ICMP tr_ICMPv4_ERP(template octetstring data := *) := {
598 echo_reply := {
599 type_field := 0,
600 code := 0,
601 checksum := ?,
602 identifier := ?,
603 sequence_number := ?,
604 data := data
605 }
606 }
607
608 /* template for receiving/matching an ICMPv6 Destination Unreachable */
609 template PDU_ICMP tr_ICMPv4_DU := {
610 destination_unreachable := {
611 type_field := 1,
612 code := ?,
613 checksum := ?,
614 unused := ?,
615 original_ip_msg := ?
616 }
617 }
618
619 /* template to construct IPv4_packet from input arguments, ready for use in f_IPv4_enc() */
620 template IPv4_packet ts_IP4(OCT4 srcaddr, OCT4 dstaddr, LIN1 proto, LIN2_BO_LAST tlen, octetstring payload) := {
621 header := {
622 ver := 4,
623 hlen := 5,
624 tos := 0,
625 tlen := tlen,
626 id := 35902,
627 res := '0'B,
628 dfrag := '1'B,
629 mfrag := '0'B,
630 foffset := 0,
631 ttl := 64,
632 proto := proto,
633 cksum := 0,
634 srcaddr := srcaddr,
635 dstaddr := dstaddr
636 },
637 ext_headers := omit,
638 payload := payload
639 }
640
Harald Welte231b9412017-08-09 17:16:31 +0200641 /* template to generate a 'Prefix Information' ICMPv6 option */
642 template OptionField ts_ICMP6_OptPrefix(OCT16 prefix, INT1 prefix_len) := {
643 prefixInformation := {
644 typeField := 3,
645 lengthIndicator := 8,
646 prefixLength := prefix_len,
647 reserved1 := '000000'B,
648 a_Bit := '0'B,
649 l_Bit := '0'B,
650 validLifetime := oct2int('FFFFFFFF'O),
651 preferredLifetime := oct2int('FFFFFFFF'O),
652 reserved2 := '00000000'O,
653 prefix := prefix
654 }
655 }
656
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200657 /* template for sending an ICMPv6 echo request */
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100658 template PDU_ICMPv6 ts_ICMPv6_ERQ := {
659 echoRequest := {
660 typeField := 128,
661 code := 0,
662 checksum := '0000'O,
663 identifier := 0,
664 sequenceNr := 0,
665 data := ''O
666 }
667 }
668
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200669 /* template for sending an ICMPv6 router solicitation */
Harald Welte231b9412017-08-09 17:16:31 +0200670 template PDU_ICMPv6 ts_ICMPv6_RS := {
671 routerSolicitation := {
672 typeField := 133,
673 code := 0,
674 checksum := '0000'O,
675 reserved := '00000000'O,
676 /* TODO: do we need 'Source link-layer address' ? */
677 options := omit
678 }
679 }
680
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200681 /* template for sending an ICMPv6 router advertisement */
Harald Welte231b9412017-08-09 17:16:31 +0200682 template PDU_ICMPv6 ts_ICMPv6_RA(OCT16 prefix, INT1 prefix_len) := {
683 routerAdvertisement := {
684 typeField := 134,
685 code := 0,
686 checksum := '0000'O,
687 curHopLimit := ?,
688 reserved := '000000'B,
689 o_Bit := '0'B,
690 m_Bit := '0'B,
691 routerLifetime := oct2int('FFFF'O),
692 reachableTime := oct2int('FFFFFFFF'O),
693 retransTimer := oct2int('FFFFFFFF'O),
694 options := {
695 ts_ICMP6_OptPrefix(prefix, prefix_len)
696 }
697 }
698 }
699
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200700 /* template for sending an ICMPv6 neighbor solicitation */
Harald Welte231b9412017-08-09 17:16:31 +0200701 template PDU_ICMPv6 ts_ICMPv6_NS(OCT16 target_addr) := {
702 neighborSolicitation := {
703 typeField := 135,
704 code := 0,
705 checksum := '0000'O,
706 reserved := '00000000'O,
707 targetAddress := target_addr,
708 /* TODO: do we need 'Source link-layer address' ? */
709 options := omit
710 }
711 }
712
713 /* derive ICMPv6 link-local address from lower 64bit of link_id */
714 /* template for receiving/matching an ICMPv6 'Prefix Information' option */
715 template OptionField tr_ICMP6_OptPrefix(template OCT16 prefix, template INT1 prefix_len) := {
716 prefixInformation := {
717 typeField := 3,
718 lengthIndicator := 4,
719 prefixLength := prefix_len,
720 reserved1 := ?,
721 a_Bit := ?,
722 l_Bit := ?,
723 validLifetime := ?,
724 preferredLifetime := ?,
725 reserved2 := ?,
726 prefix := prefix
727 }
728 }
729
730 /* template for receiving/matching an ICMPv6 router advertisement */
731 template PDU_ICMPv6 tr_ICMPv6_RA(template OCT16 prefix, template INT1 prefix_len) := {
732 routerAdvertisement := {
733 typeField := 134,
734 code := 0,
735 checksum := ?,
736 curHopLimit := ?,
737 reserved := ?,
738 o_Bit := '0'B,
739 m_Bit := '0'B,
740 routerLifetime := ?,
741 reachableTime := ?,
742 retransTimer := ?,
743 options := {
744 tr_ICMP6_OptPrefix(prefix, prefix_len)
745 }
746 }
747 }
748
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100749 /* template for receiving/matching an ICMPv6 Destination Unreachable */
750 template PDU_ICMPv6 tr_ICMPv6_DU := {
751 destinationUnreachable := {
752 typeField := 1,
753 code := ?,
754 checksum := ?,
755 unused := ?,
756 originalIpMsg := ?
757 }
758 }
759
Stefan Sperling6cd217e2018-03-30 15:17:34 +0200760 /* template for receiving/matching an ICMPv6 echo request */
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +0100761 template PDU_ICMPv6 tr_ICMPv6_ERQ := {
762 echoRequest := {
763 typeField := 128,
764 code := 0,
765 checksum := ?,
766 identifier := ?,
767 sequenceNr := ?,
768 data := ?
769 }
770 }
771
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100772 /* template for receiving/matching an ICMPv6 echo reply */
773 template PDU_ICMPv6 tr_ICMPv6_ERP(template octetstring data := *) := {
774 echoReply := {
775 typeField := 129,
776 code := 0,
777 checksum := ?,
778 identifier := ?,
779 sequenceNr := ?,
780 data := data
781 }
782 }
783
Harald Welte231b9412017-08-09 17:16:31 +0200784 /* template to construct IPv6_packet from input arguments, ready for use in f_IPv6_enc() */
785 template IPv6_packet ts_IP6(OCT16 srcaddr, OCT16 dstaddr, LIN1 nexthead, octetstring payload, LIN1 hlim := 255) := {
786 header := {
787 ver := 6,
788 trclass := 0,
789 flabel := 0,
790 plen := 0,
791 nexthead := nexthead,
792 hlim := hlim,
793 srcaddr := srcaddr,
794 dstaddr := dstaddr
795 },
796 ext_headers := omit,
797 payload := payload
798 }
799
800 function f_ipv6_link_local(in OCT16 link_id) return OCT16 {
801 return 'FE80000000000000'O & substr(link_id, 8, 8);
802 }
803
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100804 function f_ipv6_global(in OCT16 link_id) return OCT16 {
805 return substr(link_id, 0, 8) & '1234123412341234'O;
806 }
807
808 /* Create a new different IPv6 addr from input. Starts mangling at byte prefix. */
809 function f_ipv6_mangle(in OCT16 addr, in integer prefix := 0) return OCT16 {
810 var integer i;
811 var octetstring res := substr(addr, 0, prefix);
812 for (i := prefix; i < lengthof(addr); i := i + 1) {
813 var octetstring a := addr[i] xor4b '11'O;
814 res := res & a;
815 }
816 return res;
817 }
818
Harald Welte231b9412017-08-09 17:16:31 +0200819 /* Compute solicited-node multicast address as per RFC4291 2.7.1 */
820 function f_ipv6_sol_node_mcast(in OCT16 addr) return OCT16 {
821 return 'FF0200000000000000000001FF'O & substr(addr, 13, 3);
822 }
823
824 /* generate and encode ICMPv6 router solicitation */
825 function f_gen_icmpv6_router_solicitation(in OCT16 link_id) return octetstring {
826 const OCT16 c_ip6_all_router_mcast := 'FF020000000000000000000000000002'O;
827 var OCT16 saddr := f_ipv6_link_local(link_id);
828
829 var octetstring tmp;
830 tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_RS), saddr, c_ip6_all_router_mcast);
831 var IPv6_packet ip6 := valueof(ts_IP6(saddr, c_ip6_all_router_mcast, 58, tmp));
832
833 return f_IPv6_enc(ip6);
834 }
835
Pau Espin Pedrol57604212022-02-14 16:54:18 +0100836 /* Get link-id from PDP Context EUA */
837 function f_ctx_get_ipv6_interface_id(in PdpContext ctx) return OCT16 {
838 var OCT16 interface_id;
839 if (ischosen(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6)) {
840 interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address;
841 } else if (ischosen(ctx.eua.endUserAddress.endUserAddressIPv6)) {
842 interface_id := ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address;
843 } else {
844 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected request to submit icmpv6 rs in IPv4 PDP context");
845 }
846 return interface_id;
847 }
848
Harald Welte231b9412017-08-09 17:16:31 +0200849 /* create ICMPv6 router solicitation deriving link-id from PDP Context EUA */
850 function f_icmpv6_rs_for_pdp(in PdpContext ctx) return octetstring {
Pau Espin Pedrol57604212022-02-14 16:54:18 +0100851 var OCT16 interface_id := f_ctx_get_ipv6_interface_id(ctx);
Harald Welte231b9412017-08-09 17:16:31 +0200852 return f_gen_icmpv6_router_solicitation(interface_id);
853 }
854
855 /* generate and encode ICMPv6 neighbor solicitation */
856 function f_gen_icmpv6_neigh_solicit(in OCT16 saddr, in OCT16 daddr, in OCT16 tgt_addr) return octetstring {
857 var octetstring tmp;
858 tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_NS(tgt_addr)), saddr, daddr);
859 var IPv6_packet ip6 := valueof(ts_IP6(saddr, daddr, 58, tmp));
860 return f_IPv6_enc(ip6);
861 }
862
863 /* generate and encode ICMPv6 neighbor solicitation for PDP Context */
864 function f_gen_icmpv6_neigh_solicit_for_pdp(in PdpContext ctx) return octetstring {
Pau Espin Pedrol57604212022-02-14 16:54:18 +0100865 var OCT16 interface_id := f_ctx_get_ipv6_interface_id(ctx);
Harald Welte231b9412017-08-09 17:16:31 +0200866 var OCT16 link_local := f_ipv6_link_local(interface_id);
867 var OCT16 daddr := f_ipv6_sol_node_mcast(link_local);
868
869 return f_gen_icmpv6_neigh_solicit(link_local, daddr, link_local);
870 }
871
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100872 /* Send an ICMPv4 echo msg through GTP given pdp ctx, and ip src and dst addr */
873 function f_gen_icmpv4_echo(OCT4 saddr, OCT4 daddr) return octetstring {
874 var octetstring tmp := f_enc_PDU_ICMP(valueof(ts_ICMPv4_ERQ));
875 var IPv4_packet ip4 := valueof(ts_IP4(saddr, daddr, 1, 50, tmp));
876 var octetstring data := f_IPv4_enc(ip4);
877 var OCT2 cksum := f_IPv4_checksum(data);
878 data[10] := cksum[0];
879 data[11] := cksum[1];
880 return data;
881 }
882
883 /* Send an ICMPv6 echo msg through GTP given pdp ctx, and ip src and dst addr */
884 function f_gen_icmpv6_echo(OCT16 saddr, OCT16 daddr) return octetstring {
885 var octetstring tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_ERQ), saddr, daddr);
886 var IPv6_packet ip6 := valueof(ts_IP6(saddr, daddr, 58, tmp));
887 var octetstring data := f_IPv6_enc(ip6);
888 return data;
889 }
890
891 /* Wait for ICMPv4 from GTP */
892 function f_wait_icmp4(PdpContext ctx, template PDU_ICMP expected) runs on GT_CT {
Harald Welte231b9412017-08-09 17:16:31 +0200893 var Gtp1uUnitdata ud;
894 T_default.start;
895 alt {
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100896 [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ctx.teid)) -> value ud {
Harald Welte3e0b0392018-04-26 09:46:21 +0200897 if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == false) {
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200898 setverdict(fail);
899 stop;
900 }
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100901 var octetstring gpdu := ud.gtpu.gtpu_IEs.g_PDU_IEs.data;
902 var IPv4_packet ip4 := f_IPv4_dec(gpdu);
903 if (ip4.header.ver != 4) {
904 repeat;
905 }
906 var PDU_ICMP icmp4 := f_dec_PDU_ICMP(ip4.payload);
907 if (not match(icmp4, expected)) {
908 repeat;
909 }
910 }
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +0100911 [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud {
912 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
913 "Received wrong local TEID");
914 }
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100915 [] GTPU.receive { setverdict(fail); }
916 [] T_default.timeout { setverdict(fail); }
917 }
918 T_default.stop;
919 }
920
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +0100921 /* Wait for ICMPv4 echo request from GTP */
922 function f_wait_icmp4_echo_request(PdpContext ctx) runs on GT_CT {
923 f_wait_icmp4(ctx, tr_ICMPv4_ERQ);
924 }
925
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100926 /* Wait for ICMPv4 echo reply (or unreachable) from GTP */
927 function f_wait_icmp4_echo_reply(PdpContext ctx) runs on GT_CT {
928 f_wait_icmp4(ctx, (tr_ICMPv4_ERP, tr_ICMPv4_DU));
929 }
930
931 /* Wait for ICMPv6 from GTP */
932 function f_wait_icmp6(PdpContext ctx, template PDU_ICMPv6 expected) runs on GT_CT {
933 var Gtp1uUnitdata ud;
934 T_default.start;
935 alt {
Harald Welte231b9412017-08-09 17:16:31 +0200936 [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud {
Harald Welte3e0b0392018-04-26 09:46:21 +0200937 if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == false) {
Stefan Sperlingc479e4f2018-04-03 19:34:16 +0200938 setverdict(fail);
939 stop;
940 }
Harald Welte231b9412017-08-09 17:16:31 +0200941 var octetstring gpdu := ud.gtpu.gtpu_IEs.g_PDU_IEs.data;
942 var IPv6_packet ip6 := f_IPv6_dec(gpdu);
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100943 if (ip6.header.ver != 6 or ip6.header.nexthead != 58) {
Harald Welte231b9412017-08-09 17:16:31 +0200944 repeat;
945 }
946 var PDU_ICMPv6 icmp6 := f_dec_PDU_ICMPv6(ip6.payload);
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100947 if (not match(icmp6, expected)) {
Harald Welte231b9412017-08-09 17:16:31 +0200948 repeat;
949 }
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100950 /* We are waiting for RA, update ctx */
951 if (match(icmp6, tr_ICMPv6_RA(?, 64))) {
952 ctx.ip6_prefix := icmp6.routerAdvertisement.options[0].prefixInformation.prefix;
953 log("RA with /64 prefix ", ctx.ip6_prefix);
954 }
Harald Welte231b9412017-08-09 17:16:31 +0200955 }
956 [] GTPU.receive(tr_GTPU_GPDU(?, ?)) { repeat; }
957 [] GTPU.receive { setverdict(fail); }
958 [] T_default.timeout { setverdict(fail); }
959 }
960 T_default.stop;
961 }
962
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100963 /* wait for GGSN to send us an ICMPv6 router advertisement */
964 function f_wait_rtr_adv(PdpContext ctx) runs on GT_CT {
965 f_wait_icmp6(ctx, tr_ICMPv6_RA(?, 64));
966 }
967
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +0100968 /* Wait for ICMPv6 echo request from GTP */
969 function f_wait_icmp6_echo_request(PdpContext ctx) runs on GT_CT {
970 f_wait_icmp6(ctx, tr_ICMPv6_ERQ);
971 }
972
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100973 /* Wait for ICMPv6 echo reply (or unreachable) from GTP */
974 function f_wait_icmp6_echo_reply(PdpContext ctx) runs on GT_CT {
975 f_wait_icmp6(ctx, (tr_ICMPv6_ERP,tr_ICMPv6_DU));
976 }
977
Oliver Smithee6a0882019-03-08 11:05:46 +0100978 /* create ICMPv6 router solicitation deriving link-id from PDP Context EUA */
979 function f_icmpv6_rs_for_pdp46(in PdpContext ctx) return octetstring {
980 var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address;
981 return f_gen_icmpv6_router_solicitation(interface_id);
982 }
983
984 /* generate and encode ICMPv6 neighbor solicitation for PDP Context */
985 function f_gen_icmpv6_neigh_solicit_for_pdp46(in PdpContext ctx) return octetstring {
986 var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address;
987 var OCT16 link_local := f_ipv6_link_local(interface_id);
988 var OCT16 daddr := f_ipv6_sol_node_mcast(link_local);
989
990 return f_gen_icmpv6_neigh_solicit(link_local, daddr, link_local);
991 }
992
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +0100993 /* Assert we don't receive a ICMPv4/6 echo reply (or unreachable) from GTP */
994 function f_wait_gtpu_fail(PdpContext ctx) runs on GT_CT {
995 T_default.start;
996 alt {
997 [] GTPU.receive { setverdict(fail); }
998 [] T_default.timeout { }
999 }
1000 T_default.stop;
1001 }
1002
Harald Welte79737b42019-04-10 10:39:30 +02001003 /* list of protocols where we don't accept duplicates */
1004 const OCT2List protocol_ids_nodupes := { 'C021'O, 'C023'O, 'C223'O, '8021'O };
1005 private function f_PCO_permits_duplicates(OCT2 id) return boolean {
1006 var integer i;
1007 for (i := 0; i < lengthof(protocol_ids_nodupes); i := i+1) {
1008 if (id == protocol_ids_nodupes[i]) {
1009 return false;
1010 }
1011 }
1012 return true;
1013 }
1014
1015 /* ensure that every given protocol Identifier exist only exactly once in the PCO */
1016 function f_PCO_ensure_no_duplicates(ProtConfigOptions pco) {
1017 var OCT2List protocol_ids := {};
1018 var integer i, j;
1019 for (i := 0; i < lengthof(pco.protocols); i := i+1) {
1020 var OCT2 id := pco.protocols[i].protocolID;
1021 for (j := 0; j < lengthof(protocol_ids); j := j+1) {
1022 if (not f_PCO_permits_duplicates(id) and id == protocol_ids[j]) {
1023 setverdict(fail, "Duplicate ProtocolID ", id, " already present in ", pco.protocols);
1024 }
1025 }
1026 protocol_ids := protocol_ids & { id };
1027 }
1028 }
1029
Harald Welte0ef285b2017-08-13 20:06:01 +02001030 /* Test IPv6 context activation for dynamic IPv6 EUA without request of IPv6 DNS */
Harald Welteed7a1772017-08-09 20:26:20 +02001031 testcase TC_pdp6_act_deact() runs on GT_CT {
Harald Welte94ade362017-08-04 00:36:55 +02001032 f_init();
Harald Welte231b9412017-08-09 17:16:31 +02001033
Harald Welteed097432017-08-13 13:28:49 +02001034 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
Harald Welte811651e2017-08-05 15:25:06 +02001035 f_pdp_ctx_act(ctx);
Harald Welteed7a1772017-08-09 20:26:20 +02001036 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001037 f_shutdown_helper();
Harald Welteed7a1772017-08-09 20:26:20 +02001038 }
1039
Harald Welte0ef285b2017-08-13 20:06:01 +02001040 /* Test IPv6 context activation for dynamic IPv6 EUA wirh request of IPv6 DNS in PCO */
Harald Welteed7a1772017-08-09 20:26:20 +02001041 testcase TC_pdp6_act_deact_pcodns() runs on GT_CT {
1042 f_init();
1043
Harald Welteed097432017-08-13 13:28:49 +02001044 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
Harald Welteed7a1772017-08-09 20:26:20 +02001045 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1046 f_pdp_ctx_act(ctx);
Pau Espin Pedrol363ba482018-01-29 18:42:00 +01001047
Harald Welte79737b42019-04-10 10:39:30 +02001048 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Pau Espin Pedrol363ba482018-01-29 18:42:00 +01001049 /* verify PCO contains both primary and secondary DNS */
1050 var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1);
1051 if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), ggsn_ip6_dns1)) {
1052 setverdict(fail, "Primary DNS IPv6 PCO option not found");
1053 }
1054
1055 var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2);
1056 if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), ggsn_ip6_dns2)) {
1057 setverdict(fail, "Secondary DNS IPv6 PCO option not found");
1058 }
1059
Harald Welteed7a1772017-08-09 20:26:20 +02001060 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001061 f_shutdown_helper();
Harald Welteed7a1772017-08-09 20:26:20 +02001062 }
1063
Harald Welte0ef285b2017-08-13 20:06:01 +02001064 /* Test PDP context activation for dynamic IPv6 EUA with IPv6 DNS in PCO and router solicitation/advertisement */
Harald Welteed7a1772017-08-09 20:26:20 +02001065 testcase TC_pdp6_act_deact_icmp6() runs on GT_CT {
1066 f_init();
1067
Harald Welteed097432017-08-13 13:28:49 +02001068 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
Harald Welteed7a1772017-08-09 20:26:20 +02001069 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1070 f_pdp_ctx_act(ctx);
Harald Welte231b9412017-08-09 17:16:31 +02001071
Harald Welte79737b42019-04-10 10:39:30 +02001072 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Harald Welte231b9412017-08-09 17:16:31 +02001073 //f_send_gtpu(ctx, c_router_solicit);
1074 //f_send_gtpu(ctx, c_neigh_solicit);
1075
1076 f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
1077 f_wait_rtr_adv(ctx);
1078 f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
1079
Harald Welte811651e2017-08-05 15:25:06 +02001080 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001081 f_shutdown_helper();
Harald Welte94ade362017-08-04 00:36:55 +02001082 }
1083
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001084 /* Test PDP context activation for dynamic IPv6 EUA with IPv6 DNS in PCO and router solicitation/advertisement.
1085 Test we can send ICMPv6 ping over GTPU to DNS server. */
1086 testcase TC_pdp6_act_deact_gtpu_access() runs on GT_CT {
1087 f_init();
1088 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
1089 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1090 f_pdp_ctx_act(ctx);
1091
1092 f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
1093 f_wait_rtr_adv(ctx);
1094 f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
1095
1096 var OCT16 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '0003'O);
1097
1098 /* Check if we can use valid link-local src addr. */
1099 var OCT16 saddr_ll := f_ipv6_link_local(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
1100 f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_ll, dns1_addr));
Pau Espin Pedrolb63d85f2022-02-07 16:11:47 +01001101 if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) {
1102 f_wait_icmp6_echo_reply(ctx);
1103 } else {
1104 f_wait_gtpu_fail(ctx);
1105 }
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001106
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001107 /* Check if we can use valid global src addr, should work */
1108 var OCT16 saddr_glob := f_ipv6_global(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
1109 f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_glob, dns1_addr));
1110 f_wait_icmp6_echo_reply(ctx);
1111
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001112 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001113 f_shutdown_helper();
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001114 }
1115
1116 /* Check that attempting RA with another ll src addr won't work, packet dropped: */
1117 testcase TC_pdp6_act_deact_gtpu_access_wrong_ll_saddr() runs on GT_CT {
1118 f_init();
1119 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
1120 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1121 f_pdp_ctx_act(ctx);
1122
1123 f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
1124 f_wait_rtr_adv(ctx);
1125 f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
1126
1127 var OCT16 saddr_ll := f_ipv6_link_local(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
1128 var OCT16 saddr_ll_wrong := f_ipv6_mangle(saddr_ll, 8);
1129 f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_ll_wrong));
1130 f_wait_gtpu_fail(ctx);
1131
1132 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001133 f_shutdown_helper();
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001134 }
1135
1136 /* Assert that packets with wrong global src addr are dropped by GGSN */
1137 testcase TC_pdp6_act_deact_gtpu_access_wrong_global_saddr() runs on GT_CT {
1138 f_init();
1139 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
1140 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1141 f_pdp_ctx_act(ctx);
1142
1143 f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
1144 f_wait_rtr_adv(ctx);
1145 f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
1146
1147 var OCT16 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '0003'O);
1148 var OCT16 saddr_glob := f_ipv6_global(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001149 var OCT16 saddr_wrong := f_ipv6_mangle(saddr_glob);
1150 f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_wrong, dns1_addr));
1151 f_wait_gtpu_fail(ctx);
1152
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001153 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001154 f_shutdown_helper();
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001155 }
1156
1157 /* Send an IPv4 ICMP ECHO REQUEST to APN6, should fail (packet dropped */
1158 testcase TC_pdp6_act_deact_gtpu_access_ipv4_apn6() runs on GT_CT {
1159 f_init();
1160 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
1161 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1162 f_pdp_ctx_act(ctx);
1163
1164 f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
1165 f_wait_rtr_adv(ctx);
1166 f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
1167
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001168 var OCT4 saddr_v4 := f_inet_addr("192.168.10.2");
1169 var OCT4 daddr_v4 := f_inet_addr("8.8.8.8");
1170 f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_v4, daddr_v4));
1171 f_wait_gtpu_fail(ctx);
1172
1173 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001174 f_shutdown_helper();
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001175 }
1176
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +01001177 /* Validate if different clients (pdp ctx) can reach one another through GGSN. */
1178 testcase TC_pdp6_clients_interact() runs on GT_CT {
1179 f_init();
1180 var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
1181 var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
1182 f_pdp_ctx_act(ctxA);
1183 f_send_gtpu(ctxA, f_icmpv6_rs_for_pdp(ctxA));
1184 f_wait_rtr_adv(ctxA);
1185 f_send_gtpu(ctxA, f_gen_icmpv6_neigh_solicit_for_pdp(ctxA));
1186
1187 f_pdp_ctx_act(ctxB);
1188 f_send_gtpu(ctxB, f_icmpv6_rs_for_pdp(ctxB));
1189 f_wait_rtr_adv(ctxB);
1190 f_send_gtpu(ctxB, f_gen_icmpv6_neigh_solicit_for_pdp(ctxB));
1191
1192 var OCT16 addrA_ll := f_ipv6_link_local(ctxA.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
1193 var OCT16 addrB_ll := f_ipv6_link_local(ctxB.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
1194 var OCT16 addrA_glob := f_ipv6_global(ctxA.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
1195 var OCT16 addrB_glob := f_ipv6_global(ctxB.eua.endUserAddress.endUserAddressIPv6.ipv6_address);
1196
1197 /* Validate if clients can interact using ll addr. */
1198 f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_ll, addrB_ll));
1199 f_wait_gtpu_fail(ctxB);
1200
1201 /* Validate if clients can interact using global addr. */
1202 f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_glob, addrB_glob));
1203 f_wait_gtpu_fail(ctxB);
1204
1205 f_pdp_ctx_del(ctxA, '1'B);
Pau Espin Pedrolbb2bb062019-09-03 12:28:12 +02001206 f_pdp_ctx_del(ctxB, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001207 f_shutdown_helper();
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +01001208 }
1209
Harald Welte0ef285b2017-08-13 20:06:01 +02001210 /* Test PDP context activation for dynamic IPv4 EUA without DNS request */
Harald Welteed7a1772017-08-09 20:26:20 +02001211 testcase TC_pdp4_act_deact() runs on GT_CT {
1212 f_init();
Harald Welteed097432017-08-13 13:28:49 +02001213 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
Harald Welteed7a1772017-08-09 20:26:20 +02001214 f_pdp_ctx_act(ctx);
1215 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001216 f_shutdown_helper();
Harald Welteed7a1772017-08-09 20:26:20 +02001217 }
1218
Harald Welte0ef285b2017-08-13 20:06:01 +02001219 /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in IPCP */
Harald Welteed7a1772017-08-09 20:26:20 +02001220 testcase TC_pdp4_act_deact_ipcp() runs on GT_CT {
1221 f_init();
Pau Espin Pedrolf69a4382018-01-29 13:09:00 +01001222 var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
1223 var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
Harald Welteed097432017-08-13 13:28:49 +02001224 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
Harald Weltedca80052017-08-13 20:01:38 +02001225 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP);
Harald Welteed7a1772017-08-09 20:26:20 +02001226 f_pdp_ctx_act(ctx);
Harald Welte79737b42019-04-10 10:39:30 +02001227 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Harald Welte71a36022017-12-04 18:55:58 +01001228 /* verify IPCP is at all contained */
1229 if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) {
1230 setverdict(fail, "IPCP not found in PCO");
1231 }
1232 /* verify IPCP contains both primary and secondary DNS */
1233 var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O));
Pau Espin Pedrolf69a4382018-01-29 13:09:00 +01001234 if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) {
1235 if (not match(ipcp, tr_IPCP_Ack_DNS(0))) {
1236 setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found");
1237 } else {
1238 setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values");
1239 }
Harald Welte71a36022017-12-04 18:55:58 +01001240 }
Harald Welteed7a1772017-08-09 20:26:20 +02001241 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001242 f_shutdown_helper();
Harald Welteed7a1772017-08-09 20:26:20 +02001243 }
1244
Harald Weltef8298542019-04-10 10:15:28 +02001245 /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in IPCP + PAP authentication (broken) */
1246 testcase TC_pdp4_act_deact_ipcp_pap_broken() runs on GT_CT {
1247 f_init();
1248 var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
1249 var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
1250 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1251 ctx.pco_req := valueof(ts_PCO_PAP_IPv4_DNS);
1252 f_pdp_ctx_act(ctx);
1253 f_PCO_ensure_no_duplicates(ctx.pco_neg);
1254 /* verify IPCP is at all contained */
1255 if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) {
1256 setverdict(fail, "IPCP not found in PCO");
1257 }
1258 /* verify IPCP contains both primary and secondary DNS */
1259 var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O));
1260 if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) {
1261 if (not match(ipcp, tr_IPCP_Ack_DNS(0))) {
1262 setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found");
1263 } else {
1264 setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values");
1265 }
1266 }
1267 /* verify that PAP is contained */
1268 if (not match(ctx.pco_neg, tr_PCO_Contains('C023'O))) {
1269 setverdict(fail, "PAP not found in PCO");
1270 }
1271 var PapPacket pap := dec_PapPacket(f_PCO_extract_proto(ctx.pco_neg, 'C023'O));
1272 if (not match(pap, tr_PAP_AuthAck)) {
1273 setverdict(fail, "PAP isn't an AuthenticateAck: ", pap);
1274 }
1275 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001276 f_shutdown_helper();
Harald Weltef8298542019-04-10 10:15:28 +02001277 }
1278
Harald Welte0ef285b2017-08-13 20:06:01 +02001279 /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in PCO */
Harald Welteed7a1772017-08-09 20:26:20 +02001280 testcase TC_pdp4_act_deact_pcodns() runs on GT_CT {
1281 f_init();
Harald Welteed097432017-08-13 13:28:49 +02001282 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
Harald Weltedca80052017-08-13 20:01:38 +02001283 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
Harald Welteed7a1772017-08-09 20:26:20 +02001284 f_pdp_ctx_act(ctx);
Pau Espin Pedrol363ba482018-01-29 18:42:00 +01001285
Harald Welte79737b42019-04-10 10:39:30 +02001286 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Pau Espin Pedrol363ba482018-01-29 18:42:00 +01001287 /* verify PCO contains both primary and secondary DNS */
1288 var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
1289 if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), ggsn_ip4_dns1)) {
1290 setverdict(fail, "Primary DNS IPv4 PCO option not found");
1291 }
1292
1293 var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
1294 if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), ggsn_ip4_dns2)) {
1295 setverdict(fail, "Secondary DNS IPv4 PCO option not found");
1296 }
1297
Harald Welteed7a1772017-08-09 20:26:20 +02001298 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001299 f_shutdown_helper();
Harald Welteed7a1772017-08-09 20:26:20 +02001300 }
1301
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001302 /* Test PDP context activation for dynamic IPv4 EUA.
1303 Test we can send ICMPv6 ping over GTPU to DNS server. */
1304 testcase TC_pdp4_act_deact_gtpu_access() runs on GT_CT {
1305 f_init();
1306 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1307 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1308 f_pdp_ctx_act(ctx);
1309
Harald Welte79737b42019-04-10 10:39:30 +02001310 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001311 var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O);
1312
1313 /* Check if we can use valid global src addr, should work */
1314 var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address;
1315 f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr));
1316 f_wait_icmp4_echo_reply(ctx);
1317
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001318 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001319 f_shutdown_helper();
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001320 }
1321
1322 /* Assert that packets with wrong global src addr are dropped by GGSN */
1323 testcase TC_pdp4_act_deact_gtpu_access_wrong_saddr() runs on GT_CT {
1324 f_init();
1325 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1326 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1327 f_pdp_ctx_act(ctx);
1328
1329 f_PCO_ensure_no_duplicates(ctx.pco_neg);
1330 var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O);
1331 var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address;
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001332 var OCT4 saddr_wrong := substr(saddr, 0, 3) & (saddr[3] xor4b '11'O);
1333 f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_wrong, dns1_addr));
1334 f_wait_gtpu_fail(ctx);
1335
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001336 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001337 f_shutdown_helper();
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001338 }
1339
1340 /* Send an IPv6 RA to APN4, should fail (packet dropped) */
1341 testcase TC_pdp4_act_deact_gtpu_access_ipv6_apn4() runs on GT_CT {
1342 f_init();
1343 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1344 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1345 f_pdp_ctx_act(ctx);
1346
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001347 /* Send an IPv6 RA to APN4, should fail (packet dropped) */
1348 var OCT16 saddr_v6 := f_inet6_addr("fde4:8dba:82e1:2000:1:2:3:4");
1349 f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_v6));
1350 f_wait_gtpu_fail(ctx);
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001351
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001352 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001353 f_shutdown_helper();
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01001354 }
1355
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001356 /* Helper function for tests below. */
1357 function f_pdp4_clients_interact() runs on GT_CT {
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +01001358 f_init();
1359 var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1360 var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1361 f_pdp_ctx_act(ctxA);
1362 f_pdp_ctx_act(ctxB);
1363 var OCT4 addrA := ctxA.eua.endUserAddress.endUserAddressIPv4.ipv4_address;
1364 var OCT4 addrB := ctxB.eua.endUserAddress.endUserAddressIPv4.ipv4_address;
1365 f_send_gtpu(ctxA, f_gen_icmpv4_echo(addrA, addrB));
1366 f_wait_icmp4_echo_request(ctxB);
1367
1368 f_pdp_ctx_del(ctxA, '1'B);
Pau Espin Pedrolbb2bb062019-09-03 12:28:12 +02001369 f_pdp_ctx_del(ctxB, '1'B);
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +01001370 }
1371
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001372 /* Validate if different clients (pdp ctx) can reach one another through GGSN. */
1373 testcase TC_pdp4_clients_interact_with_txseq() runs on GT_CT {
Harald Welte3e0b0392018-04-26 09:46:21 +02001374 use_gtpu_txseq := true;
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001375 f_pdp4_clients_interact();
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001376 f_shutdown_helper();
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001377 }
1378
1379 /* Validate if different clients (pdp ctx) can reach one another through GGSN (without Tx sequence number). */
1380 testcase TC_pdp4_clients_interact_without_txseq() runs on GT_CT {
Harald Welte3e0b0392018-04-26 09:46:21 +02001381 use_gtpu_txseq := false;
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001382 f_pdp4_clients_interact();
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001383 f_shutdown_helper();
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02001384 }
1385
Harald Weltedca80052017-08-13 20:01:38 +02001386 testcase TC_echo_req_resp() runs on GT_CT {
1387 f_init();
1388 f_send_gtpc(ts_GTPC_PING(g_peer_c, g_c_seq_nr));
1389 T_default.start;
1390 alt {
1391 [] GTPC.receive(tr_GTPC_PONG(g_peer_c)) { setverdict(pass); };
1392 [] GTPC.receive { repeat; };
1393 [] T_default.timeout { setverdict(fail); }
1394 }
1395 T_default.stop;
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001396 f_shutdown_helper();
Harald Weltedca80052017-08-13 20:01:38 +02001397 }
1398
Pau Espin Pedrol480e67f2022-02-09 16:37:47 +01001399 testcase TC_echo_req_resp_gtpu() runs on GT_CT {
1400 f_init();
1401 GTPU.send(ts_GTPU_PING(g_peer_u, g_d_seq_nr));
1402 T_default.start;
1403 alt {
1404 [] GTPU.receive(tr_GTPU_PONG(g_peer_u)) { setverdict(pass); };
1405 [] GTPU.receive { repeat; };
1406 [] T_default.timeout { setverdict(fail); }
1407 }
1408 T_default.stop;
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001409 f_shutdown_helper();
Pau Espin Pedrol480e67f2022-02-09 16:37:47 +01001410 }
1411
Philipp Maier33e52612018-05-30 17:22:02 +02001412 /* Test if the parser can cope with PCO that only contain either a
1413 * single primary DNS or a secondary DNS. */
1414 testcase TC_pdp4_act_deact_with_single_dns() runs on GT_CT {
1415
1416 /* Note: an unpatched osmo-ggsn version will enter an endless-loop when
1417 * the test is executed.
1418 * see also: Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1419
1420 f_init();
1421 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1422 var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
1423 var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
1424 var octetstring pco_neg_dns;
1425 var octetstring pco_neg_dns_expected;
1426
1427 /* PCO with primary DNS only */
1428 ctx.pco_req := valueof(ts_PCO_IPv4_PRI_DNS_IPCP);
1429 f_pdp_ctx_act(ctx);
Harald Welte79737b42019-04-10 10:39:30 +02001430 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Philipp Maier33e52612018-05-30 17:22:02 +02001431 pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1);
1432 pco_neg_dns_expected := '0200000A8106'O & ggsn_ip4_dns1
1433 /* Note: The prepended hex bytes encode the following information:
1434 * 0x02 = Configuration ACK
1435 * 0x00 = Identifier
1436 * 0x000a = Length
1437 * 0x81 = Type (Primary DNS Server Address)
1438 * 0x06 = Length
1439 * (4 byte IP-Address appended) */
1440 if (not match(pco_neg_dns, pco_neg_dns_expected)) {
1441 setverdict(fail, "Primary DNS IPv4 PCO option not found");
1442 }
1443 f_pdp_ctx_del(ctx, '1'B);
1444
1445 /* PCO with secondary DNS only */
Harald Welte7ef6d102021-04-01 21:24:35 +02001446 ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
Philipp Maier33e52612018-05-30 17:22:02 +02001447 ctx.pco_req := valueof(ts_PCO_IPv4_SEC_DNS_IPCP);
1448 f_pdp_ctx_act(ctx);
1449 pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1);
1450 pco_neg_dns_expected := '0200000A8306'O & ggsn_ip4_dns2
1451 if (not match(pco_neg_dns, pco_neg_dns_expected)) {
1452 setverdict(fail, "Secondary DNS IPv4 PCO option not found");
1453 }
1454 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001455 f_shutdown_helper();
Philipp Maier33e52612018-05-30 17:22:02 +02001456 }
1457
1458 /* Test if the parser can cope with PCO that contains primary and secondary DNS in a separate IPCP container.
1459 * Note: an unpatched osmo-ggsn version will enter an endless-loop when the test is run
1460 * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288. */
1461 testcase TC_pdp4_act_deact_with_separate_dns() runs on GT_CT {
1462
1463 /* Note: an unpatched osmo-ggsn version will enter an endless-loop when
1464 * the test is executed.
1465 * see also: Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
1466
1467 f_init();
1468 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1469 var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
1470 var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
1471 var octetstring pco_neg_dns;
1472 var octetstring pco_neg_dns_expected;
1473
1474 ctx.pco_req := valueof(ts_PCO_IPv4_SEPARATE_DNS_IPCP);
1475 f_pdp_ctx_act(ctx);
1476
1477 /* Check if primary DNS is contained */
1478 pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1);
1479 pco_neg_dns_expected := '0200000A8106'O & ggsn_ip4_dns1
1480 if (not match(pco_neg_dns, pco_neg_dns_expected)) {
1481 setverdict(fail, "Primary DNS IPv4 PCO option not found");
1482 }
Philipp Maier33e52612018-05-30 17:22:02 +02001483
1484 /* Check if secondary DNS is contained */
Stefan Sperling8e7a3962018-07-19 19:24:38 +02001485 /* This used to fail due to a bug in osmo-ggsn, see OS#3381 */
1486 pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 2);
Philipp Maier33e52612018-05-30 17:22:02 +02001487 pco_neg_dns_expected := '0200000A8306'O & ggsn_ip4_dns2
1488 if (not match(pco_neg_dns, pco_neg_dns_expected)) {
1489 setverdict(fail, "Secondary DNS IPv4 PCO option not found");
1490 }
1491 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001492 f_shutdown_helper();
Philipp Maier33e52612018-05-30 17:22:02 +02001493 }
1494
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +01001495 /* Validate that SUT updates remote TEIC when requested through UpdatePDPContextRequest */
1496 testcase TC_pdp4_act_update_teic() runs on GT_CT {
1497 f_init();
1498 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1499 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1500 f_pdp_ctx_act(ctx);
1501
1502 /* UpdatePDPContestRequest changing the local TEIC */
1503 var OCT4 new_teic := ctx.teic;
1504 new_teic[3] := new_teic[3] xor4b '11'O;
1505 f_pdp_ctx_update(ctx, new_teic := new_teic);
1506
1507 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001508 f_shutdown_helper();
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +01001509 }
1510
1511 /* Validate that SUT updates remote TEID when requested through UpdatePDPContextRequest */
1512 testcase TC_pdp4_act_update_teid() runs on GT_CT {
1513 f_init();
1514 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1515 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1516 f_pdp_ctx_act(ctx);
1517
1518 f_PCO_ensure_no_duplicates(ctx.pco_neg);
1519 var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O);
1520 var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address;
1521
1522 /* Data is sent (back) to the local TEID established during CreatePDPContext */
1523 f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr));
1524 f_wait_icmp4_echo_reply(ctx);
1525
1526 /* UpdatePDPContestRequest changing the local TEID */
1527 var OCT4 new_teid := ctx.teid;
1528 new_teid[3] := new_teid[3] xor4b '11'O;
1529 f_pdp_ctx_update(ctx, new_teid := new_teid);
1530
1531 /* Check if we can send data after updating the PDP context. Answer should be sent to the new TEID */
1532 f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr));
1533 f_wait_icmp4_echo_reply(ctx);
1534
1535 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001536 f_shutdown_helper();
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +01001537 }
1538
Oliver Smithee6a0882019-03-08 11:05:46 +01001539 /* Test IPv4v6 context activation for dynamic IPv4v6 EUA without DNS request */
1540 testcase TC_pdp46_act_deact() runs on GT_CT {
1541 f_init();
1542 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1543 f_pdp_ctx_act(ctx);
1544 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001545 f_shutdown_helper();
Oliver Smithee6a0882019-03-08 11:05:46 +01001546 }
1547
1548 /* Test PDP context activation for dynamic IPv4v6 EUA with IPv4 DNS in IPCP */
1549 testcase TC_pdp46_act_deact_ipcp() runs on GT_CT {
1550 f_init();
1551 var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
1552 var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
1553 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1554 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP);
1555 f_pdp_ctx_act(ctx);
Harald Welte79737b42019-04-10 10:39:30 +02001556 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Oliver Smithee6a0882019-03-08 11:05:46 +01001557 /* verify IPCP is at all contained */
1558 if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) {
1559 setverdict(fail, "IPCP not found in PCO");
1560 }
Harald Welte79737b42019-04-10 10:39:30 +02001561 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Oliver Smithee6a0882019-03-08 11:05:46 +01001562 /* verify IPCP contains both primary and secondary IPv4 DNS */
1563 var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O));
1564 if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) {
1565 if (not match(ipcp, tr_IPCP_Ack_DNS(0))) {
1566 setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found");
1567 } else {
1568 setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values");
1569 }
1570 }
1571 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001572 f_shutdown_helper();
Oliver Smithee6a0882019-03-08 11:05:46 +01001573 }
1574
1575 /* Test PDP context activation for dynamic IPv4v6 EUA with IPv6 DNS in PCO and router solicitation/advertisement */
1576 testcase TC_pdp46_act_deact_icmp6() runs on GT_CT {
1577 f_init();
1578 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1579 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1580 f_pdp_ctx_act(ctx);
1581
1582 f_send_gtpu(ctx, f_icmpv6_rs_for_pdp46(ctx));
1583 f_wait_rtr_adv(ctx);
1584 f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp46(ctx));
1585
1586 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001587 f_shutdown_helper();
Oliver Smithee6a0882019-03-08 11:05:46 +01001588 }
1589
1590 /* Test IPv4v6 context activation for dynamic IPv4v6 EUA with request of IPv4 DNS in PCO */
1591 testcase TC_pdp46_act_deact_pcodns4() runs on GT_CT {
1592 f_init();
1593
1594 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1595 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1596 f_pdp_ctx_act(ctx);
1597
Harald Welte79737b42019-04-10 10:39:30 +02001598 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Oliver Smithee6a0882019-03-08 11:05:46 +01001599 /* verify PCO contains both primary and secondary IPv4 DNS */
1600 var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
1601 if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), ggsn_ip4_dns1)) {
1602 setverdict(fail, "Primary DNS IPv4 PCO option not found");
1603 }
1604
1605 var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
1606 if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), ggsn_ip4_dns2)) {
1607 setverdict(fail, "Secondary DNS IPv4 PCO option not found");
1608 }
1609
1610 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001611 f_shutdown_helper();
Oliver Smithee6a0882019-03-08 11:05:46 +01001612 }
1613
1614 /* Test IPv4v6 context activation for dynamic IPv4v6 EUA with request of IPv6 DNS in PCO */
1615 testcase TC_pdp46_act_deact_pcodns6() runs on GT_CT {
1616 f_init();
1617
1618 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1619 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1620 f_pdp_ctx_act(ctx);
1621
Harald Welte79737b42019-04-10 10:39:30 +02001622 f_PCO_ensure_no_duplicates(ctx.pco_neg);
Oliver Smithee6a0882019-03-08 11:05:46 +01001623 /* verify PCO contains both primary and secondary IPv6 DNS */
1624 var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1);
1625 if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), ggsn_ip6_dns1)) {
1626 setverdict(fail, "Primary DNS IPv6 PCO option not found");
1627 }
1628
1629 var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2);
1630 if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), ggsn_ip6_dns2)) {
1631 setverdict(fail, "Secondary DNS IPv6 PCO option not found");
1632 }
1633
1634 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001635 f_shutdown_helper();
Oliver Smithee6a0882019-03-08 11:05:46 +01001636 }
1637
1638 /* Test PDP context activation for dynamic IPv4v6 EUA.
1639 Test we can send ICMPv6 ping over GTPU to DNS server. */
1640 testcase TC_pdp46_act_deact_gtpu_access() runs on GT_CT {
1641 f_init();
1642 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1643 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1644 f_pdp_ctx_act(ctx);
1645
1646 var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O);
1647
1648 /* Check if we can use valid global src addr, should work */
1649 var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv4_address;
1650 f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr));
1651 f_wait_icmp4_echo_reply(ctx);
1652
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001653 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001654 f_shutdown_helper();
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001655 }
1656
1657 /* Assert that packets with wrong ipv4 src addr are dropped by GGSN on APN IPv4v6 */
1658 testcase TC_pdp46_act_deact_gtpu_access_wrong_saddr_ipv4() runs on GT_CT {
1659 f_init();
1660 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1661 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1662 f_pdp_ctx_act(ctx);
1663
1664 var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O);
1665 var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv4_address;
Oliver Smithee6a0882019-03-08 11:05:46 +01001666 var OCT4 saddr_wrong := substr(saddr, 0, 3) & (saddr[3] xor4b '11'O);
1667 f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_wrong, dns1_addr));
1668 f_wait_gtpu_fail(ctx);
1669
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001670 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001671 f_shutdown_helper();
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001672 }
1673
Pau Espin Pedrolc6ac6952022-02-14 11:19:23 +01001674 /* Check that attempting RA with another ll src addr won't work, packet dropped: */
1675 testcase TC_pdp46_act_deact_gtpu_access_wrong_ll_saddr_ipv6() runs on GT_CT {
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001676 f_init();
1677 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1678 ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1679 f_pdp_ctx_act(ctx);
1680
Pau Espin Pedrolc6ac6952022-02-14 11:19:23 +01001681 var OCT16 saddr_ll := f_ipv6_link_local(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address);
1682 var OCT16 saddr_ll_wrong := f_ipv6_mangle(saddr_ll, 8);
1683 f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_ll_wrong));
1684 f_wait_gtpu_fail(ctx);
1685
1686 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001687 f_shutdown_helper();
Pau Espin Pedrolc6ac6952022-02-14 11:19:23 +01001688 }
1689
1690 /* Assert that packets with wrong ipv6 global src addr are dropped by GGSN on APN IPv4v6 */
1691 testcase TC_pdp46_act_deact_gtpu_access_wrong_global_saddr_ipv6() runs on GT_CT {
1692 f_init();
1693 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1694 ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
1695 f_pdp_ctx_act(ctx);
1696
1697 f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
1698 f_wait_rtr_adv(ctx);
1699 f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
1700
1701 var OCT16 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '0003'O);
1702 var OCT16 saddr_glob := f_ipv6_global(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address);
1703 var OCT16 saddr_wrong := f_ipv6_mangle(saddr_glob);
1704 f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_wrong, dns1_addr));
Oliver Smithee6a0882019-03-08 11:05:46 +01001705 f_wait_gtpu_fail(ctx);
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01001706
Oliver Smithee6a0882019-03-08 11:05:46 +01001707 f_pdp_ctx_del(ctx, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001708 f_shutdown_helper();
Oliver Smithee6a0882019-03-08 11:05:46 +01001709 }
1710
1711 /* Validate if different clients (pdp ctx) can reach one another through GGSN. */
1712 testcase TC_pdp46_clients_interact() runs on GT_CT {
1713 f_init();
1714 var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1715 var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn)));
1716 f_pdp_ctx_act(ctxA);
1717 f_send_gtpu(ctxA, f_icmpv6_rs_for_pdp46(ctxA));
1718 f_wait_rtr_adv(ctxA);
1719 f_send_gtpu(ctxA, f_gen_icmpv6_neigh_solicit_for_pdp46(ctxA));
1720
1721 f_pdp_ctx_act(ctxB);
1722 f_send_gtpu(ctxB, f_icmpv6_rs_for_pdp46(ctxB));
1723 f_wait_rtr_adv(ctxB);
1724 f_send_gtpu(ctxB, f_gen_icmpv6_neigh_solicit_for_pdp46(ctxB));
1725
1726 var OCT16 addrA_ll := f_ipv6_link_local(ctxA.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address);
1727 var OCT16 addrB_ll := f_ipv6_link_local(ctxB.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address);
1728 var OCT16 addrA_glob := f_ipv6_global(ctxA.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address);
1729 var OCT16 addrB_glob := f_ipv6_global(ctxB.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address);
1730
1731 /* Validate if clients can interact using ll addr. */
1732 f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_ll, addrB_ll));
1733 f_wait_gtpu_fail(ctxB);
1734
1735 /* Validate if clients can interact using global addr. */
1736 f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_glob, addrB_glob));
1737 f_wait_gtpu_fail(ctxB);
1738
1739 f_pdp_ctx_del(ctxA, '1'B);
Pau Espin Pedrolbb2bb062019-09-03 12:28:12 +02001740 f_pdp_ctx_del(ctxB, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001741 f_shutdown_helper();
Oliver Smithee6a0882019-03-08 11:05:46 +01001742 }
1743
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02001744 /* Test IPv4v6 context activation for dynamic IPv4v6 EUA on a v4-only APN */
1745 testcase TC_pdp46_act_deact_apn4() runs on GT_CT {
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +01001746 const OCT1 cause_accept := '80'O; /* Normal accept cause */
1747 const OCT1 cause_new_pdp_type := '81'O; /* Cause: New PDP type due to network preference */
1748 const OCT1 cause_unknown_pdp := 'DC'O; /* Cause: Unknown PDP address or PDP type */
1749 var CreatePDPContextResponse cpr;
1750
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02001751 f_init();
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02001752 var PdpContext ctx46 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dynv6Dyn)));
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +01001753 cpr := f_pdp_ctx_act(ctx46, (cause_unknown_pdp, cause_new_pdp_type));
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02001754
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +01001755 if (cpr.cause.causevalue == cause_new_pdp_type) {
1756 /* 3GPP TS 23.060 sec 9.2.1: "If the MS requests PDP type IPv4v6,
1757 * but the operator preferences dictate the use of a single IP
1758 * version only, the PDP type shall be changed to a single address
1759 * PDP type (IPv4 or IPv6) and a reason cause shall be returned to
1760 * the MS indicating that only the assigned PDP type is allowed. In
1761 * this case, the MS shall not request another PDP context for the
1762 * other PDP type during the existence of the PDP context." */
1763 f_pdp_ctx_del(ctx46, '1'B);
1764 } else {
1765 /* 3GPP TS 23.060 sec 9.2.1 NOTE 5: If the MS requests PDP type
1766 * IPv4v6, and the PDP context is rejected due to "unknown PDP
1767 * type", the MS can attempt to establish dual-stack connectivity
1768 * by performing two PDP context request procedures to activate an
1769 * IPv4 PDP context and an IPv6 PDP context, both to the same APN. A
1770 * typical MS first attempts v4v6, and if rejected, then tries v4
1771 * and v6 separetly */
1772 var PdpContext ctx4 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1773 f_pdp_ctx_act(ctx4, cause_accept); /* Normal accept cause */
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02001774
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +01001775 var PdpContext ctx6 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv6Dyn)));
1776 f_pdp_ctx_act(ctx6, cause_unknown_pdp); /* Cause: Unknown PDP address or PDP type */
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02001777
Pau Espin Pedrol0f464d62022-02-23 14:04:29 +01001778 f_pdp_ctx_del(ctx4, '1'B);
1779 }
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001780 f_shutdown_helper();
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02001781 }
1782
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +02001783 /* Validate if 2nd CtxCreateReq with increased Recovery IE causes ggsn to drop 1st one (while keeping 2nd one). */
1784 testcase TC_pdp_act2_recovery() runs on GT_CT {
1785 var Gtp1cUnitdata ud;
1786 var default d;
1787 var boolean ctxA_deleted := false;
1788 var boolean ctxB_created := false;
1789
1790 f_init();
1791 var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1792 var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1793 f_pdp_ctx_act(ctxA);
1794
Vadim Yanitskiyd344b4a2022-02-09 18:28:18 +06001795 g_restart_ctr := int2oct((oct2int(g_restart_ctr) + 1) mod 256, 1);
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +02001796
1797 log("sending 2nd CreatePDP (recovery increased)");
1798 f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctxB.imsi, g_restart_ctr,
1799 ctxB.teid, ctxB.teic, ctxB.nsapi, ctxB.eua, ctxB.apn,
1800 g_sgsn_ip_c, g_sgsn_ip_u, ctxB.msisdn, ctxB.pco_req));
1801 T_default.start;
1802 d := activate(pingpong());
1803 alt {
1804 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctxB.teic)) -> value ud {
1805 f_handle_create_req(ctxB, ud);
1806 if (not ctxB_created) {
1807 ctxB_created := true;
1808 setverdict(pass);
1809 } else {
1810 setverdict(fail, "Repeated createPDPContextResponse(ctxB)");
1811 }
1812
1813 if (not ctxA_deleted) {
1814 repeat;
1815 }
1816 }
1817 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxA.teic)) -> value ud {
1818 if (ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.tearDownIndicator)) {
1819 setverdict(pass);
1820 } else {
1821 setverdict(fail);
1822 }
1823
1824 if (not ctxA_deleted) {
1825 ctxA_deleted := true;
1826 setverdict(pass);
1827 } else {
1828 setverdict(fail, "Repeated deletePDPContextRequest(ctxA)");
1829 }
1830
1831 if (not ctxB_created) {
1832 repeat;
1833 }
1834 }
1835 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxB.teic)) -> value ud {
1836 setverdict(fail, "GGSN dropping still valid pdp ctx");
1837 }
1838 }
1839 deactivate(d);
1840 T_default.stop;
1841
1842 f_pdp_ctx_del(ctxB, '1'B);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001843 f_shutdown_helper();
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +02001844 }
1845
1846
Pau Espin Pedrol9a5f42f2019-05-27 20:04:35 +02001847 /* Send a duplicate echo req. osmo-ggsn maintains a queue for sent
1848 responses (60 seconds): If same delete req is sent and duplicate is
1849 detected, saved duplicate response should be sent back. */
1850 testcase TC_act_deact_retrans_duplicate() runs on GT_CT {
1851 f_init();
1852 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1853 f_pdp_ctx_act(ctx);
1854 f_pdp_ctx_del(ctx, '1'B);
1855 /* leave some time in between to make sure retransmit response queue keeps packets for a while */
1856 f_sleep(1.0);
1857 /* g_c_seq_nr was increased during f_pdp_ctx_del(), we want a
1858 duplicate. If it was not a duplicate, osmo-ggsn would answer
1859 with a failure since that PDP ctx was already deleted. */
1860 g_c_seq_nr := g_c_seq_nr - 1;
Pau Espin Pedrol10ec96e2022-02-09 17:03:15 +01001861 f_pdp_ctx_del(ctx, '1'B, expect_diameter := false);
Pau Espin Pedrol9a5f42f2019-05-27 20:04:35 +02001862
1863 /* Now send a new pdp ctx del (increased seqnum). It should fail with cause "non-existent": */
1864 var OCT1 cause_nonexistent := 'C0'O;
Pau Espin Pedrol10ec96e2022-02-09 17:03:15 +01001865 f_pdp_ctx_del(ctx, '1'B, cause_nonexistent, expect_diameter := false);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001866 f_shutdown_helper();
Pau Espin Pedrol9a5f42f2019-05-27 20:04:35 +02001867 }
1868
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02001869 /* Activate PDP context + trigger Recovery procedure through EchoResp */
1870 testcase TC_pdp_act_restart_ctr_echo() runs on GT_CT {
1871 var Gtp1cUnitdata ud;
Pau Espin Pedrol05118022022-02-17 19:49:13 +01001872 g_use_echo_intval := 5;
1873 timer T_echo;
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02001874 f_init();
1875 var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1876 f_pdp_ctx_act(ctx);
1877
1878 /* Wait to receive echo request and send initial Restart counter */
Pau Espin Pedrol05118022022-02-17 19:49:13 +01001879 T_echo.start(int2float(g_use_echo_intval) + 1.0);
1880 alt {
1881 [] GTPC.receive(tr_GTPC_PING(?)) -> value ud {
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02001882 var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber);
1883 GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr));
Pau Espin Pedrol05118022022-02-17 19:49:13 +01001884 }
1885 [] T_echo.timeout {
1886 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
1887 "Timeout waiting for ping");
1888 }
1889 }
1890 T_echo.stop;
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02001891
1892 /* Wait to receive second echo request and send incremented Restart
1893 counter. This will fake a restarted SGSN, and pdp ctx allocated
1894 should be released by GGSN */
Vadim Yanitskiyd344b4a2022-02-09 18:28:18 +06001895 g_restart_ctr := int2oct((oct2int(g_restart_ctr) + 1) mod 256, 1);
Pau Espin Pedrol05118022022-02-17 19:49:13 +01001896 T_echo.start(int2float(g_use_echo_intval) + 1.0);
1897 alt {
1898 [] GTPC.receive(tr_GTPC_PING(?)) -> value ud {
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02001899 var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber);
1900 GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr));
Pau Espin Pedrol05118022022-02-17 19:49:13 +01001901 }
1902 [] T_echo.timeout {
1903 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
1904 "Timeout waiting for ping");
1905 }
1906 }
1907 T_echo.stop;
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02001908 f_pdp_ctx_exp_del_req(ctx, omit, true);
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01001909 f_shutdown_helper();
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02001910 }
1911
Pau Espin Pedrol68c2af52022-02-25 11:56:17 +01001912 /* Test creation, user plane and deletion of big amount (1000) of concurrent PDP context */
1913 testcase TC_lots_of_concurrent_pdp_ctx() runs on GT_CT {
1914 var Gtp1cUnitdata udc;
1915 var Gtp1uUnitdata udu;
1916 const integer num_ctx := 1000;
1917 var PdpContext ctx[num_ctx];
1918 timer T_next := 0.01;
1919 var integer next_req_ctx := 0;
1920 var integer rx_resp_ctx := 0;
1921 var integer rx_pong := 0;
1922 var OCT4 dns1_addr;
1923 var OCT4 saddr;
1924 var integer teic;
1925 var integer idx;
1926
1927 f_init();
1928
1929 for (var integer i := 0; i < num_ctx; i := i + 1) {
1930 ctx[i] := valueof(t_DefinePDP(f_rnd_imsi('26242'H), f_rnd_msisdn('1234'O), c_ApnInternet, valueof(t_EuaIPv4Dyn)));
1931 ctx[i].teic := int2oct(i+1, 4); /* +1: skip TEIC=0 */
1932 ctx[i].teid := int2oct(i+1, 4); /* +1: skip TEID=0 */
1933 ctx[i].pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
1934 }
1935
1936 T_default.start(60.0);
1937
1938 T_next.start;
1939 alt {
Pau Espin Pedrol45d57022022-03-08 13:49:02 +01001940 [Gx_PROC.checkstate("Connected")] as_DIA_CCR(INITIAL_REQUEST) { repeat; }
Pau Espin Pedrol68c2af52022-02-25 11:56:17 +01001941 [] pingpong();
1942 [] T_next.timeout {
1943 f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx[next_req_ctx].imsi, g_restart_ctr,
1944 ctx[next_req_ctx].teid, ctx[next_req_ctx].teic, ctx[next_req_ctx].nsapi,
1945 ctx[next_req_ctx].eua, ctx[next_req_ctx].apn, g_sgsn_ip_c, g_sgsn_ip_u,
1946 ctx[next_req_ctx].msisdn, ctx[next_req_ctx].pco_req, ctx[next_req_ctx].ratType,
1947 ctx[next_req_ctx].uli));
1948 next_req_ctx := next_req_ctx + 1;
1949 if (next_req_ctx < num_ctx) {
1950 T_next.start;
1951 }
1952 repeat;
1953 }
1954 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ?)) -> value udc {
1955 teic := oct2int(udc.gtpc.teid);
1956 if (not match(teic, (1 .. num_ctx))) {
1957 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
1958 "Rx Unexpected TEIC");
1959 }
1960 idx := teic - 1;
1961 f_handle_create_req(ctx[idx], udc);
1962 rx_resp_ctx := rx_resp_ctx + 1;
1963
1964 dns1_addr := f_PCO_extract_proto(ctx[idx].pco_neg, '000d'O);
1965 saddr := ctx[idx].eua.endUserAddress.endUserAddressIPv4.ipv4_address;
1966 f_send_gtpu(ctx[idx], f_gen_icmpv4_echo(saddr, dns1_addr));
1967 repeat;
1968 }
1969 [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value udu {
1970 var octetstring gpdu := udu.gtpu.gtpu_IEs.g_PDU_IEs.data;
1971 var IPv4_packet ip4 := f_IPv4_dec(gpdu);
1972 if (ip4.header.ver != 4) {
1973 repeat;
1974 }
1975 var PDU_ICMP icmp4 := f_dec_PDU_ICMP(ip4.payload);
1976 if (not match(icmp4, (tr_ICMPv4_ERP, tr_ICMPv4_DU))) {
1977 repeat;
1978 }
1979 rx_pong := rx_pong + 1;
1980 if (rx_pong < num_ctx) {
1981 repeat;
1982 }
1983 setverdict(pass);
1984 }
1985 [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); }
1986 [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); }
1987 }
1988
1989 /* Let's close them now: */
1990 next_req_ctx := 0;
1991 rx_resp_ctx := 0;
1992 T_next.start;
1993 alt {
Pau Espin Pedrol45d57022022-03-08 13:49:02 +01001994 [Gx_PROC.checkstate("Connected")] as_DIA_CCR(TERMINATION_REQUEST) { repeat; }
Pau Espin Pedrol68c2af52022-02-25 11:56:17 +01001995 [] pingpong();
1996 [] T_next.timeout {
1997 f_send_gtpc(ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, ctx[next_req_ctx].teic_remote, ctx[next_req_ctx].nsapi, '1'B));
1998 next_req_ctx := next_req_ctx + 1;
1999 if (next_req_ctx < num_ctx) {
2000 T_next.start;
2001 }
2002 repeat;
2003 }
2004 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextResponse, ?)) -> value udc {
2005 teic := oct2int(udc.gtpc.teid);
2006 if (not match(teic, (1 .. num_ctx))) {
2007 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2008 "Rx Unexpected TEIC");
2009 }
2010 rx_resp_ctx := rx_resp_ctx + 1;
2011 if (rx_resp_ctx < num_ctx) {
2012 repeat;
2013 }
2014 setverdict(pass);
2015 }
2016 [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); }
2017 [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); }
2018 }
2019 T_next.stop;
2020
2021 T_default.stop;
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01002022 f_shutdown_helper();
Pau Espin Pedrol68c2af52022-02-25 11:56:17 +01002023 }
2024
Pau Espin Pedrolbfea8352022-02-28 12:11:26 +01002025 /* Test callocation of PDP contexts until reaching addr pool exhaustion */
2026 type record of OCT4 TEIClist;
2027 testcase TC_addr_pool_exhaustion() runs on GT_CT {
2028 var Gtp1cUnitdata udc;
2029 var Gtp1uUnitdata udu;
2030 var PdpContext ctx;
2031 timer T_next := 0.005;
2032 var integer next_req_ctx := 0;
2033 var integer rx_resp_ctx := 0;
2034 var integer num_ctx;
2035 var boolean cont_req := true;
2036 var CreatePDPContextResponse cpr;
2037 var TEIClist teic_list := {};
2038 var integer teic;
2039
2040 f_init();
2041
2042 T_default.start(120.0);
2043
2044 T_next.start;
2045 alt {
Pau Espin Pedrol45d57022022-03-08 13:49:02 +01002046 [Gx_PROC.checkstate("Connected")] as_DIA_CCR(INITIAL_REQUEST) { repeat; }
Pau Espin Pedrolbfea8352022-02-28 12:11:26 +01002047 [] pingpong();
2048 [] T_next.timeout {
2049 if (cont_req) {
2050 if (next_req_ctx - rx_resp_ctx < 100) { /* if we have too many in progress, wait a bit to continue */
2051 ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), f_rnd_msisdn('1234'O), c_ApnInternet, valueof(t_EuaIPv4Dyn)));
2052 ctx.nsapi := '0001'B;
2053 ctx.teic := int2oct(next_req_ctx+1, 4); /* +1: skip TEIC=0 */
2054 ctx.teid := int2oct(next_req_ctx+1, 4); /* +1: skip TEID=0 */
2055 f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx.imsi, g_restart_ctr,
2056 ctx.teid, ctx.teic, ctx.nsapi,
2057 ctx.eua, ctx.apn, g_sgsn_ip_c, g_sgsn_ip_u,
2058 ctx.msisdn, ctx.pco_req, ctx.ratType,
2059 ctx.uli));
2060 next_req_ctx := next_req_ctx + 1;
2061 }
2062 T_next.start;
2063 }
2064 repeat;
2065 }
2066 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ?)) -> value udc {
2067 cpr := udc.gtpc.gtpc_pdu.createPDPContextResponse;
2068
2069 if (cpr.cause.causevalue == '80'O) {
2070 teic_list := teic_list & {cpr.teidControlPlane.teidControlPlane};
2071 } else {
2072 if (cont_req == true) {
2073 num_ctx := rx_resp_ctx;
2074 log("Successfully created ", num_ctx, " PDP contexts before exhausting the pool");
2075 setverdict(pass);
2076 }
2077 cont_req := false;
2078 }
2079 rx_resp_ctx := rx_resp_ctx + 1;
2080 if (not cont_req and next_req_ctx == rx_resp_ctx) {
2081 break;
2082 } else {
2083 repeat;
2084 }
2085 }
2086 [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); }
2087 [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); }
2088 }
2089
2090 /* Let's close them now: */
2091 next_req_ctx := 0;
2092 rx_resp_ctx := 0;
2093 T_next.start;
2094 alt {
Pau Espin Pedrol45d57022022-03-08 13:49:02 +01002095 [Gx_PROC.checkstate("Connected")] as_DIA_CCR(TERMINATION_REQUEST) { repeat; }
Pau Espin Pedrolbfea8352022-02-28 12:11:26 +01002096 [] pingpong();
2097 [] T_next.timeout {
2098 f_send_gtpc(ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, teic_list[next_req_ctx], '0001'B, '1'B));
2099 next_req_ctx := next_req_ctx + 1;
2100 if (next_req_ctx < num_ctx) {
2101 T_next.start;
2102 }
2103 repeat;
2104 }
2105 [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextResponse, ?)) -> value udc {
2106 teic := oct2int(udc.gtpc.teid);
2107 if (not match(teic, (1 .. num_ctx))) {
2108 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
2109 "Rx Unexpected TEIC");
2110 }
2111 rx_resp_ctx := rx_resp_ctx + 1;
2112 if (rx_resp_ctx < num_ctx) {
2113 repeat;
2114 }
2115 setverdict(pass);
2116 }
2117 [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); }
2118 [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); }
2119 }
2120 T_next.stop;
2121
2122 T_default.stop;
Pau Espin Pedrolc441ce02022-03-07 14:35:45 +01002123 f_shutdown_helper();
Pau Espin Pedrolbfea8352022-02-28 12:11:26 +01002124 }
2125
Harald Welte94ade362017-08-04 00:36:55 +02002126 control {
Harald Welteed7a1772017-08-09 20:26:20 +02002127 execute(TC_pdp4_act_deact());
2128 execute(TC_pdp4_act_deact_ipcp());
Harald Weltef8298542019-04-10 10:15:28 +02002129 execute(TC_pdp4_act_deact_ipcp_pap_broken());
Harald Welteed7a1772017-08-09 20:26:20 +02002130 execute(TC_pdp4_act_deact_pcodns());
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01002131 execute(TC_pdp4_act_deact_gtpu_access());
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01002132 execute(TC_pdp4_act_deact_gtpu_access_wrong_saddr());
2133 execute(TC_pdp4_act_deact_gtpu_access_ipv6_apn4());
Stefan Sperlingc479e4f2018-04-03 19:34:16 +02002134 execute(TC_pdp4_clients_interact_with_txseq());
2135 execute(TC_pdp4_clients_interact_without_txseq());
Philipp Maier33e52612018-05-30 17:22:02 +02002136 execute(TC_pdp4_act_deact_with_single_dns());
2137 execute(TC_pdp4_act_deact_with_separate_dns());
Pau Espin Pedrolcd326c52022-02-14 18:57:43 +01002138 execute(TC_pdp4_act_update_teic());
2139 execute(TC_pdp4_act_update_teid());
Harald Welteed7a1772017-08-09 20:26:20 +02002140
2141 execute(TC_pdp6_act_deact());
2142 execute(TC_pdp6_act_deact_pcodns());
2143 execute(TC_pdp6_act_deact_icmp6());
Pau Espin Pedrol3d9338f2018-01-29 20:42:54 +01002144 execute(TC_pdp6_act_deact_gtpu_access());
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01002145 execute(TC_pdp6_act_deact_gtpu_access_wrong_ll_saddr());
2146 execute(TC_pdp6_act_deact_gtpu_access_wrong_global_saddr());
2147 execute(TC_pdp6_act_deact_gtpu_access_ipv4_apn6());
Pau Espin Pedrol6c7285d2018-01-30 17:20:22 +01002148 execute(TC_pdp6_clients_interact());
Harald Weltedca80052017-08-13 20:01:38 +02002149
Oliver Smithee6a0882019-03-08 11:05:46 +01002150 execute(TC_pdp46_act_deact());
2151 execute(TC_pdp46_act_deact_ipcp());
2152 execute(TC_pdp46_act_deact_icmp6());
2153 execute(TC_pdp46_act_deact_pcodns4());
2154 execute(TC_pdp46_act_deact_pcodns6());
2155 execute(TC_pdp46_act_deact_gtpu_access());
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01002156 execute(TC_pdp46_act_deact_gtpu_access_wrong_saddr_ipv4());
Pau Espin Pedrolc6ac6952022-02-14 11:19:23 +01002157 execute(TC_pdp46_act_deact_gtpu_access_wrong_ll_saddr_ipv6());
Pau Espin Pedrolc8c03412022-02-11 13:39:26 +01002158 execute(TC_pdp46_act_deact_gtpu_access_wrong_global_saddr_ipv6());
Oliver Smithee6a0882019-03-08 11:05:46 +01002159 execute(TC_pdp46_clients_interact());
Pau Espin Pedrol22d597f2019-08-21 16:16:58 +02002160 execute(TC_pdp46_act_deact_apn4());
Oliver Smithee6a0882019-03-08 11:05:46 +01002161
Harald Weltedca80052017-08-13 20:01:38 +02002162 execute(TC_echo_req_resp());
Pau Espin Pedrol480e67f2022-02-09 16:37:47 +01002163 execute(TC_echo_req_resp_gtpu());
Pau Espin Pedrolfa1ca022019-08-23 18:58:53 +02002164 execute(TC_pdp_act2_recovery());
Pau Espin Pedrol9a5f42f2019-05-27 20:04:35 +02002165 execute(TC_act_deact_retrans_duplicate());
Pau Espin Pedrol6916ec42019-08-23 16:15:07 +02002166
Pau Espin Pedrol6f319f92020-01-03 20:18:57 +01002167 execute(TC_pdp_act_restart_ctr_echo());
Pau Espin Pedrol68c2af52022-02-25 11:56:17 +01002168
2169 execute(TC_lots_of_concurrent_pdp_ctx());
Pau Espin Pedrolbfea8352022-02-28 12:11:26 +01002170 /* Keep at the end, crashes older osmo-ggsn versions (OS#5469): */
2171 execute(TC_addr_pool_exhaustion());
Harald Welte94ade362017-08-04 00:36:55 +02002172 }
Harald Welte379d45a2017-08-03 09:55:15 +02002173}