chiark / gitweb /
Bugfixes. Change script default mtu. Better eth addr parsing.
authorian <ian>
Sun, 3 Mar 2002 15:02:12 +0000 (15:02 +0000)
committerian <ian>
Sun, 3 Mar 2002 15:02:12 +0000 (15:02 +0000)
Makefile
README
make-probes.tcl

index 3eb400003b23284173e426a1cd282eea0560967d..15f0ea8908118c4ccd6af81f549bc7a523fda90e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,8 +22,8 @@
 #############################################################
 # You should edit the parameters below for your site
 
-SOURCE=                172.18.45.35/00:04:76:1A:92:13
-DEST=          172.18.45.6/00:04:76:1A:8F:C6
+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
@@ -86,8 +86,9 @@ send-all.why: $(A_WHYS) Makefile
 
 send-%.pcap send-%.why:        ./make-probes.tcl Makefile
        ./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
diff --git a/README b/README
index cbcc94abe36c14674d507868c5c7e451be3503d3..2072a74d335072fb9f69e8f5abec1c2c7003c877 100644 (file)
--- a/README
+++ b/README
@@ -39,7 +39,9 @@ WHAT TO DO
 
 1. Generate the test data.
        * Edit this Makefile.
-           You /must/ change SOURCE and DEST; they must be IPv4 addresses.
+           You /must/ change SOURCE and DEST (or override them on
+           the `make' command line, if you prefer); they must be
+               <IPv4-address>/<ethernet-address>
            You may also change PARTS, PERPART or MTU if you like.
        * Say `make -j2 all'.  This will generate the test data sets.
            This will take a while.  Vary the -j for your system.
index f5816980a140df7e7bf7209e6501f51dcf90dc69..527687340a10fd2db8f97f2cc274726653d53d03 100755 (executable)
@@ -166,6 +166,9 @@ proc get-config/v4addr {val} {
     }
     return [format 0x%02x%02x%02x%02x $a $b $c $d]
 }
+proc get-config/linkaddr {val} {
+    return $val
+}
 
 proc get-config {variable def kind args} {
     # args currently ignored
@@ -1217,10 +1220,12 @@ proc link/ether/linkparams {} { return {1 46} }
 proc link/ether/defaddr {} { return 00:00:00:00:00:00 }
 proc link/ether/procaddr {input sd} {
     set v [string tolower $input]
-    if {[regexp {^([0-9a-f]{2}\:){5}[0-9a-f]{2}$} $v]} {
-       set v [string map {: {}} $v]
+    if {[regexp {^([0-9a-f]{1,2}\:){6}$} $v:]} {
+       set o {}
+       foreach b [split $v :] { append o [format %02x 0x$b] }
+       set v $o
     }
-    if {![regexp -nocase {^[0-9]{12}$} $v]} {
+    if {![regexp -nocase {^[0-9a-f]{12}$} $v]} {
        error "invalid $sd ethernet addr $input ($v)"
     }
     return $v
@@ -1228,7 +1233,7 @@ proc link/ether/procaddr {input sd} {
 proc link/ether/linkencap {packet} {
     global link_source link_dest
     set llpkt {}
-    append llpkt $link_source $link_dest 0800
+    append llpkt $link_dest $link_source 0800
     append llpkt $packet
     return $llpkt
 }
@@ -1245,14 +1250,14 @@ proc nextarg {} {
 proc nextarg_num {} { return [expr {[nextarg] + 0}] }
 proc nextarg_il {} {
     set a [nextarg]
-    if {![regexp -nocase {^([0-9.]+)/([0-9a-f:]+)$} $a dummy i l]} {
+    if {![regexp -nocase {^([0-9.]+)/(.+)$} $a dummy i l]} {
        error "--source/--dest needs <ip-addr>/<link-addr>"
     }
-    return [list $i [string map {: {}} $l]]
+    return [list $i $l]
 }
 
 set debug_level 0
-set mtu 576
+set mtu 100
 set upto {}
 set xseed {}
 set linktypename ether
@@ -1266,8 +1271,8 @@ while {[regexp {^\-\-} [lindex $argv 0]]} {
        --mtu { set mtu [nextarg_num] }
        --xseed { set xseed [nextarg] }
        --linktype { set linktypename [nextarg] }
-       --source { manyset [nextarg_ih] config/ip-source config/link-source }
-       --dest { manyset [nextarg_ih] config/ip-dest config/link-dest }
+       --source { manyset [nextarg_il] config/ip-source config/link-source }
+       --dest { manyset [nextarg_il] config/ip-dest config/link-dest }
        default { error "bad option $o" }
     }
 }
@@ -1275,7 +1280,6 @@ while {[regexp {^\-\-} [lindex $argv 0]]} {
 proc process_linkaddr {sd} {
     global linktypename
     upvar #0 link_$sd l
-    link/$linktypename/linktype
     get-for link
     get-config $sd [link/$linktypename/defaddr] linkaddr
     set l [link/$linktypename/procaddr [set $sd] $sd]