3 # This is a tool for TCP transparency testing. It allows you to send
4 # a wide variety of `interesting' packets from one nominated machine
5 # to another, and then examine what arrived to see if there are any
8 # Up to 4 hosts are involved: one to do the test dataset generation, a
9 # sender, a receiver, and one to do the analysis.
14 # on the machine you generate the test data
15 # This Makefile and corresponding Tcl script
16 # Tcl (as /usr/bin/tclsh)
17 # OpenSSL (as `openssl' on PATH)
18 # Lots of CPU ! (the generation script is rather slow)
20 # on the sending machine
21 # tcpreplay (http://www.subterrain.net/tools/tcpreplay/,
22 # or from Debian testing 3.5.2002. I used 1.0.1-1.1)
23 # and root privilege to run it
25 # on the receiving machine
26 # tcpdump for packet capture, and root privilege to run it
27 # The `on-dest.sh' script that this Makefile creates
29 # on the analysis machine
30 # tcpdump for converting trace files only, no root privilege
31 # This Makefile to drive tcpdump for you, if you like
32 # diff to look at the output
34 # It will be much better if the machines you are using do not have any
35 # other traffic. If they do the tests may disrupt it, and it'll get
36 # in the way of your analysis too.
41 # 1. Generate the test data.
42 # * Edit this Makefile.
43 # You /must/ change SOURCE and DEST; they must be IPv4 addresses.
44 # You may also change PARTS, PERPART or MTU if you like.
45 # * Say `make -j2 generate'. This will generate the test data sets.
46 # This will take a while. Vary the -j for your system.
47 # * Copy send-*.pcap and on-dest.sh to the sending machine.
49 # 2. Run one of the tests
50 # * Pick a PART number, say 1, to start with.
51 # * On the receiving machine, say, as root,
53 # and leave it running.
54 # * On the sending machine, say, as root,
55 # tcpreplay -m 1 <send-PART.pcap
56 # The -m 1 option makes tcpreplay send the packets at one a
57 # second (they are generated as if they were captured at one
58 # a second); this avoids flooding the network, which causes
59 # congestion, packet loss and maybe other randomness.
60 # This will take (by default) 100 seconds.
66 # Those made by `make generate':
67 # send-*.pcap `pcap' format raw test data files
68 # (feed this to tcpreplay -m 1)
69 # send-*.log tcpdump's interpretation of the test data
70 # with line numbers added
71 # send-*.why The generator's explanations (ha ha) of
72 # what the test data is
73 # on-dest.sh Script for running tcpdump on the destination
75 # Those supposedly captured at the destination
76 # recv-*.pcap `pcap' format raw received packets
78 # Those made during the analysis:
79 # recv-*.log tcpdump's interpretation of the received packets
80 # recv-*.diff difference between send-*.log and recv-*.log
81 # all.diff all the .diff's concatenated in one easy file
84 # On the receiving machine,
88 # Run this makefile anywhere to generate the test data sets
96 # set UNIQUE to something random for less observability
100 # no of packets in each individual part, including part 1
103 # `rest' is made of PARTS-1 parts of PERPART packets
106 # You shouldn't need to edit anything beyond this point.
108 FEW_TARGETS= on-dest.sh \
109 send-1.pcap send-1.log send-1.why
111 TARGETS= $(GEN_SMALL) \
112 send-rest.pcap send-rest.log send-rest.why
115 set -e; i=2; while [ $$i -le $(PARTS) ]; do \
116 echo $$i; i=$$(( $$i + 1)); done \
119 R_BASES= $(addprefix send-,1 $(R_PARTNOS))
120 R_PCAPS= $(addsuffix .pcap,$(R_BASES))
121 R_WHYS= $(addsuffix .why,$(R_BASES))
126 send-rest.pcap: $(R_PCAPS)
128 dd if=$< ibs=24 count=1 of=$@
129 set -e; for f in $^; do \
130 dd ibs=24 skip=1 if=$$f >>$@; done
132 send-rest.why: $(R_WHYS)
133 cat $(R_WHYS) >$@.1.tmp
134 nl -bp'^ ? ? ?[0-9]' <$@.1.tmp >$@.2.tmp
137 send-%.pcap: ./make-probes.tcl
138 ./make-probes.tcl --write $@ --mtu $(MTU) --upto $(PERPART) \
139 --source $(SOURCE) --dest $(DEST) --xseed "$* $(UNIQUE)" \
143 tcpdump -tnxvvs$$(($(MTU)+50)) -r $< >$@.1.tmp
144 nl -bp'^[0-9]' <$@.1.tmp >$@.2.tmp
150 @echo >>$@ "# run this script on $(DEST) as root, saying:"
151 @echo >>$@ "# ./on-dest.sh PART"
152 @echo >>$@ "# where PART ranges from 1 to $(PARTS)"
153 @echo >>$@ "if ! [ \$$# = 1 ]; then echo >&2 'PART?'; exit 1; fi"
154 @echo >>$@ "exec tcpdump -ps$$(($(MTU)+50)) -w recv-\$$1.pcap \\"
155 @echo >>$@ " src host $(SOURCE) and dst host $(DEST)"
162 rm -f $(TARGETS) *.pcap *.why *.log