+ self.verify_decrypted(p, recv_pkts)
+
+ send_pkts = self.gen_pkts(self.pg1, src=self.pg1.remote_ip4,
+ dst=p.remote_tun_if_host, count=count,
+ payload_size=payload_size)
+ recv_pkts = self.send_and_expect(self.pg1, send_pkts,
+ self.tun_if, n_rx)
+ self.verify_encrypted(p, p.vpp_tun_sa, recv_pkts)
+
+ for rx in recv_pkts:
+ self.assertEqual(rx[IP].src, p.tun_src)
+ self.assertEqual(rx[IP].dst, p.tun_dst)
+
+ finally:
+ self.logger.info(self.vapi.ppcli("show error"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
+
+ self.logger.info(self.vapi.ppcli("show ipsec sa 0"))
+ self.logger.info(self.vapi.ppcli("show ipsec sa 4"))
+ self.verify_counters4(p, count, n_rx)
+
+ """ verify methods for Transport v4 """
+ def verify_tun_44_bad_packet_sizes(self, p):
+ # with a buffer size of 2048, 1989 bytes of payload
+ # means there isn't space to insert the ESP header
+ N_PKTS = 63
+ for p_siz in [1989, 8500]:
+ send_pkts = self.gen_encrypt_pkts(p.scapy_tun_sa, self.tun_if,
+ src=p.remote_tun_if_host,
+ dst=self.pg1.remote_ip4,
+ count=N_PKTS,
+ payload_size=p_siz)
+ self.send_and_assert_no_replies(self.tun_if, send_pkts)
+ send_pkts = self.gen_pkts(self.pg1, src=self.pg1.remote_ip4,
+ dst=p.remote_tun_if_host, count=N_PKTS,
+ payload_size=p_siz)
+ self.send_and_assert_no_replies(self.pg1, send_pkts,
+ self.tun_if)
+
+ # both large packets on decrpyt count against chained buffers
+ # the 9000 bytes one does on encrypt
+ self.assertEqual(2 * N_PKTS,
+ self.statistics.get_err_counter(
+ '/err/%s/chained buffers (packet dropped)' %
+ self.tun4_decrypt_node_name))
+ self.assertEqual(N_PKTS,
+ self.statistics.get_err_counter(
+ '/err/%s/chained buffers (packet dropped)' %
+ self.tun4_encrypt_node_name))
+
+ # on encrypt the 1989 size is no trailer space
+ self.assertEqual(N_PKTS,
+ self.statistics.get_err_counter(
+ '/err/%s/no trailer space (packet dropped)' %
+ self.tun4_encrypt_node_name))
+
+ def verify_tun_reass_44(self, p):
+ self.vapi.cli("clear errors")
+ self.vapi.ip_reassembly_enable_disable(
+ sw_if_index=self.tun_if.sw_if_index, enable_ip4=True)
+
+ try:
+ send_pkts = self.gen_encrypt_pkts(p.scapy_tun_sa, self.tun_if,
+ src=p.remote_tun_if_host,
+ dst=self.pg1.remote_ip4,
+ payload_size=1900,
+ count=1)
+ send_pkts = fragment_rfc791(send_pkts[0], 1400)
+ recv_pkts = self.send_and_expect(self.tun_if, send_pkts,
+ self.pg1, n_rx=1)
+ self.verify_decrypted(p, recv_pkts)
+
+ send_pkts = self.gen_pkts(self.pg1, src=self.pg1.remote_ip4,
+ dst=p.remote_tun_if_host, count=1)
+ recv_pkts = self.send_and_expect(self.pg1, send_pkts,
+ self.tun_if)
+ self.verify_encrypted(p, p.vpp_tun_sa, recv_pkts)
+
+ finally:
+ self.logger.info(self.vapi.ppcli("show error"))
+ self.logger.info(self.vapi.ppcli("show ipsec all"))
+
+ self.verify_counters4(p, 1, 1)
+ self.vapi.ip_reassembly_enable_disable(
+ sw_if_index=self.tun_if.sw_if_index, enable_ip4=False)
+
+ def verify_tun_64(self, p, count=1):
+ self.vapi.cli("clear errors")
+ try:
+ send_pkts = self.gen_encrypt_pkts6(p.scapy_tun_sa, self.tun_if,
+ src=p.remote_tun_if_host6,
+ dst=self.pg1.remote_ip6,
+ count=count)
+ recv_pkts = self.send_and_expect(self.tun_if, send_pkts, self.pg1)