This is an old revision of the document!
TCP/IP Regression Test Suite
Author: Nanjun Li
Mentor: George Neville-Neil
Update: 2007-08-19
1. Summary
This project aims at a testing suite for any host's perform-ability in TCP/IP networks. N. Li implemented it on a FreeBSD machine using libpcap (a library of BSD Packet Filter [1]) to sniff frames on MAC layer, decode them into human-readable format, and send crafted ones to exam if the target host follows RFC793's requirements [2]. The tasks may include:
1) State Machine Test: covering connection establishment / abort /disconnect by sending TCP segment with control flags (SYN, FIN etc), timing the response and checking the validity of returned packets (done);
2) Transmission Reliability Test: covering target host’s reliability in handling segments with out-of-order sequence numbers (done).
2. Problems to Solve
1) TCP options vary the header's length;
2) Checksum in TCP is strict (also tricky);
3) Test suite must automate the packet decoding and sending because the target side is timing the response, e.g., if an ACK is not sent on time after SYN_ACK arrival, the target will drop the half-open connection;
4) To emulate a TCP endpoint, we need to silence source’s TCP module by installing firewall and recompile the kernel to ban outgoing packets, or employ other tricks to have the target believe all packets are from one source (I choose the latter approach for user’s convenience).
3. Design
www-fgks.hpi.uni-potsdam.de/fileadmin/user_upload/Nanjun/tirts.PNG
Figure 1 Design of TCP Regression Test Suite (TCPts)
TCP/IP Regression Test Suite (TIRTS) is currently a C program. Its architecture is presented in Figure 1, comprising of three functions: main, packet sniffer and decoder (callback function to decode packets from binary to human readable format).
TIRTS tests a target machine following these steps:
1) main forks a sniffer after start-up
2) sniffer employs pcap for packet sniffing and triggering decoder_cb on packet arrival and departure
3) main initiates a TCP socket to establish a normal TCP connection with target machine
4) main gets TCP connection's context (seq and ack numbers) from sniffer via pipes
5) main sends in-order data via TCP socket and out-of-data in crafted packets, exams the acknowledgments
6) main closes the connection and kills the sniffer
All packets in the test are saved in output file “dump”.
4. Output Sample
1: 0-c-db-dd-ba-0 > 0-18-8b-c-aa-9c type=0x800 172.16.31.21:50417 > 141.89.224.208:80 ttl=64 id=17412 SYN , seq=1132804158 ack=0 rwnd=65535 urg=0 MSS=1460 NOP WS=1 NOP NOP Timestamp(3720940215, 0) SACK=on EOL EOL (no payload) 2: 0-18-8b-c-aa-9c > 0-c-db-dd-ba-0 type=0x800 141.89.224.208:80 > 172.16.31.21:50417 ttl=63 id=0 SYN ACK , seq=3185279111 ack=1132804159 rwnd=5792 urg=0 MSS=1460 SACK=on Timestamp(1076966867, 3720940215) NOP WS=2 (no payload) 3: 0-c-db-dd-ba-0 > 0-18-8b-c-aa-9c type=0x800 172.16.31.21:50417 > 141.89.224.208:80 ttl=64 id=17413 ACK , seq=1132804159 ack=3185279112 rwnd=33304 urg=0 NOP NOP Timestamp(3720940215, 1076966867) (no payload) 4: 0-c-db-dd-ba-0 > 0-18-8b-c-aa-9c type=0x800 172.16.31.21:50417 > 141.89.224.208:80 ttl=64 id=17414 PSH ACK , seq=1132804159 ack=3185279112 rwnd=33304 urg=0 NOP NOP Timestamp(3720940215, 1076966867) payload(51): [these bytes are in-order and sent via a tcp socket.] 5: 0-18-8b-c-aa-9c > 0-c-db-dd-ba-0 type=0x800 141.89.224.208:80 > 172.16.31.21:50417 ttl=63 id=46427 ACK , seq=3185279112 ack=1132804210 rwnd=1448 urg=0 NOP NOP Timestamp(1076966867, 3720940215) (no payload) 6: 0-c-db-dd-ba-0 > 0-18-8b-c-aa-9c type=0x800 172.16.31.21:50417 > 141.89.224.208:80 ttl=127 id=1 PSH ACK , seq=1132804228 ack=3185279112 rwnd=65535 urg=0 MSS=1460 WS=1 Timestamp(3607348723, 0) NOP NOP EOL payload(76): [these bytes are out-of-order and sent in a handmade packet via a…] 7: 0-18-8b-c-aa-9c > 0-c-db-dd-ba-0 type=0x800 141.89.224.208:80 > 172.16.31.21:50417 ttl=63 id=46429 ACK , seq=3185279112 ack=1132804210 rwnd=1448 urg=0 NOP NOP Timestamp(1076967117, 3720940215) (no payload) 8: 0-c-db-dd-ba-0 > 0-18-8b-c-aa-9c type=0x800 172.16.31.21:50417 > 141.89.224.208:80 ttl=64 id=17415 FIN ACK , seq=1132804210 ack=3185279112 rwnd=33304 urg=0 NOP NOP Timestamp(3720942217, 1076967117) (no payload) 9: 0-18-8b-c-aa-9c > 0-c-db-dd-ba-0 type=0x800 141.89.224.208:80 > 172.16.31.21:50417 ttl=63 id=46431 FIN ACK , seq=3185279112 ack=1132804211 rwnd=1448 urg=0 NOP NOP Timestamp(1076967367, 3720942217) (no payload) 10: 0-c-db-dd-ba-0 > 0-18-8b-c-aa-9c type=0x800 172.16.31.21:50417 > 141.89.224.208:80 ttl=64 id=17416 ACK , seq=1132804211 ack=3185279113 rwnd=33303 urg=0 NOP NOP Timestamp(3720942217, 1076967367) (no payload)
Packet 1, 2 and 3 were sent in connection establishment (SYN, SYN ACK and ACK)
Packet 4 is in-order data, to which the target machine responds with Packet 5 and advances its ack
Packet 6 is out-of-order data (seq=3904759134) by artificially right-shifting seq 18 bytes, to which the target machine responds with duplicate ACK (3904759116)
Packet 8-10 present the disconnect process (FIN, FIN ACK and ACK)
Conclusion:
The target machine (141.89.224.208) meets the basic TCP as RFC793 required.
5. References[1] Steven McCanne and Van Jacobson, “The BSD Packet Filter:. A New Architecture for User-level Packet Capture”, Proceedings of the USENIX Winter 1993
[2] Jon Postel, “Transmission Control Protocol. Internet”, RFC 793