Harald Welte | 379d45a | 2017-08-03 09:55:15 +0200 | [diff] [blame] | 1 | module GGSN_Tests { |
| 2 | |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 3 | /* 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 Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 15 | import from General_Types all; |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 16 | import from Osmocom_Types all; |
Pau Espin Pedrol | c04c69e | 2020-03-03 16:46:29 +0100 | [diff] [blame] | 17 | import from Misc_Helpers all; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 18 | 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 Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 22 | import from GTP_Templates all; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 23 | import from GTPC_Types all; |
| 24 | import from GTPU_Types all; |
Harald Welte | 71a3602 | 2017-12-04 18:55:58 +0100 | [diff] [blame] | 25 | import from IPCP_Types all; |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 26 | import from PAP_Types all; |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 27 | import from IP_Types all; |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 28 | import from ICMP_Types all; |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 29 | import from ICMPv6_Types all; |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 30 | import from Native_Functions all; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 31 | import from Osmocom_VTY_Functions all; |
| 32 | import from TELNETasp_PortType all; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 33 | |
| 34 | const integer GTP0_PORT := 3386; |
| 35 | const integer GTP1C_PORT := 2123; |
| 36 | const integer GTP1U_PORT := 2152; |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 37 | |
Pau Espin Pedrol | c1b1ddf | 2022-01-19 18:10:30 +0100 | [diff] [blame] | 38 | type enumerated GGSN_Impl { |
| 39 | GGSN_IMPL_OSMOCOM, |
| 40 | GGSN_IMPL_OPEN5GS |
| 41 | }; |
| 42 | |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 43 | modulepar { |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 44 | /* Default IP addresses. May be overridden by GGSN_Tests configuration files. */ |
| 45 | |
| 46 | /* The SGSN simulated by TTCN3 will bind to these addresses for GTP control and GTP user planes. */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 47 | charstring m_bind_ip_gtpc := "127.23.42.1"; |
| 48 | charstring m_bind_ip_gtpu := "127.23.42.1"; |
| 49 | |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 50 | /* Addresses the GGSN which is being tested is listening on for SGSN connections. */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 51 | charstring m_ggsn_ip_gtpc := "127.0.0.6"; |
| 52 | charstring m_ggsn_ip_gtpu := "127.0.0.6"; |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 53 | |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 54 | /* |
| 55 | * Our tests expect to see these DNS servers in 'Create PDP context responses' sent by the GGSN. |
| 56 | * These addresses must therefore match 'ip[v6] dns' options configured in osmo-ggsn.conf. |
| 57 | * |
| 58 | * These addresses are not expected to serve actual DNS requests. However, tests may expect to be |
| 59 | * able to ping these addresses (currently, IPv4 addresses must respond with an ICMP 'echo reply', |
| 60 | * and IPv6 addresses may respond with either ICMPv6 'echo reply' or 'destination unreachable'). |
| 61 | */ |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 62 | charstring m_ggsn_ip4_dns1 := "192.168.100.1" |
| 63 | charstring m_ggsn_ip4_dns2 := "8.8.8.8" |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 64 | charstring m_ggsn_ip6_dns1 := "2001:4860:4860::8888" |
| 65 | charstring m_ggsn_ip6_dns2 := "2001:4860:4860::8844" |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 66 | |
| 67 | /* |
| 68 | * Additional address ranges are defined in osmo-ggsn.conf from which addresses are assigned |
| 69 | * to MS "behind" the simulated SGSN. These addresses appear on tun devices used by osmo-ggsn. |
| 70 | * The tests expect to be able to send ping packets between any two simulated MS within the same |
| 71 | * address range. This requires IP forwarding to be enabled on the corresponding tun interfaces. |
| 72 | */ |
Pau Espin Pedrol | c1b1ddf | 2022-01-19 18:10:30 +0100 | [diff] [blame] | 73 | |
| 74 | GGSN_Impl m_ggsn_impl := GGSN_IMPL_OSMOCOM; |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 75 | } |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 76 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 77 | type set PdpContext { |
| 78 | hexstring imsi, |
| 79 | octetstring msisdn optional, |
| 80 | octetstring apn, |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 81 | ProtConfigOptions pco_req optional, |
| 82 | ProtConfigOptions pco_neg optional, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 83 | EndUserAddress eua, |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 84 | OCT16 ip6_prefix optional, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 85 | BIT4 nsapi, |
| 86 | /* TEI (Data) local side */ |
| 87 | OCT4 teid, |
| 88 | /* TEI (Control) local side */ |
| 89 | OCT4 teic, |
| 90 | /* TEI (Data) remote side */ |
| 91 | OCT4 teid_remote, |
| 92 | /* TEI (Control) remote side */ |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 93 | OCT4 teic_remote, |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 94 | OCT1 ratType optional, |
| 95 | UserLocationInformation uli optional |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 96 | } |
| 97 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 98 | type component GT_CT { |
| 99 | port GTPC_PT GTPC; |
| 100 | port GTPU_PT GTPU; |
| 101 | |
Harald Welte | 0be142b | 2017-08-13 13:28:10 +0200 | [diff] [blame] | 102 | var boolean g_initialized := false; |
| 103 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 104 | var OCT1 g_restart_ctr := '01'O; |
| 105 | /* FIXME: unify with g_bind_ip + parse from config file */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 106 | var OCT4 g_sgsn_ip_c; |
| 107 | var OCT4 g_sgsn_ip_u; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 108 | /* FIXME: parse remName from config file */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 109 | var GtpPeer g_peer_c := { connId := 0, remName := m_ggsn_ip_gtpc, remPort := GTP1C_PORT }; |
| 110 | var GtpPeer g_peer_u := { connId := 0, remName := m_ggsn_ip_gtpu, remPort := GTP1U_PORT }; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 111 | timer T_default := 3.0; |
Harald Welte | 5438b9d | 2017-08-13 13:27:48 +0200 | [diff] [blame] | 112 | |
| 113 | /* next to-be-sent GTP-C sequence number */ |
| 114 | var uint16_t g_c_seq_nr; |
| 115 | /* next to-be-sent GTP-U sequence number */ |
| 116 | var uint16_t g_d_seq_nr; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 117 | |
| 118 | port TELNETasp_PT GGSNVTY; |
Harald Welte | d2394e9 | 2018-04-26 10:21:49 +0200 | [diff] [blame] | 119 | var boolean use_gtpu_txseq := false; |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 120 | var boolean g_use_echo := false; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | private function f_init_vty() runs on GT_CT { |
| 124 | map(self:GGSNVTY, system:GGSNVTY); |
| 125 | f_vty_set_prompts(GGSNVTY); |
| 126 | f_vty_transceive(GGSNVTY, "enable"); |
| 127 | } |
| 128 | |
| 129 | private function f_vty_set_gpdu_txseq(boolean enable) runs on GT_CT { |
| 130 | f_vty_enter_config(GGSNVTY); |
| 131 | f_vty_transceive(GGSNVTY, "ggsn ggsn0"); |
Pau Espin Pedrol | 205a384 | 2018-07-06 13:24:14 +0200 | [diff] [blame] | 132 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 133 | f_vty_transceive(GGSNVTY, "apn internet"); |
| 134 | if (enable) { |
| 135 | f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers"); |
| 136 | } else { |
| 137 | f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers"); |
| 138 | } |
Pau Espin Pedrol | 205a384 | 2018-07-06 13:24:14 +0200 | [diff] [blame] | 139 | f_vty_transceive(GGSNVTY, "exit"); |
| 140 | |
| 141 | f_vty_transceive(GGSNVTY, "apn inet6"); |
| 142 | if (enable) { |
| 143 | f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers"); |
| 144 | } else { |
| 145 | f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers"); |
| 146 | } |
| 147 | f_vty_transceive(GGSNVTY, "exit"); |
| 148 | |
| 149 | f_vty_transceive(GGSNVTY, "apn inet46"); |
| 150 | if (enable) { |
| 151 | f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers"); |
| 152 | } else { |
| 153 | f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers"); |
| 154 | } |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 155 | f_vty_transceive(GGSNVTY, "end"); |
| 156 | } |
| 157 | |
| 158 | private function f_verify_gtpu_txseq(in PDU_GTPU gtpu, in boolean expect_gptu_txseq) return boolean { |
| 159 | if (expect_gptu_txseq) { |
| 160 | if (gtpu.s_bit != '1'B) { |
| 161 | log("GTPU sequence number expected but not present") |
| 162 | return false; |
| 163 | } |
| 164 | } else { |
| 165 | if (gtpu.s_bit != '0'B) { |
| 166 | log("GTPU sequence number not expected but present") |
| 167 | return false; |
| 168 | } |
| 169 | } |
| 170 | return true; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 171 | } |
| 172 | |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 173 | private function f_vty_enable_echo_interval(boolean enable) runs on GT_CT { |
| 174 | f_vty_enter_config(GGSNVTY); |
| 175 | f_vty_transceive(GGSNVTY, "ggsn ggsn0"); |
| 176 | if (enable) { |
| 177 | f_vty_transceive(GGSNVTY, "echo-interval 5"); |
| 178 | } else { |
| 179 | f_vty_transceive(GGSNVTY, "no echo-interval"); |
| 180 | } |
| 181 | f_vty_transceive(GGSNVTY, "end"); |
| 182 | } |
| 183 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 184 | function f_init() runs on GT_CT { |
Harald Welte | 0be142b | 2017-08-13 13:28:10 +0200 | [diff] [blame] | 185 | if (g_initialized == true) { |
| 186 | return; |
| 187 | } |
| 188 | g_initialized := true; |
| 189 | |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 190 | g_sgsn_ip_c := f_inet_addr(m_bind_ip_gtpc); |
| 191 | g_sgsn_ip_u := f_inet_addr(m_bind_ip_gtpu); |
| 192 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 193 | var Result res; |
| 194 | map(self:GTPC, system:GTPC); |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 195 | res := GTP_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, m_bind_ip_gtpc, GTP1C_PORT, {udp:={}}); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 196 | log("GTP1C ConnectionID: ", res.connId); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 197 | g_peer_c.connId := res.connId; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 198 | |
| 199 | map(self:GTPU, system:GTPU); |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 200 | res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, m_bind_ip_gtpu, GTP1U_PORT, {udp:={}}); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 201 | g_peer_u.connId:= res.connId; |
Harald Welte | 5438b9d | 2017-08-13 13:27:48 +0200 | [diff] [blame] | 202 | |
| 203 | g_restart_ctr := f_rnd_octstring(1); |
Harald Welte | 11dbc7b | 2017-08-13 18:57:56 +0200 | [diff] [blame] | 204 | g_c_seq_nr := f_rnd_int(65535); |
| 205 | g_d_seq_nr := f_rnd_int(65535); |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 206 | |
Pau Espin Pedrol | c1b1ddf | 2022-01-19 18:10:30 +0100 | [diff] [blame] | 207 | if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) { |
| 208 | f_init_vty(); |
| 209 | f_vty_set_gpdu_txseq(use_gtpu_txseq); |
| 210 | f_vty_enable_echo_interval(g_use_echo); |
| 211 | } |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 212 | } |
| 213 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 214 | /* Altstep implementing responses to any incoming echo requests */ |
| 215 | altstep pingpong() runs on GT_CT { |
| 216 | var Gtp1cUnitdata ud; |
Harald Welte | 3af8948 | 2017-08-04 16:20:23 +0200 | [diff] [blame] | 217 | var Gtp1uUnitdata udu; |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 218 | [g_use_echo] GTPC.receive(tr_GTPC_PING(?)) -> value ud { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 219 | var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 220 | GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr)); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 221 | repeat; |
| 222 | }; |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 223 | [not g_use_echo] GTPC.receive(tr_GTPC_PING(?)) { |
Pau Espin Pedrol | c04c69e | 2020-03-03 16:46:29 +0100 | [diff] [blame] | 224 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 225 | "GTP Echo Req rceived but not enabled in VTY"); |
Harald Welte | 3af8948 | 2017-08-04 16:20:23 +0200 | [diff] [blame] | 226 | }; |
Pau Espin Pedrol | c04c69e | 2020-03-03 16:46:29 +0100 | [diff] [blame] | 227 | [] T_default.timeout { |
| 228 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 229 | "pinpong T_default timeout"); |
| 230 | }; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 231 | } |
| 232 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 233 | /* 'internet' in DNS encoding */ |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 234 | const octetstring c_ApnInternet := '08696E7465726E6574'O; |
| 235 | const octetstring c_ApnInet6 := '05696E657436'O; |
| 236 | const octetstring c_ApnInet46 := '06696E65743436'O; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 237 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 238 | /* return random NSAPI */ |
| 239 | function f_rnd_nsapi() return BIT4 { |
| 240 | return int2bit(f_rnd_int(16), 4); |
| 241 | } |
| 242 | |
| 243 | /* return random TEI[DC] */ |
| 244 | function f_rnd_tei() return OCT4 { |
| 245 | return int2oct(f_rnd_int(4294967296), 4); |
| 246 | } |
| 247 | |
| 248 | /* define an (internal) representation of a PDP context */ |
| 249 | template PdpContext t_DefinePDP(hexstring imsi, octetstring msisdn, octetstring apn, |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 250 | EndUserAddress eua, OCT1 ratType := '02'O /* GERAN */) := { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 251 | imsi := imsi, |
| 252 | msisdn := msisdn, |
| 253 | nsapi := f_rnd_nsapi(), |
| 254 | apn := apn, |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 255 | pco_req := omit, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 256 | eua := eua, |
| 257 | teid := f_rnd_tei(), |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 258 | teic := f_rnd_tei(), |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 259 | ratType := ratType, |
| 260 | uli := { |
| 261 | type_gtpc := '98'O, |
| 262 | lengthf := 0 /* filled in by encoder */, |
| 263 | geographicLocationType := '00'O /* CGI */, |
| 264 | geographicLocation := { |
| 265 | geographicLocationCGI := ts_GeographicLocationCGI('262'H, '42F'H, '0001'O, '0002'O) |
| 266 | } |
| 267 | } |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | /* send GTP-C for a given context and increment sequence number */ |
Harald Welte | 41575e9 | 2017-08-13 13:49:57 +0200 | [diff] [blame] | 271 | function f_send_gtpc(in template Gtp1cUnitdata data) runs on GT_CT { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 272 | GTPC.send(data); |
Harald Welte | 5438b9d | 2017-08-13 13:27:48 +0200 | [diff] [blame] | 273 | g_c_seq_nr := g_c_seq_nr + 1; |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | /* send GTP-U for a given context and increment sequence number */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 277 | function f_send_gtpu(inout PdpContext ctx, in octetstring data) runs on GT_CT { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 278 | if (use_gtpu_txseq) { |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 279 | GTPU.send(ts_GTP1U_GPDU(g_peer_u, g_d_seq_nr, ctx.teid_remote, data)); |
| 280 | g_d_seq_nr := g_d_seq_nr + 1; |
| 281 | } else { |
| 282 | GTPU.send(ts_GTP1U_GPDU(g_peer_u, omit, ctx.teid_remote, data)); |
| 283 | } |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 284 | } |
| 285 | |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 286 | function f_handle_create_req(inout PdpContext ctx, in Gtp1cUnitdata ud, in OCT1 exp_cause := '80'O) runs on GT_CT { |
| 287 | var CreatePDPContextResponse cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse; |
| 288 | if (exp_cause == '80'O and exp_cause == cpr.cause.causevalue) { |
| 289 | /* Check if EUA type corresponds to requested type */ |
| 290 | if (match(ctx.eua, t_EuaIPv4(?)) and |
| 291 | not match(cpr.endUserAddress, tr_EuaIPv4(?))){ |
| 292 | setverdict(fail); |
| 293 | } |
| 294 | if (match(ctx.eua, t_EuaIPv6(?)) and |
| 295 | not match(cpr.endUserAddress, tr_EuaIPv6(?))) { |
| 296 | setverdict(fail); |
| 297 | } |
| 298 | if (match(ctx.eua, t_EuaIPv4v6(?, ?)) and |
| 299 | not match(cpr.endUserAddress, tr_EuaIPv4v6(?, ?))) { |
| 300 | setverdict(fail); |
| 301 | } |
| 302 | /* Check if PCO response corresponds to request */ |
| 303 | if (ispresent(ctx.pco_req)) { |
| 304 | if (match(ctx.pco_req, ts_PCO_IPv4_DNS_CONT) and |
| 305 | not match(cpr.protConfigOptions, tr_PCO_IPv4_DNS_CONT_resp(?))) { |
| 306 | log("IPv4 DNS Container requested, but missing"); |
| 307 | setverdict(fail); |
| 308 | } |
| 309 | if (match(ctx.pco_req, ts_PCO_IPv6_DNS) and |
| 310 | not match(cpr.protConfigOptions, tr_PCO_IPv6_DNS_resp(?))) { |
| 311 | log("IPv6 DNS Container requested, but missing"); |
| 312 | setverdict(fail); |
| 313 | } |
| 314 | } |
| 315 | ctx.teid_remote := cpr.teidDataI.teidDataI; |
| 316 | ctx.teic_remote := cpr.teidControlPlane.teidControlPlane; |
| 317 | ctx.eua := cpr.endUserAddress; |
| 318 | ctx.pco_neg := cpr.protConfigOptions; |
| 319 | setverdict(pass); |
| 320 | } else if (exp_cause != '80'O and exp_cause == cpr.cause.causevalue) { |
| 321 | if (ispresent(cpr.endUserAddress)) { |
| 322 | log("EUA received on createPDPContextResponse cause=" & oct2str(cpr.cause.causevalue)); |
| 323 | setverdict(fail); |
| 324 | } |
| 325 | setverdict(pass); |
| 326 | } else { |
| 327 | setverdict(fail); |
| 328 | } |
| 329 | } |
| 330 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 331 | /* send a PDP context activation */ |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 332 | function f_pdp_ctx_act(inout PdpContext ctx, OCT1 exp_cause := '80'O) runs on GT_CT { |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 333 | var Gtp1cUnitdata ud; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 334 | var default d; |
| 335 | |
| 336 | log("sending CreatePDP"); |
Harald Welte | 41575e9 | 2017-08-13 13:49:57 +0200 | [diff] [blame] | 337 | f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx.imsi, g_restart_ctr, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 338 | ctx.teid, ctx.teic, ctx.nsapi, ctx.eua, ctx.apn, |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 339 | g_sgsn_ip_c, g_sgsn_ip_u, ctx.msisdn, ctx.pco_req, ctx.ratType, ctx.uli)); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 340 | T_default.start; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 341 | d := activate(pingpong()); |
| 342 | alt { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 343 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctx.teic)) -> value ud { |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 344 | f_handle_create_req(ctx, ud, exp_cause); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 345 | } |
| 346 | } |
| 347 | deactivate(d); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 348 | T_default.stop; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 349 | } |
| 350 | |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 351 | function f_pdp_ctx_exp_del_req(PdpContext ctx, template (omit) OCT1 expect_cause := omit, boolean expect_teardown := false) runs on GT_CT { |
| 352 | var Gtp1cUnitdata ud; |
| 353 | var default d; |
| 354 | |
| 355 | T_default.start; |
| 356 | d := activate(pingpong()); |
| 357 | alt { |
| 358 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctx.teic)) -> value ud { |
| 359 | if (istemplatekind(expect_cause, "omit") and not ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue)) { |
| 360 | setverdict(pass); |
| 361 | } else if (not istemplatekind(expect_cause, "omit") and |
| 362 | ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue) and |
| 363 | ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue == valueof(expect_cause)) { |
| 364 | setverdict(pass); |
| 365 | } else { |
| 366 | setverdict(fail); |
| 367 | } |
| 368 | |
| 369 | if (expect_teardown == ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.tearDownIndicator)) { |
| 370 | setverdict(pass); |
| 371 | } else { |
| 372 | setverdict(fail); |
| 373 | } |
| 374 | } |
| 375 | } |
| 376 | deactivate(d); |
| 377 | T_default.stop; |
| 378 | } |
| 379 | |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 380 | function f_pdp_ctx_del(PdpContext ctx, template BIT1 teardown_ind, OCT1 expect_causevalue := '80'O) runs on GT_CT { |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 381 | var Gtp1cUnitdata ud; |
| 382 | var default d; |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 383 | var OCT4 expect_teid; |
| 384 | |
| 385 | /* 3GPP TS 29.060 sec 7.3.6 specifies TEID used in response |
| 386 | message with cause value "Non existent" shall be zero. */ |
| 387 | if (expect_causevalue == 'C0'O) { |
| 388 | expect_teid := '00000000'O; |
| 389 | } else { |
| 390 | expect_teid := ctx.teic; |
| 391 | } |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 392 | |
Harald Welte | 41575e9 | 2017-08-13 13:49:57 +0200 | [diff] [blame] | 393 | f_send_gtpc(ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, ctx.teic_remote, ctx.nsapi, teardown_ind)); |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 394 | T_default.start; |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 395 | d := activate(pingpong()); |
| 396 | alt { |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 397 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextResponse, expect_teid)) -> value ud { |
| 398 | if (ud.gtpc.gtpc_pdu.deletePDPContextResponse.cause.causevalue == expect_causevalue) { |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 399 | setverdict(pass); |
| 400 | } else { |
| 401 | setverdict(fail); |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | deactivate(d); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 406 | T_default.stop; |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 407 | } |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 408 | /* IPv6 router solicitation fe80::2 -> ff02::2 from 02:88:b5:1f:25:59 */ |
| 409 | const octetstring c_router_solicit := '6000000000103afffe800000000000000000000000000002ff02000000000000000000000000000285009f2b0000000001010288b51f2559'O; |
| 410 | /* IPv6 neighbor solicitation fe80::2 -> ff02::1:ff00:2 from 02:88:b5:1f:25:59 */ |
| 411 | const octetstring c_neigh_solicit:= '6000000000203afffe800000000000000000000000000002ff0200000000000000000001ff00000287009f9600000000fe80000000000000000000000000000201010288b51f2559'O; |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 412 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 413 | /* template for sending an ICMPv4 echo request */ |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 414 | template PDU_ICMP ts_ICMPv4_ERQ := { |
| 415 | echo := { |
| 416 | type_field := 8, |
| 417 | code := 0, |
| 418 | checksum := '0000'O, |
| 419 | identifier := '0345'O, |
| 420 | sequence_number := '0001'O, |
| 421 | data := ''O |
| 422 | } |
| 423 | } |
| 424 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 425 | /* template for receiving/matching an ICMPv4 echo request */ |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 426 | template PDU_ICMP tr_ICMPv4_ERQ := { |
| 427 | echo := { |
| 428 | type_field := 8, |
| 429 | code := 0, |
| 430 | checksum := ?, |
| 431 | identifier := ?, |
| 432 | sequence_number := ?, |
| 433 | data := ? |
| 434 | } |
| 435 | } |
| 436 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 437 | /* template for receiving/matching an ICMPv4 echo reply */ |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 438 | template PDU_ICMP tr_ICMPv4_ERP(template octetstring data := *) := { |
| 439 | echo_reply := { |
| 440 | type_field := 0, |
| 441 | code := 0, |
| 442 | checksum := ?, |
| 443 | identifier := ?, |
| 444 | sequence_number := ?, |
| 445 | data := data |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | /* template for receiving/matching an ICMPv6 Destination Unreachable */ |
| 450 | template PDU_ICMP tr_ICMPv4_DU := { |
| 451 | destination_unreachable := { |
| 452 | type_field := 1, |
| 453 | code := ?, |
| 454 | checksum := ?, |
| 455 | unused := ?, |
| 456 | original_ip_msg := ? |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | /* template to construct IPv4_packet from input arguments, ready for use in f_IPv4_enc() */ |
| 461 | template IPv4_packet ts_IP4(OCT4 srcaddr, OCT4 dstaddr, LIN1 proto, LIN2_BO_LAST tlen, octetstring payload) := { |
| 462 | header := { |
| 463 | ver := 4, |
| 464 | hlen := 5, |
| 465 | tos := 0, |
| 466 | tlen := tlen, |
| 467 | id := 35902, |
| 468 | res := '0'B, |
| 469 | dfrag := '1'B, |
| 470 | mfrag := '0'B, |
| 471 | foffset := 0, |
| 472 | ttl := 64, |
| 473 | proto := proto, |
| 474 | cksum := 0, |
| 475 | srcaddr := srcaddr, |
| 476 | dstaddr := dstaddr |
| 477 | }, |
| 478 | ext_headers := omit, |
| 479 | payload := payload |
| 480 | } |
| 481 | |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 482 | /* template to generate a 'Prefix Information' ICMPv6 option */ |
| 483 | template OptionField ts_ICMP6_OptPrefix(OCT16 prefix, INT1 prefix_len) := { |
| 484 | prefixInformation := { |
| 485 | typeField := 3, |
| 486 | lengthIndicator := 8, |
| 487 | prefixLength := prefix_len, |
| 488 | reserved1 := '000000'B, |
| 489 | a_Bit := '0'B, |
| 490 | l_Bit := '0'B, |
| 491 | validLifetime := oct2int('FFFFFFFF'O), |
| 492 | preferredLifetime := oct2int('FFFFFFFF'O), |
| 493 | reserved2 := '00000000'O, |
| 494 | prefix := prefix |
| 495 | } |
| 496 | } |
| 497 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 498 | /* template for sending an ICMPv6 echo request */ |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 499 | template PDU_ICMPv6 ts_ICMPv6_ERQ := { |
| 500 | echoRequest := { |
| 501 | typeField := 128, |
| 502 | code := 0, |
| 503 | checksum := '0000'O, |
| 504 | identifier := 0, |
| 505 | sequenceNr := 0, |
| 506 | data := ''O |
| 507 | } |
| 508 | } |
| 509 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 510 | /* template for sending an ICMPv6 router solicitation */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 511 | template PDU_ICMPv6 ts_ICMPv6_RS := { |
| 512 | routerSolicitation := { |
| 513 | typeField := 133, |
| 514 | code := 0, |
| 515 | checksum := '0000'O, |
| 516 | reserved := '00000000'O, |
| 517 | /* TODO: do we need 'Source link-layer address' ? */ |
| 518 | options := omit |
| 519 | } |
| 520 | } |
| 521 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 522 | /* template for sending an ICMPv6 router advertisement */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 523 | template PDU_ICMPv6 ts_ICMPv6_RA(OCT16 prefix, INT1 prefix_len) := { |
| 524 | routerAdvertisement := { |
| 525 | typeField := 134, |
| 526 | code := 0, |
| 527 | checksum := '0000'O, |
| 528 | curHopLimit := ?, |
| 529 | reserved := '000000'B, |
| 530 | o_Bit := '0'B, |
| 531 | m_Bit := '0'B, |
| 532 | routerLifetime := oct2int('FFFF'O), |
| 533 | reachableTime := oct2int('FFFFFFFF'O), |
| 534 | retransTimer := oct2int('FFFFFFFF'O), |
| 535 | options := { |
| 536 | ts_ICMP6_OptPrefix(prefix, prefix_len) |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 541 | /* template for sending an ICMPv6 neighbor solicitation */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 542 | template PDU_ICMPv6 ts_ICMPv6_NS(OCT16 target_addr) := { |
| 543 | neighborSolicitation := { |
| 544 | typeField := 135, |
| 545 | code := 0, |
| 546 | checksum := '0000'O, |
| 547 | reserved := '00000000'O, |
| 548 | targetAddress := target_addr, |
| 549 | /* TODO: do we need 'Source link-layer address' ? */ |
| 550 | options := omit |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | /* derive ICMPv6 link-local address from lower 64bit of link_id */ |
| 555 | /* template for receiving/matching an ICMPv6 'Prefix Information' option */ |
| 556 | template OptionField tr_ICMP6_OptPrefix(template OCT16 prefix, template INT1 prefix_len) := { |
| 557 | prefixInformation := { |
| 558 | typeField := 3, |
| 559 | lengthIndicator := 4, |
| 560 | prefixLength := prefix_len, |
| 561 | reserved1 := ?, |
| 562 | a_Bit := ?, |
| 563 | l_Bit := ?, |
| 564 | validLifetime := ?, |
| 565 | preferredLifetime := ?, |
| 566 | reserved2 := ?, |
| 567 | prefix := prefix |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | /* template for receiving/matching an ICMPv6 router advertisement */ |
| 572 | template PDU_ICMPv6 tr_ICMPv6_RA(template OCT16 prefix, template INT1 prefix_len) := { |
| 573 | routerAdvertisement := { |
| 574 | typeField := 134, |
| 575 | code := 0, |
| 576 | checksum := ?, |
| 577 | curHopLimit := ?, |
| 578 | reserved := ?, |
| 579 | o_Bit := '0'B, |
| 580 | m_Bit := '0'B, |
| 581 | routerLifetime := ?, |
| 582 | reachableTime := ?, |
| 583 | retransTimer := ?, |
| 584 | options := { |
| 585 | tr_ICMP6_OptPrefix(prefix, prefix_len) |
| 586 | } |
| 587 | } |
| 588 | } |
| 589 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 590 | /* template for receiving/matching an ICMPv6 Destination Unreachable */ |
| 591 | template PDU_ICMPv6 tr_ICMPv6_DU := { |
| 592 | destinationUnreachable := { |
| 593 | typeField := 1, |
| 594 | code := ?, |
| 595 | checksum := ?, |
| 596 | unused := ?, |
| 597 | originalIpMsg := ? |
| 598 | } |
| 599 | } |
| 600 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 601 | /* template for receiving/matching an ICMPv6 echo request */ |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 602 | template PDU_ICMPv6 tr_ICMPv6_ERQ := { |
| 603 | echoRequest := { |
| 604 | typeField := 128, |
| 605 | code := 0, |
| 606 | checksum := ?, |
| 607 | identifier := ?, |
| 608 | sequenceNr := ?, |
| 609 | data := ? |
| 610 | } |
| 611 | } |
| 612 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 613 | /* template for receiving/matching an ICMPv6 echo reply */ |
| 614 | template PDU_ICMPv6 tr_ICMPv6_ERP(template octetstring data := *) := { |
| 615 | echoReply := { |
| 616 | typeField := 129, |
| 617 | code := 0, |
| 618 | checksum := ?, |
| 619 | identifier := ?, |
| 620 | sequenceNr := ?, |
| 621 | data := data |
| 622 | } |
| 623 | } |
| 624 | |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 625 | /* template to construct IPv6_packet from input arguments, ready for use in f_IPv6_enc() */ |
| 626 | template IPv6_packet ts_IP6(OCT16 srcaddr, OCT16 dstaddr, LIN1 nexthead, octetstring payload, LIN1 hlim := 255) := { |
| 627 | header := { |
| 628 | ver := 6, |
| 629 | trclass := 0, |
| 630 | flabel := 0, |
| 631 | plen := 0, |
| 632 | nexthead := nexthead, |
| 633 | hlim := hlim, |
| 634 | srcaddr := srcaddr, |
| 635 | dstaddr := dstaddr |
| 636 | }, |
| 637 | ext_headers := omit, |
| 638 | payload := payload |
| 639 | } |
| 640 | |
| 641 | function f_ipv6_link_local(in OCT16 link_id) return OCT16 { |
| 642 | return 'FE80000000000000'O & substr(link_id, 8, 8); |
| 643 | } |
| 644 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 645 | function f_ipv6_global(in OCT16 link_id) return OCT16 { |
| 646 | return substr(link_id, 0, 8) & '1234123412341234'O; |
| 647 | } |
| 648 | |
| 649 | /* Create a new different IPv6 addr from input. Starts mangling at byte prefix. */ |
| 650 | function f_ipv6_mangle(in OCT16 addr, in integer prefix := 0) return OCT16 { |
| 651 | var integer i; |
| 652 | var octetstring res := substr(addr, 0, prefix); |
| 653 | for (i := prefix; i < lengthof(addr); i := i + 1) { |
| 654 | var octetstring a := addr[i] xor4b '11'O; |
| 655 | res := res & a; |
| 656 | } |
| 657 | return res; |
| 658 | } |
| 659 | |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 660 | /* Compute solicited-node multicast address as per RFC4291 2.7.1 */ |
| 661 | function f_ipv6_sol_node_mcast(in OCT16 addr) return OCT16 { |
| 662 | return 'FF0200000000000000000001FF'O & substr(addr, 13, 3); |
| 663 | } |
| 664 | |
| 665 | /* generate and encode ICMPv6 router solicitation */ |
| 666 | function f_gen_icmpv6_router_solicitation(in OCT16 link_id) return octetstring { |
| 667 | const OCT16 c_ip6_all_router_mcast := 'FF020000000000000000000000000002'O; |
| 668 | var OCT16 saddr := f_ipv6_link_local(link_id); |
| 669 | |
| 670 | var octetstring tmp; |
| 671 | tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_RS), saddr, c_ip6_all_router_mcast); |
| 672 | var IPv6_packet ip6 := valueof(ts_IP6(saddr, c_ip6_all_router_mcast, 58, tmp)); |
| 673 | |
| 674 | return f_IPv6_enc(ip6); |
| 675 | } |
| 676 | |
| 677 | /* create ICMPv6 router solicitation deriving link-id from PDP Context EUA */ |
| 678 | function f_icmpv6_rs_for_pdp(in PdpContext ctx) return octetstring { |
| 679 | var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address; |
| 680 | return f_gen_icmpv6_router_solicitation(interface_id); |
| 681 | } |
| 682 | |
| 683 | /* generate and encode ICMPv6 neighbor solicitation */ |
| 684 | function f_gen_icmpv6_neigh_solicit(in OCT16 saddr, in OCT16 daddr, in OCT16 tgt_addr) return octetstring { |
| 685 | var octetstring tmp; |
| 686 | tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_NS(tgt_addr)), saddr, daddr); |
| 687 | var IPv6_packet ip6 := valueof(ts_IP6(saddr, daddr, 58, tmp)); |
| 688 | return f_IPv6_enc(ip6); |
| 689 | } |
| 690 | |
| 691 | /* generate and encode ICMPv6 neighbor solicitation for PDP Context */ |
| 692 | function f_gen_icmpv6_neigh_solicit_for_pdp(in PdpContext ctx) return octetstring { |
| 693 | var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address; |
| 694 | var OCT16 link_local := f_ipv6_link_local(interface_id); |
| 695 | var OCT16 daddr := f_ipv6_sol_node_mcast(link_local); |
| 696 | |
| 697 | return f_gen_icmpv6_neigh_solicit(link_local, daddr, link_local); |
| 698 | } |
| 699 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 700 | /* Send an ICMPv4 echo msg through GTP given pdp ctx, and ip src and dst addr */ |
| 701 | function f_gen_icmpv4_echo(OCT4 saddr, OCT4 daddr) return octetstring { |
| 702 | var octetstring tmp := f_enc_PDU_ICMP(valueof(ts_ICMPv4_ERQ)); |
| 703 | var IPv4_packet ip4 := valueof(ts_IP4(saddr, daddr, 1, 50, tmp)); |
| 704 | var octetstring data := f_IPv4_enc(ip4); |
| 705 | var OCT2 cksum := f_IPv4_checksum(data); |
| 706 | data[10] := cksum[0]; |
| 707 | data[11] := cksum[1]; |
| 708 | return data; |
| 709 | } |
| 710 | |
| 711 | /* Send an ICMPv6 echo msg through GTP given pdp ctx, and ip src and dst addr */ |
| 712 | function f_gen_icmpv6_echo(OCT16 saddr, OCT16 daddr) return octetstring { |
| 713 | var octetstring tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_ERQ), saddr, daddr); |
| 714 | var IPv6_packet ip6 := valueof(ts_IP6(saddr, daddr, 58, tmp)); |
| 715 | var octetstring data := f_IPv6_enc(ip6); |
| 716 | return data; |
| 717 | } |
| 718 | |
| 719 | /* Wait for ICMPv4 from GTP */ |
| 720 | function f_wait_icmp4(PdpContext ctx, template PDU_ICMP expected) runs on GT_CT { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 721 | var Gtp1uUnitdata ud; |
| 722 | T_default.start; |
| 723 | alt { |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 724 | [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 725 | if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == false) { |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 726 | setverdict(fail); |
| 727 | stop; |
| 728 | } |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 729 | var octetstring gpdu := ud.gtpu.gtpu_IEs.g_PDU_IEs.data; |
| 730 | var IPv4_packet ip4 := f_IPv4_dec(gpdu); |
| 731 | if (ip4.header.ver != 4) { |
| 732 | repeat; |
| 733 | } |
| 734 | var PDU_ICMP icmp4 := f_dec_PDU_ICMP(ip4.payload); |
| 735 | if (not match(icmp4, expected)) { |
| 736 | repeat; |
| 737 | } |
| 738 | } |
| 739 | [] GTPU.receive { setverdict(fail); } |
| 740 | [] T_default.timeout { setverdict(fail); } |
| 741 | } |
| 742 | T_default.stop; |
| 743 | } |
| 744 | |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 745 | /* Wait for ICMPv4 echo request from GTP */ |
| 746 | function f_wait_icmp4_echo_request(PdpContext ctx) runs on GT_CT { |
| 747 | f_wait_icmp4(ctx, tr_ICMPv4_ERQ); |
| 748 | } |
| 749 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 750 | /* Wait for ICMPv4 echo reply (or unreachable) from GTP */ |
| 751 | function f_wait_icmp4_echo_reply(PdpContext ctx) runs on GT_CT { |
| 752 | f_wait_icmp4(ctx, (tr_ICMPv4_ERP, tr_ICMPv4_DU)); |
| 753 | } |
| 754 | |
| 755 | /* Wait for ICMPv6 from GTP */ |
| 756 | function f_wait_icmp6(PdpContext ctx, template PDU_ICMPv6 expected) runs on GT_CT { |
| 757 | var Gtp1uUnitdata ud; |
| 758 | T_default.start; |
| 759 | alt { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 760 | [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 761 | if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == false) { |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 762 | setverdict(fail); |
| 763 | stop; |
| 764 | } |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 765 | var octetstring gpdu := ud.gtpu.gtpu_IEs.g_PDU_IEs.data; |
| 766 | var IPv6_packet ip6 := f_IPv6_dec(gpdu); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 767 | if (ip6.header.ver != 6 or ip6.header.nexthead != 58) { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 768 | repeat; |
| 769 | } |
| 770 | var PDU_ICMPv6 icmp6 := f_dec_PDU_ICMPv6(ip6.payload); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 771 | if (not match(icmp6, expected)) { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 772 | repeat; |
| 773 | } |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 774 | /* We are waiting for RA, update ctx */ |
| 775 | if (match(icmp6, tr_ICMPv6_RA(?, 64))) { |
| 776 | ctx.ip6_prefix := icmp6.routerAdvertisement.options[0].prefixInformation.prefix; |
| 777 | log("RA with /64 prefix ", ctx.ip6_prefix); |
| 778 | } |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 779 | } |
| 780 | [] GTPU.receive(tr_GTPU_GPDU(?, ?)) { repeat; } |
| 781 | [] GTPU.receive { setverdict(fail); } |
| 782 | [] T_default.timeout { setverdict(fail); } |
| 783 | } |
| 784 | T_default.stop; |
| 785 | } |
| 786 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 787 | /* wait for GGSN to send us an ICMPv6 router advertisement */ |
| 788 | function f_wait_rtr_adv(PdpContext ctx) runs on GT_CT { |
| 789 | f_wait_icmp6(ctx, tr_ICMPv6_RA(?, 64)); |
| 790 | } |
| 791 | |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 792 | /* Wait for ICMPv6 echo request from GTP */ |
| 793 | function f_wait_icmp6_echo_request(PdpContext ctx) runs on GT_CT { |
| 794 | f_wait_icmp6(ctx, tr_ICMPv6_ERQ); |
| 795 | } |
| 796 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 797 | /* Wait for ICMPv6 echo reply (or unreachable) from GTP */ |
| 798 | function f_wait_icmp6_echo_reply(PdpContext ctx) runs on GT_CT { |
| 799 | f_wait_icmp6(ctx, (tr_ICMPv6_ERP,tr_ICMPv6_DU)); |
| 800 | } |
| 801 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 802 | /* create ICMPv6 router solicitation deriving link-id from PDP Context EUA */ |
| 803 | function f_icmpv6_rs_for_pdp46(in PdpContext ctx) return octetstring { |
| 804 | var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address; |
| 805 | return f_gen_icmpv6_router_solicitation(interface_id); |
| 806 | } |
| 807 | |
| 808 | /* generate and encode ICMPv6 neighbor solicitation for PDP Context */ |
| 809 | function f_gen_icmpv6_neigh_solicit_for_pdp46(in PdpContext ctx) return octetstring { |
| 810 | var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address; |
| 811 | var OCT16 link_local := f_ipv6_link_local(interface_id); |
| 812 | var OCT16 daddr := f_ipv6_sol_node_mcast(link_local); |
| 813 | |
| 814 | return f_gen_icmpv6_neigh_solicit(link_local, daddr, link_local); |
| 815 | } |
| 816 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 817 | /* Assert we don't receive a ICMPv4/6 echo reply (or unreachable) from GTP */ |
| 818 | function f_wait_gtpu_fail(PdpContext ctx) runs on GT_CT { |
| 819 | T_default.start; |
| 820 | alt { |
| 821 | [] GTPU.receive { setverdict(fail); } |
| 822 | [] T_default.timeout { } |
| 823 | } |
| 824 | T_default.stop; |
| 825 | } |
| 826 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 827 | /* list of protocols where we don't accept duplicates */ |
| 828 | const OCT2List protocol_ids_nodupes := { 'C021'O, 'C023'O, 'C223'O, '8021'O }; |
| 829 | private function f_PCO_permits_duplicates(OCT2 id) return boolean { |
| 830 | var integer i; |
| 831 | for (i := 0; i < lengthof(protocol_ids_nodupes); i := i+1) { |
| 832 | if (id == protocol_ids_nodupes[i]) { |
| 833 | return false; |
| 834 | } |
| 835 | } |
| 836 | return true; |
| 837 | } |
| 838 | |
| 839 | /* ensure that every given protocol Identifier exist only exactly once in the PCO */ |
| 840 | function f_PCO_ensure_no_duplicates(ProtConfigOptions pco) { |
| 841 | var OCT2List protocol_ids := {}; |
| 842 | var integer i, j; |
| 843 | for (i := 0; i < lengthof(pco.protocols); i := i+1) { |
| 844 | var OCT2 id := pco.protocols[i].protocolID; |
| 845 | for (j := 0; j < lengthof(protocol_ids); j := j+1) { |
| 846 | if (not f_PCO_permits_duplicates(id) and id == protocol_ids[j]) { |
| 847 | setverdict(fail, "Duplicate ProtocolID ", id, " already present in ", pco.protocols); |
| 848 | } |
| 849 | } |
| 850 | protocol_ids := protocol_ids & { id }; |
| 851 | } |
| 852 | } |
| 853 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 854 | /* Test IPv6 context activation for dynamic IPv6 EUA without request of IPv6 DNS */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 855 | testcase TC_pdp6_act_deact() runs on GT_CT { |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 856 | f_init(); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 857 | |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 858 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 859 | f_pdp_ctx_act(ctx); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 860 | f_pdp_ctx_del(ctx, '1'B); |
| 861 | } |
| 862 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 863 | /* Test IPv6 context activation for dynamic IPv6 EUA wirh request of IPv6 DNS in PCO */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 864 | testcase TC_pdp6_act_deact_pcodns() runs on GT_CT { |
| 865 | f_init(); |
| 866 | |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 867 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 868 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 869 | f_pdp_ctx_act(ctx); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 870 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 871 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 872 | /* verify PCO contains both primary and secondary DNS */ |
| 873 | var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1); |
| 874 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), ggsn_ip6_dns1)) { |
| 875 | setverdict(fail, "Primary DNS IPv6 PCO option not found"); |
| 876 | } |
| 877 | |
| 878 | var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2); |
| 879 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), ggsn_ip6_dns2)) { |
| 880 | setverdict(fail, "Secondary DNS IPv6 PCO option not found"); |
| 881 | } |
| 882 | |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 883 | f_pdp_ctx_del(ctx, '1'B); |
| 884 | } |
| 885 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 886 | /* Test PDP context activation for dynamic IPv6 EUA with IPv6 DNS in PCO and router solicitation/advertisement */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 887 | testcase TC_pdp6_act_deact_icmp6() runs on GT_CT { |
| 888 | f_init(); |
| 889 | |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 890 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 891 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 892 | f_pdp_ctx_act(ctx); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 893 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 894 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 895 | //f_send_gtpu(ctx, c_router_solicit); |
| 896 | //f_send_gtpu(ctx, c_neigh_solicit); |
| 897 | |
| 898 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 899 | f_wait_rtr_adv(ctx); |
| 900 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 901 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 902 | f_pdp_ctx_del(ctx, '1'B); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 903 | } |
| 904 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 905 | /* Test PDP context activation for dynamic IPv6 EUA with IPv6 DNS in PCO and router solicitation/advertisement. |
| 906 | Test we can send ICMPv6 ping over GTPU to DNS server. */ |
| 907 | testcase TC_pdp6_act_deact_gtpu_access() runs on GT_CT { |
| 908 | f_init(); |
| 909 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 910 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 911 | f_pdp_ctx_act(ctx); |
| 912 | |
| 913 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 914 | f_wait_rtr_adv(ctx); |
| 915 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 916 | |
| 917 | var OCT16 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '0003'O); |
| 918 | |
| 919 | /* Check if we can use valid link-local src addr. */ |
| 920 | var OCT16 saddr_ll := f_ipv6_link_local(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 921 | f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_ll, dns1_addr)); |
| 922 | f_wait_icmp6_echo_reply(ctx); |
| 923 | |
| 924 | /* Check that attempting RA with another ll src addr won't work, packet dropped: */ |
| 925 | var OCT16 saddr_ll_wrong := f_ipv6_mangle(saddr_ll, 8); |
| 926 | f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_ll_wrong)); |
| 927 | f_wait_gtpu_fail(ctx); |
| 928 | |
| 929 | /* Check if we can use valid global src addr, should work */ |
| 930 | var OCT16 saddr_glob := f_ipv6_global(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 931 | f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_glob, dns1_addr)); |
| 932 | f_wait_icmp6_echo_reply(ctx); |
| 933 | |
| 934 | /* Assert that packets with wrong global src addr are dropped by GGSN */ |
| 935 | var OCT16 saddr_wrong := f_ipv6_mangle(saddr_glob); |
| 936 | f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_wrong, dns1_addr)); |
| 937 | f_wait_gtpu_fail(ctx); |
| 938 | |
| 939 | /* Send an IPv4 ICMP ECHO REQUEST to APN6, should fail (packet dropped) */ |
| 940 | var OCT4 saddr_v4 := f_inet_addr("192.168.10.2"); |
| 941 | var OCT4 daddr_v4 := f_inet_addr("8.8.8.8"); |
| 942 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_v4, daddr_v4)); |
| 943 | f_wait_gtpu_fail(ctx); |
| 944 | |
| 945 | f_pdp_ctx_del(ctx, '1'B); |
| 946 | } |
| 947 | |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 948 | /* Validate if different clients (pdp ctx) can reach one another through GGSN. */ |
| 949 | testcase TC_pdp6_clients_interact() runs on GT_CT { |
| 950 | f_init(); |
| 951 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 952 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 953 | f_pdp_ctx_act(ctxA); |
| 954 | f_send_gtpu(ctxA, f_icmpv6_rs_for_pdp(ctxA)); |
| 955 | f_wait_rtr_adv(ctxA); |
| 956 | f_send_gtpu(ctxA, f_gen_icmpv6_neigh_solicit_for_pdp(ctxA)); |
| 957 | |
| 958 | f_pdp_ctx_act(ctxB); |
| 959 | f_send_gtpu(ctxB, f_icmpv6_rs_for_pdp(ctxB)); |
| 960 | f_wait_rtr_adv(ctxB); |
| 961 | f_send_gtpu(ctxB, f_gen_icmpv6_neigh_solicit_for_pdp(ctxB)); |
| 962 | |
| 963 | var OCT16 addrA_ll := f_ipv6_link_local(ctxA.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 964 | var OCT16 addrB_ll := f_ipv6_link_local(ctxB.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 965 | var OCT16 addrA_glob := f_ipv6_global(ctxA.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 966 | var OCT16 addrB_glob := f_ipv6_global(ctxB.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 967 | |
| 968 | /* Validate if clients can interact using ll addr. */ |
| 969 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_ll, addrB_ll)); |
| 970 | f_wait_gtpu_fail(ctxB); |
| 971 | |
| 972 | /* Validate if clients can interact using global addr. */ |
| 973 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_glob, addrB_glob)); |
| 974 | f_wait_gtpu_fail(ctxB); |
| 975 | |
| 976 | f_pdp_ctx_del(ctxA, '1'B); |
Pau Espin Pedrol | bb2bb06 | 2019-09-03 12:28:12 +0200 | [diff] [blame] | 977 | f_pdp_ctx_del(ctxB, '1'B); |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 978 | } |
| 979 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 980 | /* Test PDP context activation for dynamic IPv4 EUA without DNS request */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 981 | testcase TC_pdp4_act_deact() runs on GT_CT { |
| 982 | f_init(); |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 983 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 984 | f_pdp_ctx_act(ctx); |
| 985 | f_pdp_ctx_del(ctx, '1'B); |
| 986 | } |
| 987 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 988 | /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in IPCP */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 989 | testcase TC_pdp4_act_deact_ipcp() runs on GT_CT { |
| 990 | f_init(); |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 991 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 992 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 993 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 994 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 995 | f_pdp_ctx_act(ctx); |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 996 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Harald Welte | 71a3602 | 2017-12-04 18:55:58 +0100 | [diff] [blame] | 997 | /* verify IPCP is at all contained */ |
| 998 | if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) { |
| 999 | setverdict(fail, "IPCP not found in PCO"); |
| 1000 | } |
| 1001 | /* verify IPCP contains both primary and secondary DNS */ |
| 1002 | var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O)); |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 1003 | if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) { |
| 1004 | if (not match(ipcp, tr_IPCP_Ack_DNS(0))) { |
| 1005 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found"); |
| 1006 | } else { |
| 1007 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values"); |
| 1008 | } |
Harald Welte | 71a3602 | 2017-12-04 18:55:58 +0100 | [diff] [blame] | 1009 | } |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1010 | f_pdp_ctx_del(ctx, '1'B); |
| 1011 | } |
| 1012 | |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 1013 | /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in IPCP + PAP authentication (broken) */ |
| 1014 | testcase TC_pdp4_act_deact_ipcp_pap_broken() runs on GT_CT { |
| 1015 | f_init(); |
| 1016 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1017 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1018 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1019 | ctx.pco_req := valueof(ts_PCO_PAP_IPv4_DNS); |
| 1020 | f_pdp_ctx_act(ctx); |
| 1021 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
| 1022 | /* verify IPCP is at all contained */ |
| 1023 | if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) { |
| 1024 | setverdict(fail, "IPCP not found in PCO"); |
| 1025 | } |
| 1026 | /* verify IPCP contains both primary and secondary DNS */ |
| 1027 | var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O)); |
| 1028 | if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) { |
| 1029 | if (not match(ipcp, tr_IPCP_Ack_DNS(0))) { |
| 1030 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found"); |
| 1031 | } else { |
| 1032 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values"); |
| 1033 | } |
| 1034 | } |
| 1035 | /* verify that PAP is contained */ |
| 1036 | if (not match(ctx.pco_neg, tr_PCO_Contains('C023'O))) { |
| 1037 | setverdict(fail, "PAP not found in PCO"); |
| 1038 | } |
| 1039 | var PapPacket pap := dec_PapPacket(f_PCO_extract_proto(ctx.pco_neg, 'C023'O)); |
| 1040 | if (not match(pap, tr_PAP_AuthAck)) { |
| 1041 | setverdict(fail, "PAP isn't an AuthenticateAck: ", pap); |
| 1042 | } |
| 1043 | f_pdp_ctx_del(ctx, '1'B); |
| 1044 | } |
| 1045 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 1046 | /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in PCO */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1047 | testcase TC_pdp4_act_deact_pcodns() runs on GT_CT { |
| 1048 | f_init(); |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 1049 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1050 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1051 | f_pdp_ctx_act(ctx); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 1052 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1053 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 1054 | /* verify PCO contains both primary and secondary DNS */ |
| 1055 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1056 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), ggsn_ip4_dns1)) { |
| 1057 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1058 | } |
| 1059 | |
| 1060 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1061 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), ggsn_ip4_dns2)) { |
| 1062 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1063 | } |
| 1064 | |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1065 | f_pdp_ctx_del(ctx, '1'B); |
| 1066 | } |
| 1067 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1068 | /* Test PDP context activation for dynamic IPv4 EUA. |
| 1069 | Test we can send ICMPv6 ping over GTPU to DNS server. */ |
| 1070 | testcase TC_pdp4_act_deact_gtpu_access() runs on GT_CT { |
| 1071 | f_init(); |
| 1072 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1073 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1074 | f_pdp_ctx_act(ctx); |
| 1075 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1076 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1077 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 1078 | |
| 1079 | /* Check if we can use valid global src addr, should work */ |
| 1080 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 1081 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 1082 | f_wait_icmp4_echo_reply(ctx); |
| 1083 | |
| 1084 | /* Assert that packets with wrong global src addr are dropped by GGSN */ |
| 1085 | var OCT4 saddr_wrong := substr(saddr, 0, 3) & (saddr[3] xor4b '11'O); |
| 1086 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_wrong, dns1_addr)); |
| 1087 | f_wait_gtpu_fail(ctx); |
| 1088 | |
| 1089 | /* Send an IPv6 RA to APN4, should fail (packet dropped) */ |
| 1090 | var OCT16 saddr_v6 := f_inet6_addr("fde4:8dba:82e1:2000:1:2:3:4"); |
| 1091 | f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_v6)); |
| 1092 | f_wait_gtpu_fail(ctx); |
| 1093 | f_pdp_ctx_del(ctx, '1'B); |
| 1094 | } |
| 1095 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1096 | /* Helper function for tests below. */ |
| 1097 | function f_pdp4_clients_interact() runs on GT_CT { |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1098 | f_init(); |
| 1099 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1100 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1101 | f_pdp_ctx_act(ctxA); |
| 1102 | f_pdp_ctx_act(ctxB); |
| 1103 | var OCT4 addrA := ctxA.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 1104 | var OCT4 addrB := ctxB.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 1105 | f_send_gtpu(ctxA, f_gen_icmpv4_echo(addrA, addrB)); |
| 1106 | f_wait_icmp4_echo_request(ctxB); |
| 1107 | |
| 1108 | f_pdp_ctx_del(ctxA, '1'B); |
Pau Espin Pedrol | bb2bb06 | 2019-09-03 12:28:12 +0200 | [diff] [blame] | 1109 | f_pdp_ctx_del(ctxB, '1'B); |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1110 | } |
| 1111 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1112 | /* Validate if different clients (pdp ctx) can reach one another through GGSN. */ |
| 1113 | testcase TC_pdp4_clients_interact_with_txseq() runs on GT_CT { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 1114 | use_gtpu_txseq := true; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1115 | f_pdp4_clients_interact(); |
| 1116 | } |
| 1117 | |
| 1118 | /* Validate if different clients (pdp ctx) can reach one another through GGSN (without Tx sequence number). */ |
| 1119 | testcase TC_pdp4_clients_interact_without_txseq() runs on GT_CT { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 1120 | use_gtpu_txseq := false; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1121 | f_pdp4_clients_interact(); |
| 1122 | } |
| 1123 | |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1124 | testcase TC_echo_req_resp() runs on GT_CT { |
| 1125 | f_init(); |
| 1126 | f_send_gtpc(ts_GTPC_PING(g_peer_c, g_c_seq_nr)); |
| 1127 | T_default.start; |
| 1128 | alt { |
| 1129 | [] GTPC.receive(tr_GTPC_PONG(g_peer_c)) { setverdict(pass); }; |
| 1130 | [] GTPC.receive { repeat; }; |
| 1131 | [] T_default.timeout { setverdict(fail); } |
| 1132 | } |
| 1133 | T_default.stop; |
| 1134 | } |
| 1135 | |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1136 | /* Test if the parser can cope with PCO that only contain either a |
| 1137 | * single primary DNS or a secondary DNS. */ |
| 1138 | testcase TC_pdp4_act_deact_with_single_dns() runs on GT_CT { |
| 1139 | |
| 1140 | /* Note: an unpatched osmo-ggsn version will enter an endless-loop when |
| 1141 | * the test is executed. |
| 1142 | * see also: Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 1143 | |
| 1144 | f_init(); |
| 1145 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1146 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1147 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1148 | var octetstring pco_neg_dns; |
| 1149 | var octetstring pco_neg_dns_expected; |
| 1150 | |
| 1151 | /* PCO with primary DNS only */ |
| 1152 | ctx.pco_req := valueof(ts_PCO_IPv4_PRI_DNS_IPCP); |
| 1153 | f_pdp_ctx_act(ctx); |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1154 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1155 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1); |
| 1156 | pco_neg_dns_expected := '0200000A8106'O & ggsn_ip4_dns1 |
| 1157 | /* Note: The prepended hex bytes encode the following information: |
| 1158 | * 0x02 = Configuration ACK |
| 1159 | * 0x00 = Identifier |
| 1160 | * 0x000a = Length |
| 1161 | * 0x81 = Type (Primary DNS Server Address) |
| 1162 | * 0x06 = Length |
| 1163 | * (4 byte IP-Address appended) */ |
| 1164 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1165 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1166 | } |
| 1167 | f_pdp_ctx_del(ctx, '1'B); |
| 1168 | |
| 1169 | /* PCO with secondary DNS only */ |
Harald Welte | 7ef6d10 | 2021-04-01 21:24:35 +0200 | [diff] [blame] | 1170 | ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1171 | ctx.pco_req := valueof(ts_PCO_IPv4_SEC_DNS_IPCP); |
| 1172 | f_pdp_ctx_act(ctx); |
| 1173 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1); |
| 1174 | pco_neg_dns_expected := '0200000A8306'O & ggsn_ip4_dns2 |
| 1175 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1176 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1177 | } |
| 1178 | f_pdp_ctx_del(ctx, '1'B); |
| 1179 | } |
| 1180 | |
| 1181 | /* Test if the parser can cope with PCO that contains primary and secondary DNS in a separate IPCP container. |
| 1182 | * Note: an unpatched osmo-ggsn version will enter an endless-loop when the test is run |
| 1183 | * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288. */ |
| 1184 | testcase TC_pdp4_act_deact_with_separate_dns() runs on GT_CT { |
| 1185 | |
| 1186 | /* Note: an unpatched osmo-ggsn version will enter an endless-loop when |
| 1187 | * the test is executed. |
| 1188 | * see also: Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 1189 | |
| 1190 | f_init(); |
| 1191 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1192 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1193 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1194 | var octetstring pco_neg_dns; |
| 1195 | var octetstring pco_neg_dns_expected; |
| 1196 | |
| 1197 | ctx.pco_req := valueof(ts_PCO_IPv4_SEPARATE_DNS_IPCP); |
| 1198 | f_pdp_ctx_act(ctx); |
| 1199 | |
| 1200 | /* Check if primary DNS is contained */ |
| 1201 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1); |
| 1202 | pco_neg_dns_expected := '0200000A8106'O & ggsn_ip4_dns1 |
| 1203 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1204 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1205 | } |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1206 | |
| 1207 | /* Check if secondary DNS is contained */ |
Stefan Sperling | 8e7a396 | 2018-07-19 19:24:38 +0200 | [diff] [blame] | 1208 | /* This used to fail due to a bug in osmo-ggsn, see OS#3381 */ |
| 1209 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 2); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1210 | pco_neg_dns_expected := '0200000A8306'O & ggsn_ip4_dns2 |
| 1211 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1212 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1213 | } |
| 1214 | f_pdp_ctx_del(ctx, '1'B); |
| 1215 | } |
| 1216 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1217 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA without DNS request */ |
| 1218 | testcase TC_pdp46_act_deact() runs on GT_CT { |
| 1219 | f_init(); |
| 1220 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1221 | f_pdp_ctx_act(ctx); |
| 1222 | f_pdp_ctx_del(ctx, '1'B); |
| 1223 | } |
| 1224 | |
| 1225 | /* Test PDP context activation for dynamic IPv4v6 EUA with IPv4 DNS in IPCP */ |
| 1226 | testcase TC_pdp46_act_deact_ipcp() runs on GT_CT { |
| 1227 | f_init(); |
| 1228 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1229 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1230 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1231 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP); |
| 1232 | f_pdp_ctx_act(ctx); |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1233 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1234 | /* verify IPCP is at all contained */ |
| 1235 | if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) { |
| 1236 | setverdict(fail, "IPCP not found in PCO"); |
| 1237 | } |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1238 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1239 | /* verify IPCP contains both primary and secondary IPv4 DNS */ |
| 1240 | var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O)); |
| 1241 | if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) { |
| 1242 | if (not match(ipcp, tr_IPCP_Ack_DNS(0))) { |
| 1243 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found"); |
| 1244 | } else { |
| 1245 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values"); |
| 1246 | } |
| 1247 | } |
| 1248 | f_pdp_ctx_del(ctx, '1'B); |
| 1249 | } |
| 1250 | |
| 1251 | /* Test PDP context activation for dynamic IPv4v6 EUA with IPv6 DNS in PCO and router solicitation/advertisement */ |
| 1252 | testcase TC_pdp46_act_deact_icmp6() runs on GT_CT { |
| 1253 | f_init(); |
| 1254 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1255 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1256 | f_pdp_ctx_act(ctx); |
| 1257 | |
| 1258 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp46(ctx)); |
| 1259 | f_wait_rtr_adv(ctx); |
| 1260 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp46(ctx)); |
| 1261 | |
| 1262 | f_pdp_ctx_del(ctx, '1'B); |
| 1263 | } |
| 1264 | |
| 1265 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA with request of IPv4 DNS in PCO */ |
| 1266 | testcase TC_pdp46_act_deact_pcodns4() runs on GT_CT { |
| 1267 | f_init(); |
| 1268 | |
| 1269 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1270 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1271 | f_pdp_ctx_act(ctx); |
| 1272 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1273 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1274 | /* verify PCO contains both primary and secondary IPv4 DNS */ |
| 1275 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1276 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), ggsn_ip4_dns1)) { |
| 1277 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1278 | } |
| 1279 | |
| 1280 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1281 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), ggsn_ip4_dns2)) { |
| 1282 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1283 | } |
| 1284 | |
| 1285 | f_pdp_ctx_del(ctx, '1'B); |
| 1286 | } |
| 1287 | |
| 1288 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA with request of IPv6 DNS in PCO */ |
| 1289 | testcase TC_pdp46_act_deact_pcodns6() runs on GT_CT { |
| 1290 | f_init(); |
| 1291 | |
| 1292 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1293 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1294 | f_pdp_ctx_act(ctx); |
| 1295 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1296 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1297 | /* verify PCO contains both primary and secondary IPv6 DNS */ |
| 1298 | var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1); |
| 1299 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), ggsn_ip6_dns1)) { |
| 1300 | setverdict(fail, "Primary DNS IPv6 PCO option not found"); |
| 1301 | } |
| 1302 | |
| 1303 | var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2); |
| 1304 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), ggsn_ip6_dns2)) { |
| 1305 | setverdict(fail, "Secondary DNS IPv6 PCO option not found"); |
| 1306 | } |
| 1307 | |
| 1308 | f_pdp_ctx_del(ctx, '1'B); |
| 1309 | } |
| 1310 | |
| 1311 | /* Test PDP context activation for dynamic IPv4v6 EUA. |
| 1312 | Test we can send ICMPv6 ping over GTPU to DNS server. */ |
| 1313 | testcase TC_pdp46_act_deact_gtpu_access() runs on GT_CT { |
| 1314 | f_init(); |
| 1315 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1316 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1317 | f_pdp_ctx_act(ctx); |
| 1318 | |
| 1319 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 1320 | |
| 1321 | /* Check if we can use valid global src addr, should work */ |
| 1322 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv4_address; |
| 1323 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 1324 | f_wait_icmp4_echo_reply(ctx); |
| 1325 | |
| 1326 | /* Assert that packets with wrong global src addr are dropped by GGSN */ |
| 1327 | var OCT4 saddr_wrong := substr(saddr, 0, 3) & (saddr[3] xor4b '11'O); |
| 1328 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_wrong, dns1_addr)); |
| 1329 | f_wait_gtpu_fail(ctx); |
| 1330 | |
| 1331 | /* Send an IPv6 RA to APN4, should fail (packet dropped) */ |
| 1332 | var OCT16 saddr_v6 := f_inet6_addr("fde4:8dba:82e1:2000:1:2:3:4"); |
| 1333 | f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_v6)); |
| 1334 | f_wait_gtpu_fail(ctx); |
| 1335 | f_pdp_ctx_del(ctx, '1'B); |
| 1336 | } |
| 1337 | |
| 1338 | /* Validate if different clients (pdp ctx) can reach one another through GGSN. */ |
| 1339 | testcase TC_pdp46_clients_interact() runs on GT_CT { |
| 1340 | f_init(); |
| 1341 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1342 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1343 | f_pdp_ctx_act(ctxA); |
| 1344 | f_send_gtpu(ctxA, f_icmpv6_rs_for_pdp46(ctxA)); |
| 1345 | f_wait_rtr_adv(ctxA); |
| 1346 | f_send_gtpu(ctxA, f_gen_icmpv6_neigh_solicit_for_pdp46(ctxA)); |
| 1347 | |
| 1348 | f_pdp_ctx_act(ctxB); |
| 1349 | f_send_gtpu(ctxB, f_icmpv6_rs_for_pdp46(ctxB)); |
| 1350 | f_wait_rtr_adv(ctxB); |
| 1351 | f_send_gtpu(ctxB, f_gen_icmpv6_neigh_solicit_for_pdp46(ctxB)); |
| 1352 | |
| 1353 | var OCT16 addrA_ll := f_ipv6_link_local(ctxA.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1354 | var OCT16 addrB_ll := f_ipv6_link_local(ctxB.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1355 | var OCT16 addrA_glob := f_ipv6_global(ctxA.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1356 | var OCT16 addrB_glob := f_ipv6_global(ctxB.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1357 | |
| 1358 | /* Validate if clients can interact using ll addr. */ |
| 1359 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_ll, addrB_ll)); |
| 1360 | f_wait_gtpu_fail(ctxB); |
| 1361 | |
| 1362 | /* Validate if clients can interact using global addr. */ |
| 1363 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_glob, addrB_glob)); |
| 1364 | f_wait_gtpu_fail(ctxB); |
| 1365 | |
| 1366 | f_pdp_ctx_del(ctxA, '1'B); |
Pau Espin Pedrol | bb2bb06 | 2019-09-03 12:28:12 +0200 | [diff] [blame] | 1367 | f_pdp_ctx_del(ctxB, '1'B); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1368 | } |
| 1369 | |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1370 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA on a v4-only APN */ |
| 1371 | testcase TC_pdp46_act_deact_apn4() runs on GT_CT { |
| 1372 | f_init(); |
| 1373 | /* A typical MS first attempts v4v6, and if rejected, then tries v4 and v6 separetly */ |
| 1374 | var PdpContext ctx46 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1375 | f_pdp_ctx_act(ctx46, 'DC'O); /* Cause: Unknown PDP address or PDP type */ |
| 1376 | |
| 1377 | var PdpContext ctx4 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1378 | f_pdp_ctx_act(ctx4, '80'O); /* Normal accept cause */ |
| 1379 | |
| 1380 | var PdpContext ctx6 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv6Dyn))); |
| 1381 | f_pdp_ctx_act(ctx6, 'DC'O); /* Cause: Unknown PDP address or PDP type */ |
| 1382 | |
| 1383 | f_pdp_ctx_del(ctx4, '1'B); |
| 1384 | } |
| 1385 | |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 1386 | /* Validate if 2nd CtxCreateReq with increased Recovery IE causes ggsn to drop 1st one (while keeping 2nd one). */ |
| 1387 | testcase TC_pdp_act2_recovery() runs on GT_CT { |
| 1388 | var Gtp1cUnitdata ud; |
| 1389 | var default d; |
| 1390 | var boolean ctxA_deleted := false; |
| 1391 | var boolean ctxB_created := false; |
| 1392 | |
| 1393 | f_init(); |
| 1394 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1395 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1396 | f_pdp_ctx_act(ctxA); |
| 1397 | |
| 1398 | g_restart_ctr := int2oct(oct2int(g_restart_ctr) + 1, 1); |
| 1399 | |
| 1400 | log("sending 2nd CreatePDP (recovery increased)"); |
| 1401 | f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctxB.imsi, g_restart_ctr, |
| 1402 | ctxB.teid, ctxB.teic, ctxB.nsapi, ctxB.eua, ctxB.apn, |
| 1403 | g_sgsn_ip_c, g_sgsn_ip_u, ctxB.msisdn, ctxB.pco_req)); |
| 1404 | T_default.start; |
| 1405 | d := activate(pingpong()); |
| 1406 | alt { |
| 1407 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctxB.teic)) -> value ud { |
| 1408 | f_handle_create_req(ctxB, ud); |
| 1409 | if (not ctxB_created) { |
| 1410 | ctxB_created := true; |
| 1411 | setverdict(pass); |
| 1412 | } else { |
| 1413 | setverdict(fail, "Repeated createPDPContextResponse(ctxB)"); |
| 1414 | } |
| 1415 | |
| 1416 | if (not ctxA_deleted) { |
| 1417 | repeat; |
| 1418 | } |
| 1419 | } |
| 1420 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxA.teic)) -> value ud { |
| 1421 | if (ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.tearDownIndicator)) { |
| 1422 | setverdict(pass); |
| 1423 | } else { |
| 1424 | setverdict(fail); |
| 1425 | } |
| 1426 | |
| 1427 | if (not ctxA_deleted) { |
| 1428 | ctxA_deleted := true; |
| 1429 | setverdict(pass); |
| 1430 | } else { |
| 1431 | setverdict(fail, "Repeated deletePDPContextRequest(ctxA)"); |
| 1432 | } |
| 1433 | |
| 1434 | if (not ctxB_created) { |
| 1435 | repeat; |
| 1436 | } |
| 1437 | } |
| 1438 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxB.teic)) -> value ud { |
| 1439 | setverdict(fail, "GGSN dropping still valid pdp ctx"); |
| 1440 | } |
| 1441 | } |
| 1442 | deactivate(d); |
| 1443 | T_default.stop; |
| 1444 | |
| 1445 | f_pdp_ctx_del(ctxB, '1'B); |
| 1446 | } |
| 1447 | |
| 1448 | |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 1449 | /* Send a duplicate echo req. osmo-ggsn maintains a queue for sent |
| 1450 | responses (60 seconds): If same delete req is sent and duplicate is |
| 1451 | detected, saved duplicate response should be sent back. */ |
| 1452 | testcase TC_act_deact_retrans_duplicate() runs on GT_CT { |
| 1453 | f_init(); |
| 1454 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1455 | f_pdp_ctx_act(ctx); |
| 1456 | f_pdp_ctx_del(ctx, '1'B); |
| 1457 | /* leave some time in between to make sure retransmit response queue keeps packets for a while */ |
| 1458 | f_sleep(1.0); |
| 1459 | /* g_c_seq_nr was increased during f_pdp_ctx_del(), we want a |
| 1460 | duplicate. If it was not a duplicate, osmo-ggsn would answer |
| 1461 | with a failure since that PDP ctx was already deleted. */ |
| 1462 | g_c_seq_nr := g_c_seq_nr - 1; |
| 1463 | f_pdp_ctx_del(ctx, '1'B); |
| 1464 | |
| 1465 | /* Now send a new pdp ctx del (increased seqnum). It should fail with cause "non-existent": */ |
| 1466 | var OCT1 cause_nonexistent := 'C0'O; |
| 1467 | f_pdp_ctx_del(ctx, '1'B, cause_nonexistent); |
| 1468 | } |
| 1469 | |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1470 | /* Activate PDP context + trigger Recovery procedure through EchoResp */ |
| 1471 | testcase TC_pdp_act_restart_ctr_echo() runs on GT_CT { |
| 1472 | var Gtp1cUnitdata ud; |
| 1473 | g_use_echo := true; |
| 1474 | f_init(); |
| 1475 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1476 | f_pdp_ctx_act(ctx); |
| 1477 | |
| 1478 | /* Wait to receive echo request and send initial Restart counter */ |
| 1479 | GTPC.receive(tr_GTPC_PING(?)) -> value ud { |
| 1480 | var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber); |
| 1481 | GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr)); |
| 1482 | }; |
| 1483 | |
| 1484 | /* Wait to receive second echo request and send incremented Restart |
| 1485 | counter. This will fake a restarted SGSN, and pdp ctx allocated |
| 1486 | should be released by GGSN */ |
| 1487 | g_restart_ctr := int2oct(oct2int(g_restart_ctr) + 1, 1); |
| 1488 | GTPC.receive(tr_GTPC_PING(?)) -> value ud { |
| 1489 | var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber); |
| 1490 | GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr)); |
| 1491 | }; |
| 1492 | f_pdp_ctx_exp_del_req(ctx, omit, true); |
| 1493 | setverdict(pass); |
| 1494 | } |
| 1495 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 1496 | control { |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1497 | execute(TC_pdp4_act_deact()); |
| 1498 | execute(TC_pdp4_act_deact_ipcp()); |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 1499 | execute(TC_pdp4_act_deact_ipcp_pap_broken()); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1500 | execute(TC_pdp4_act_deact_pcodns()); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1501 | execute(TC_pdp4_act_deact_gtpu_access()); |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1502 | execute(TC_pdp4_clients_interact_with_txseq()); |
| 1503 | execute(TC_pdp4_clients_interact_without_txseq()); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1504 | execute(TC_pdp4_act_deact_with_single_dns()); |
| 1505 | execute(TC_pdp4_act_deact_with_separate_dns()); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1506 | |
| 1507 | execute(TC_pdp6_act_deact()); |
| 1508 | execute(TC_pdp6_act_deact_pcodns()); |
| 1509 | execute(TC_pdp6_act_deact_icmp6()); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1510 | execute(TC_pdp6_act_deact_gtpu_access()); |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1511 | execute(TC_pdp6_clients_interact()); |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1512 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1513 | execute(TC_pdp46_act_deact()); |
| 1514 | execute(TC_pdp46_act_deact_ipcp()); |
| 1515 | execute(TC_pdp46_act_deact_icmp6()); |
| 1516 | execute(TC_pdp46_act_deact_pcodns4()); |
| 1517 | execute(TC_pdp46_act_deact_pcodns6()); |
| 1518 | execute(TC_pdp46_act_deact_gtpu_access()); |
| 1519 | execute(TC_pdp46_clients_interact()); |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1520 | execute(TC_pdp46_act_deact_apn4()); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1521 | |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1522 | execute(TC_echo_req_resp()); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 1523 | execute(TC_pdp_act2_recovery()); |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 1524 | execute(TC_act_deact_retrans_duplicate()); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1525 | |
Pau Espin Pedrol | 6f319f9 | 2020-01-03 20:18:57 +0100 | [diff] [blame] | 1526 | execute(TC_pdp_act_restart_ctr_echo()); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 1527 | } |
Harald Welte | 379d45a | 2017-08-03 09:55:15 +0200 | [diff] [blame] | 1528 | } |