chiark / gitweb /
Document requirement for eth addr of router
[vinegar-ip.git] / Makefile
index caf4e30e3cd94eb47a0473782a7ba39fe93be9e7..55a55bf0eb6a06b407e92cdaad9704d3dadce9dd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,8 +22,8 @@
 #############################################################
 # You should edit the parameters below for your site
 
-SOURCE=                172.18.45.35
-DEST=          172.18.45.6
+SOURCE=                172.18.45.35/0:4:76:1a:92:13
+DEST=          172.18.45.6/0:04:76:1A:8F:C6
 
 UNIQUE=
 # set UNIQUE to something random for less observability
@@ -41,7 +41,9 @@ PARTS=                100
 # You shouldn't need to edit anything beyond this point.
 #############################################################
 
-FEW_TARGETS=   on-dest.sh \
+SCRIPT_TARGETS=        on-dest.sh monitor.sh
+
+FEW_TARGETS=   $(SCRIPT_TARGETS) \
                send-1.pcap send-1.log send-1.why
 
 TARGETS=       $(FEW_TARGETS) \
@@ -59,21 +61,29 @@ A_WHYS=             $(addsuffix .why,$(A_BASES))
 AN_BASES=      $(basename $(wildcard recv-*.pcap))
 AN_LOGS=       $(addsuffix .log,$(AN_BASES))
 AN_DIFFS=      $(addsuffix .diff,$(AN_BASES))
-AN_TARGETS=    $(AN_LOGS) $(AN_DIFFS)
+AN_MDIFFS=     $(addsuffix .mdiff,$(AN_BASES))
+AN_SUMMARIES=  $(addsuffix .summary,$(AN_BASES))
+AN_TARGETS=    $(AN_LOGS) $(AN_DIFFS) $(AN_MDIFFS) $(AN_SUMMARIES)
 
 INFORM=                @echo ' GENERATED THESE FILES:'; \
                echo '          $^'
 
+SOURCE_IP=     $(shell expr $(SOURCE) : '\([0-9.]*\)/')
+DEST_IP=       $(shell expr $(DEST) : '\([0-9.]*\)/')
+
 all:           $(TARGETS)
                        $(INFORM)
 
 few:           $(FEW_TARGETS)
                        $(INFORM)
 
+scripts:       $(SCRIPT_TARGETS)
+                       $(INFORM)
+
 anal analyse:  $(AN_TARGETS)
                        $(INFORM)
 
-send-all.pcap: $(A_PCAPS) Makefile
+send-all.pcap: $(A_PCAPS)
                rm -f $@
                dd if=$< ibs=24 count=1 of=$@
                set -e; for f in $(A_PCAPS); do \
@@ -84,29 +94,37 @@ send-all.why:       $(A_WHYS) Makefile
                nl -bp'^ ? ? ?[0-9]' <$@.1.tmp >$@.2.tmp
                @mv -f $@.2.tmp $@
 
-send-%.pcap send-%.why:        ./make-probes.tcl Makefile
+send-%.pcap send-%.why:        ./make-probes.tcl
        ./make-probes.tcl --write $@ --mtu $(MTU) --upto $(PERPART) \
-               --source $(SOURCE) --dest $(DEST) --xseed "$* $(UNIQUE)" \
-               >send-$*.why
+               --source $(SOURCE) \
+               --dest $(DEST) \
+                --xseed "$* $(UNIQUE)" >send-$*.why
 
-%.log:         %.pcap lnumber-tcpdump.pl Makefile
-               tcpdump -tnxvvs$$(($(MTU)+500)) -r $< >$@.1.tmp
+%.log:         %.pcap lnumber-tcpdump.pl blank-ttl-ipcsum.pl Makefile
+               tcpdump -tnxvvs$$(($(MTU)+500)) -r $< >$@.0.tmp
+               ./blank-ttl-ipcsum.pl <$@.0.tmp >$@.1.tmp
                ./lnumber-tcpdump.pl <$@.1.tmp >$@.2.tmp
                @mv -f $@.2.tmp $@
 
 recv-%.diff:   send-%.log recv-%.log
                diff -uI'^[0-9]' $^ >$@ || test $$? == 1
 
-on-dest.sh:    Makefile
-       @rm -f $@
-       echo >$@ "#!/bin/sh"
-       @echo >>$@ "# run this script on $(DEST) as root, saying:"
-       @echo >>$@ "#   ./on-dest.sh PART"
-       @echo >>$@ "# where PART ranges from 1 to $(PARTS)"
-       @echo >>$@ "if ! [ \$$# = 1 ]; then echo >&2 'PART?'; exit 1; fi"
-       @echo >>$@ "exec tcpdump -s$$(($(MTU)+500)) -w recv-\$$1.pcap \\"
-       @echo >>$@ " src host $(SOURCE) and dst host $(DEST)"
-       chmod +x $@
+recv-%.mdiff:  send-%.log recv-%.log
+               diff -U 1 -I'^[0-9]\|^    [     ][      ]' $^ >$@ \
+                       || test $$? == 1
+
+recv-%.summary:        recv-%.mdiff mdiff-summarise.pl
+               ./mdiff-summarise.pl <$< >$@.1.tmp
+               sort -t: -n +1 <$@.1.tmp >$@.2.tmp
+               @mv -f $@.2.tmp $@
+
+%.sh:          %.template Makefile
+               sed <$< >$@.tmp -e ' \
+                       s/@@M/'$$(($(MTU)+500))'/; \
+                       s/@@S/$(SOURCE_IP)/; \
+                       s/@@D/$(DEST_IP)/'
+               chmod +x $@.tmp
+               @mv -f $@.tmp $@
 
 clean:
                rm -f *.tmp *~ t u v