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