tcpreq is a modular Framework for TCP Specification Conformance testing, enabling Implementors to test specific features of their individual TCP Stack implementation, as well as enabling Researchers to assess the state of TCP Conformance in the Internet. It was developed {by Leo Blöcher} at COMSYS Network Architectures Group of RWTH Aachen University. tcpreq is released according to the MIT License terms.
PAM 2020: MUST, SHOULD, DON'T CARE: TCP Conformance in the Wild, International Conference on Passive and Active Network Measurement
PAM 2020: Dataset to "MUST, SHOULD, DON’T CARE: TCP Conformance in the Wild"
The basic requirements of a TCP Stack are defined in RFC 793, the core TCP specification. Since its over 40 years of existence, it has accumulated over 25 accepted errata described in RFC 793bis. All Test Cases are based on the requirements stated in RFC 793bis, and require active communication to the tested Host. The following Test Cases are available:
Todo Leo: list test cases, state explicit MUST-# of 793bisDraft16
Middleboxes can alter TCP header information and thereby cause non-conformance, which should not be wrongly attributed to the probed host. tcpreq uses the tracebox approach to detect interfering middleboxes by sending and repeating its probes with increasing IP TTLs. In every test case, the first segment is sent multiple times with increasing TTL values from 1 to 30 in parallel while capturing ICMP time exceeded messages. To distinguish the replied messages and determine the hop count, the TTL is encoded in the IPv4 ID and in the TCP acknowledgment number, window size, and urgent pointer fields, which allows tcpreq to pinpoint and detect (non-)conformance within the end-to-end path if ICMP messages are issued by the intermediaries quoting the expired segment. Please note that alteration or removal of some of the encodings do not render the path or the specific hop non-conformant. A non-conformance is only attested, if the actual tested behavior was modified as visible through the expired segment. Depending on the specific test case, some of the fields are not used for the TTL encoding. For example, when testing for urgent pointer adherence, the TTL is not encoded in the urgent pointer field.
- Python ≥ 3.6
- Packages in
requirements.txt
(pip install -r requirements.txt
) - Either
nftables
oriptables
ethtool
(for checksum tests)- Optional:
tcpdump
to record traces - Development:
pycodestyle
linter,mypy
type checker
- Choose an interface to run
tcpreq
on. Example:eth1
. - Set up the firewall rules preventing kernel interference.
- You will likely have to customize the user ID/name in the templates:
nftables
: Replaceskuid tcpreq
withskuid <username>
intcpreq-nft.conf
.iptables
: Replace--uid-owner 1001
with--uid-owner <user ID>
intcpreq-ipt.rules
.
- Optional: If you want to limit the firewall rules to
eth1
, insert:nftables
:meta oif != eth1 accept
on a new line beforemeta skuid ...
intcpreq-nft.conf
.iptables
:-o eth1
before-j tcpreq
intcpreq-ipt.rules
.
- Load the rules:
nftables
:nft -f tcpreq-nft.conf
iptables
:iptables-apply tcpreq-ipt.rules
(IPv4) orip6tables-apply tcpreq-ipt.rules
(IPv6)
- You will likely have to customize the user ID/name in the templates:
- Disable NIC offloads:
ethtool -K eth1 tx off rx off tso off gso off gro off lro off
tx off rx off
: Disables checksum offloads (necessary for checksum tests)tso off gso off gro off lro off
: Disables segmentation offloads intcpdump
traces (optional)
- Run
python -m tcpreq
and wait for it to finish. Seepython -m tcpreq -h
for details on its CLI.-B <eth1's IP address>
to set the IP address-r 100k
to limittcpreq
to 100 000 packets per second-b <path/to/blacklist>
to enforce a blacklist (in CIDR notation)-T *
to add all test cases,-T ZeroChecksumTest
to add just theZeroChecksumTest
,-T !ZeroChecksumTest
to remove theZeroChecksumTest
to/from the selection of tests-o <path/to/results.json>
to specify the output file name--json/--nmap/--zmap <path/to/input>
to specify the input file name(s)
- Re-enable the NIC offloads:
ethtool -K eth1 tx on rx on tso on gso on gro on lro on
- Remove the firewall rules added previously: see the comments in the respective rules file
tcpreq
can run as an unprivileged user, in which case the
Python executable requires the CAP_NET_RAW
and CAP_NET_ADMIN
capabilities.
These can be granted with setcap cap_net_admin,cap_net_raw+ep <path/to/python>
,
though this should probably only be done within a virtualenv.
Without these capabilities in place, tcpreq
must be run as root.
In this case, the user ID above is 0 and the username is root.
Todo Leo: brief overview of implementing my own extension