Add test case: inject IPv4 based TCP RST packet after recv S2C first payload

This commit is contained in:
luwenpeng
2024-05-16 14:14:41 +08:00
parent 8d8a266f60
commit d6ae7c79f7
9 changed files with 36 additions and 5 deletions

View File

@@ -98,6 +98,38 @@ TEST(INJECT_IPV4_BASED_TCP_RST, AFTER_RECV_C2S_FIRST_PAYLOAD)
}
#endif
#if 1
TEST(INJECT_IPV4_BASED_TCP_RST, AFTER_RECV_S2C_FIRST_PAYLOAD)
{
struct packet_injector_case test = {
// descriptor
.finish_clean_work_dir = 1,
.descriptor = "Inject IPv4 based TCP RST after receiving S2C first payload packet.",
.work_dir = "/tmp/inject_ipv4_based_tcp_rst_after_recv_s2c_first_payload/", // user defined work directory
// prefix
.input_prefix = "pcap/inject_ipv4_based_tcp_rst_after_recv_s2c_first_payload/test/",
.output_prefix = "/tmp/",
// input pcap
.input_pcap = "input.pcap",
// compare
.c2s_expect_pcap = "expect-192.0.2.211:54408-192.0.2.110:80-1.pcap",
.c2s_output_pcap = "inject-192.0.2.211:54408-192.0.2.110:80-1.pcap",
.s2c_expect_pcap = "expect-192.0.2.110:80-192.0.2.211:54408-2.pcap",
.s2c_output_pcap = "inject-192.0.2.110:80-192.0.2.211:54408-2.pcap",
// packet injector command
.packet_injector_cmd = "./packet_injector -t tcp-rst -c s2c-packet -n 3",
.diff_skip_pattern = "-I frame.time -I frame.time_epoch -I ip.id -I ip.ttl -I ip.checksum -I tcp.checksum -I tcp.window_size",
};
packet_injector_test_frame_run(&test);
}
#endif
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);