From: Francois-Xavier Le Bail Date: Thu, 21 Mar 2024 07:57:04 +0000 (+0100) Subject: Add eight time test files with packet dates in 2038, 2039, 2106 and 2107 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/a41457a51afbdce841aca97518f871a247939ff3?hp=aacc29d06ccccd15b6b07bba0858e6fa32e97edd Add eight time test files with packet dates in 2038, 2039, 2106 and 2107 Each capture file contains one packet. time_2038.pcap: 2038-01-01 00:00:00 time_2038_max.pcap: 2038-01-19 03:14:07 time_2038_overflow.pcap: 2038-01-19 03:14:08 time_2039.pcap: 2039-01-01 00:00:00 time_2106.pcap: 2106-01-01 00:00:00 time_2106_max.pcap: 2106-02-07 06:28:15 time_2106_overflow.pcapng: 2106-02-07 06:28:16 time_2107.pcapng: 2107-01-01 00:00:00 The packet time when > 2038-01-19T03:14:07Z cannot be correctly printed if time_t size is 32 bits (overflow). Some tests are run only if HAVE_TIME_T_64 is set. it depends on the output of "./tcpdump --time-t-size" (32 or 64). A 32-bit unsigned time_t goes until 2106-02-07T06:28:15Z. All values above require a pcapng file. --- diff --git a/tests/time.tests b/tests/time.tests new file mode 100644 index 00000000..d2634efd --- /dev/null +++ b/tests/time.tests @@ -0,0 +1,68 @@ +# -*- perl -*- + +# The packet time when > 2038-01-19T03:14:07Z cannot be correctly printed +# if time_t size is 32 bits (overflow). +# Some tests are run only if HAVE_TIME_T_64 is set. it depends on the +# output of "./tcpdump --time-t-size" (32 or 64). + +# A 32-bit unsigned time_t goes until 2106-02-07T06:28:15Z. +# All values above require a pcapng file. + +$testlist = [ + { + name => 'time_2038', + input => 'time_2038.pcap', + output => 'time_2038.out', + args => '-q' + }, + { + name => 'time_2038_max', + input => 'time_2038_max.pcap', + output => 'time_2038_max.out', + args => '-q' + }, + { + config_set => 'HAVE_TIME_T_64', + name => 'time_2038_overflow', + input => 'time_2038_overflow.pcap', + output => 'time_2038_overflow.out', + args => '-q' + }, + { + config_set => 'HAVE_TIME_T_64', + name => 'time_2039', + input => 'time_2039.pcap', + output => 'time_2039.out', + args => '-q' + }, + { + config_set => 'HAVE_TIME_T_64', + name => 'time_2106', + input => 'time_2106.pcap', + output => 'time_2106.out', + args => '-q' + }, + { + config_set => 'HAVE_TIME_T_64', + name => 'time_2106_max', + input => 'time_2106_max.pcap', + output => 'time_2106_max.out', + args => '-q' + }, + { + config_set => 'HAVE_TIME_T_64', + name => 'time_2106_overflow', + input => 'time_2106_overflow.pcapng', + output => 'time_2106_overflow.out', + args => '-q' + }, + { + config_set => 'HAVE_TIME_T_64', + name => 'time_2107', + input => 'time_2107.pcapng', + output => 'time_2107.out', + args => '-q' + }, +]; + +1; diff --git a/tests/time_2038.out b/tests/time_2038.out new file mode 100644 index 00000000..2f2395ff --- /dev/null +++ b/tests/time_2038.out @@ -0,0 +1 @@ + 1 2038-01-01 00:00:00.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2038.pcap b/tests/time_2038.pcap new file mode 100644 index 00000000..8b10f33c Binary files /dev/null and b/tests/time_2038.pcap differ diff --git a/tests/time_2038_max.out b/tests/time_2038_max.out new file mode 100644 index 00000000..019d5b3a --- /dev/null +++ b/tests/time_2038_max.out @@ -0,0 +1 @@ + 1 2038-01-19 03:14:07.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2038_max.pcap b/tests/time_2038_max.pcap new file mode 100644 index 00000000..d9b9b3f4 Binary files /dev/null and b/tests/time_2038_max.pcap differ diff --git a/tests/time_2038_overflow.out b/tests/time_2038_overflow.out new file mode 100644 index 00000000..6eac7ba0 --- /dev/null +++ b/tests/time_2038_overflow.out @@ -0,0 +1 @@ + 1 2038-01-19 03:14:08.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2038_overflow.pcap b/tests/time_2038_overflow.pcap new file mode 100644 index 00000000..e0504539 Binary files /dev/null and b/tests/time_2038_overflow.pcap differ diff --git a/tests/time_2039.out b/tests/time_2039.out new file mode 100644 index 00000000..68e33786 --- /dev/null +++ b/tests/time_2039.out @@ -0,0 +1 @@ + 1 2039-01-01 00:00:00.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2039.pcap b/tests/time_2039.pcap new file mode 100644 index 00000000..bc061ad3 Binary files /dev/null and b/tests/time_2039.pcap differ diff --git a/tests/time_2106.out b/tests/time_2106.out new file mode 100644 index 00000000..23e75eb1 --- /dev/null +++ b/tests/time_2106.out @@ -0,0 +1 @@ + 1 2106-01-01 00:00:00.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2106.pcap b/tests/time_2106.pcap new file mode 100644 index 00000000..73281bf6 Binary files /dev/null and b/tests/time_2106.pcap differ diff --git a/tests/time_2106_max.out b/tests/time_2106_max.out new file mode 100644 index 00000000..548e944a --- /dev/null +++ b/tests/time_2106_max.out @@ -0,0 +1 @@ + 1 2106-02-07 06:28:15.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2106_max.pcap b/tests/time_2106_max.pcap new file mode 100644 index 00000000..4c494477 Binary files /dev/null and b/tests/time_2106_max.pcap differ diff --git a/tests/time_2106_overflow.out b/tests/time_2106_overflow.out new file mode 100644 index 00000000..8a135dd4 --- /dev/null +++ b/tests/time_2106_overflow.out @@ -0,0 +1 @@ + 1 2106-02-07 06:28:16.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2106_overflow.pcapng b/tests/time_2106_overflow.pcapng new file mode 100644 index 00000000..85655cdc Binary files /dev/null and b/tests/time_2106_overflow.pcapng differ diff --git a/tests/time_2107.out b/tests/time_2107.out new file mode 100644 index 00000000..b42e505f --- /dev/null +++ b/tests/time_2107.out @@ -0,0 +1 @@ + 1 2107-01-01 00:00:00.000000 IP 192.168.1.11.43966 > 209.87.249.18.53: UDP, length 56 diff --git a/tests/time_2107.pcapng b/tests/time_2107.pcapng new file mode 100644 index 00000000..18df9eac Binary files /dev/null and b/tests/time_2107.pcapng differ