rb-wartslib 0.9.12 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +37 -0
- data/README +9 -6
- data/bin/count-traces +4 -4
- data/bin/create-aspath +3 -3
- data/bin/extract-trace-addrs +3 -3
- data/bin/modify-traces +7 -7
- data/bin/scdump +3 -3
- data/bin/select-traces +9 -9
- data/bin/show-cycles +5 -6
- data/bin/split-traces-by-type +2 -2
- data/bin/stat-traces +29 -30
- data/bin/trace-gap-size-hist +3 -3
- data/bin/trace-timestamps-hist +2 -2
- data/bin/w2tr +2 -2
- data/bin/wdump +16 -4
- data/docs/index.html +9 -1
- data/docs/reference.html +330 -7
- data/docs/style.css +1 -1
- data/docs/tut-1-count.rb +1 -1
- data/docs/tut-10-list2.rb +3 -3
- data/docs/tut-11-cycle.rb +1 -1
- data/docs/tut-12-cycle2.rb +7 -8
- data/docs/tut-13-write.rb +1 -1
- data/docs/tut-14-write2.rb +2 -3
- data/docs/tut-15-write3.rb +1 -1
- data/docs/tut-16-write4.rb +1 -1
- data/docs/tut-17-modify.rb +3 -4
- data/docs/tut-18-modify2.rb +3 -4
- data/docs/tut-2-count-block.rb +1 -1
- data/docs/tut-3-count-resp.rb +1 -1
- data/docs/tut-4-path-length.rb +5 -17
- data/docs/tut-5-hop-addr.rb +1 -1
- data/docs/tut-6-hop-addr2.rb +1 -1
- data/docs/tut-7-hop-addr3.rb +1 -1
- data/docs/tut-8-hop-addr4.rb +1 -1
- data/docs/tut-9-list.rb +1 -1
- data/docs/tutorial.html +38 -54
- data/ext/scaddr.h +3 -2
- data/ext/scext.c +11 -2
- data/ext/scfile.c +2 -1
- data/ext/scfile.h +3 -2
- data/ext/sclist.h +2 -2
- data/ext/sctrace.c +205 -18
- data/ext/sctrace.h +3 -2
- data/lib/wartslib/wl-file.rb +3 -2
- data/lib/wartslib/wl-trace.rb +70 -2
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
version 0.9.13, 2008-02-01
|
2
|
+
* fixed Warts::File#open to handle paths with spaces and other special
|
3
|
+
characters
|
4
|
+
* implemented methods to retrieve hop TLV values; namely,
|
5
|
+
hop_reply_ipid
|
6
|
+
hop_reply_iptos
|
7
|
+
hop_next_hop_mtu
|
8
|
+
hop_inner_iplen
|
9
|
+
hop_inner_ipttl
|
10
|
+
hop_inner_iptos
|
11
|
+
* implemented Warts::Trace#hop_has_reply_ttl?; you should call this when
|
12
|
+
Warts::Trace#hop_reply_ttl returns 0, to distinguish between a true
|
13
|
+
0 reply TTL and a missing reply TTL
|
14
|
+
* implemented Warts::Trace#hop_has_tcp_reply? and #hop_has_icmp_reply?;
|
15
|
+
use these methods to determine which type of reply data is available,
|
16
|
+
either ICMP or TCP (these are mutually exclusive); the methods
|
17
|
+
Trace#hop_icmp_type, Trace#hop_icmp_code, and Trace#hop_tcp_flags
|
18
|
+
now return nil if a reply of the given type isn't available
|
19
|
+
* implemented Warts::Trace#hop_tcp_flags_breakdown
|
20
|
+
* implemented Warts::Trace.decompose_tcp_flags and decompose_hop_flags
|
21
|
+
convenience methods
|
22
|
+
* added Warts::Trace::STOP_REASON_TEXT which is a hash from stop reason
|
23
|
+
code to human-oriented text
|
24
|
+
* added Warts::Trace#dest and #dest_cmp methods; the previous #dst and
|
25
|
+
#dst_cmp methods are still available but deprecated
|
26
|
+
* moved Warts::File::TRACE, Warts::File::LIST, Warts::File::CYCLE_START,
|
27
|
+
etc. constants to Warts::TRACE, Warts::LIST, etc.; the previous definitions
|
28
|
+
are still available, though deprecated
|
29
|
+
* added Warts::Trace::HOP_FLAG_TCP
|
30
|
+
* changed to export the internal scamper constant SCAMPER_TRACE_STOP_DEAD
|
31
|
+
as Warts::Trace::STOP_GAPLIMIT rather than Warts::Trace::STOP_DEAD; this
|
32
|
+
is in keeping with recent changes in scamper; the old STOP_DEAD constant
|
33
|
+
is still available for backwards compatibility, though deprecated
|
34
|
+
* made internal changes needed to build with scamper-cvs-20070523j
|
35
|
+
* updated sample scripts to use newest non-deprecated methods; also
|
36
|
+
improved stat-traces script to print out TCP flags stats
|
37
|
+
|
1
38
|
version 0.9.12, 2008-01-16
|
2
39
|
* renamed Warts::Trace#each_attempt to each_response
|
3
40
|
* renamed Warts::Trace#each_hop_and_attempt to each_hop_and_response
|
data/README
CHANGED
@@ -12,8 +12,9 @@ This extension will be useful to network researchers, operators, and users
|
|
12
12
|
who need to analyze or process warts files.
|
13
13
|
|
14
14
|
Please see the project home page at http://rb-wartslib.rubyforge.org/
|
15
|
-
for further documentation and sample code.
|
16
|
-
in the '
|
15
|
+
for further documentation and sample code. A possibly older copy of the
|
16
|
+
project page and documentation is available in the 'docs' subdirectory.
|
17
|
+
Sample code is also available in the 'bin' subdirectory.
|
17
18
|
|
18
19
|
|
19
20
|
INSTALLING
|
@@ -40,7 +41,7 @@ That will build libscamperfile.a, which is what rb-wartslib links against.
|
|
40
41
|
Now build and install rb-wartslib:
|
41
42
|
|
42
43
|
$ SCAMPER=/Users/youngh/scamper-cvs-20070523h
|
43
|
-
(set the above to the directory where you built scamper)
|
44
|
+
(set the above to the *absolute* directory where you built scamper)
|
44
45
|
$ sudo gem install rb-wartslib -- --with-scamper-include=$SCAMPER --with-scamper-lib=$SCAMPER
|
45
46
|
|
46
47
|
That's it.
|
@@ -49,9 +50,11 @@ That's it.
|
|
49
50
|
CONTACT
|
50
51
|
-------
|
51
52
|
|
52
|
-
rb-wartslib is written by Young Hyun
|
53
|
-
|
54
|
-
http://
|
53
|
+
rb-wartslib is written and maintained by Young Hyun as a part of
|
54
|
+
CAIDA's work on the Archipelago Measurement Infrastructure
|
55
|
+
[http://www.caida.org/projects/ark/]. You may contact him at youngh
|
56
|
+
AT rubyforge.org, or use the tracker/forums at the RubyForge project
|
57
|
+
page for getting help.
|
55
58
|
|
56
59
|
Please direct scamper questions, including problems building it,
|
57
60
|
to Matthew Luckie:
|
data/bin/count-traces
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
## along with this program; if not, write to the Free Software
|
22
22
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
23
|
##
|
24
|
-
## $Id: count-traces,v 1.
|
24
|
+
## $Id: count-traces,v 1.3 2008/02/02 00:01:23 youngh Exp $
|
25
25
|
#############################################################################
|
26
26
|
|
27
27
|
require 'rubygems'
|
@@ -30,13 +30,13 @@ require 'wartslib'
|
|
30
30
|
total = 0
|
31
31
|
ARGV.each do |path|
|
32
32
|
file = Warts::File::open path
|
33
|
-
file.add_filters Warts::
|
33
|
+
file.add_filters Warts::TRACE
|
34
34
|
|
35
35
|
count = 0
|
36
36
|
file.read { count += 1 }
|
37
37
|
|
38
|
-
|
38
|
+
printf "%8d %s\n", count, path
|
39
39
|
total += count
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
printf "%8d total\n", total
|
data/bin/create-aspath
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
## along with this program; if not, write to the Free Software
|
21
21
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
22
22
|
##
|
23
|
-
## $Id: create-aspath,v 1.
|
23
|
+
## $Id: create-aspath,v 1.3 2008/02/02 00:01:23 youngh Exp $
|
24
24
|
#############################################################################
|
25
25
|
|
26
26
|
require 'rubygems'
|
@@ -84,7 +84,7 @@ def extract_ippath(trace)
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
retval << trace.
|
87
|
+
retval << trace.dest if dest_response
|
88
88
|
retval
|
89
89
|
end
|
90
90
|
|
@@ -129,7 +129,7 @@ ARGV.each do |path|
|
|
129
129
|
next
|
130
130
|
end
|
131
131
|
|
132
|
-
file.add_filters Warts::
|
132
|
+
file.add_filters Warts::TRACE
|
133
133
|
file.read do |trace|
|
134
134
|
if $options.verbose
|
135
135
|
puts "-" * 78
|
data/bin/extract-trace-addrs
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
## along with this program; if not, write to the Free Software
|
25
25
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26
26
|
##
|
27
|
-
## $Id: extract-trace-addrs,v 1.
|
27
|
+
## $Id: extract-trace-addrs,v 1.4 2008/02/02 00:01:24 youngh Exp $
|
28
28
|
#############################################################################
|
29
29
|
|
30
30
|
require 'rubygems'
|
@@ -69,7 +69,7 @@ def extract_addresses(trace, addresses)
|
|
69
69
|
addresses[trace.hop_addr(hop, response)] += 1
|
70
70
|
end
|
71
71
|
|
72
|
-
addresses[trace.
|
72
|
+
addresses[trace.dest] += 1 if dest_response
|
73
73
|
end
|
74
74
|
|
75
75
|
|
@@ -82,7 +82,7 @@ addresses = Hash.new { |h,k| h[k] = 0 }
|
|
82
82
|
ARGV.each do |path|
|
83
83
|
$stderr.puts "examining #{path} ..."
|
84
84
|
Warts::File.open(path) do |file|
|
85
|
-
file.add_filters Warts::
|
85
|
+
file.add_filters Warts::TRACE
|
86
86
|
file.read do |trace|
|
87
87
|
extract_addresses trace, addresses
|
88
88
|
end
|
data/bin/modify-traces
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
## along with this program; if not, write to the Free Software
|
21
21
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
22
22
|
##
|
23
|
-
## $Id: modify-traces,v 1.
|
23
|
+
## $Id: modify-traces,v 1.2 2008/02/02 00:01:24 youngh Exp $
|
24
24
|
#############################################################################
|
25
25
|
|
26
26
|
require 'rubygems'
|
@@ -98,9 +98,9 @@ ARGV.each do |path|
|
|
98
98
|
puts "processing #{path} ..."
|
99
99
|
|
100
100
|
file = Warts::File::open path
|
101
|
-
filters = [ Warts::
|
102
|
-
filters << Warts::
|
103
|
-
filters << Warts::
|
101
|
+
filters = [ Warts::TRACE ]
|
102
|
+
filters << Warts::CYCLE_START unless options.delete_cycle_start
|
103
|
+
filters << Warts::CYCLE_STOP unless options.delete_cycle_stop
|
104
104
|
file.add_filters *filters
|
105
105
|
|
106
106
|
list = nil
|
@@ -111,13 +111,13 @@ ARGV.each do |path|
|
|
111
111
|
list = element.list.derive list_options unless list
|
112
112
|
|
113
113
|
case element.element_type
|
114
|
-
when Warts::
|
114
|
+
when Warts::CYCLE_START, Warts::CYCLE_STOP
|
115
115
|
unless cycle
|
116
116
|
options = {:list => list}.merge(cycle_options)
|
117
117
|
options.delete(:stop_time) # leave stop_time to 0 for START records
|
118
118
|
cycle = element.derive options
|
119
119
|
|
120
|
-
if element.element_type == Warts::
|
120
|
+
if element.element_type == Warts::CYCLE_STOP &&
|
121
121
|
cycle_options.has_key?(:stop_time)
|
122
122
|
element = cycle.derive :stop_time => cycle_options[:stop_time]
|
123
123
|
else
|
@@ -127,7 +127,7 @@ ARGV.each do |path|
|
|
127
127
|
out.write element # write out a START record only once per file
|
128
128
|
end
|
129
129
|
|
130
|
-
when Warts::
|
130
|
+
when Warts::TRACE
|
131
131
|
cycle = element.cycle.derive list, cycle_options unless cycle
|
132
132
|
element.cycle = cycle
|
133
133
|
out.write element
|
data/bin/scdump
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
## along with this program; if not, write to the Free Software
|
21
21
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
22
22
|
##
|
23
|
-
## $Id: scdump,v 1.
|
23
|
+
## $Id: scdump,v 1.15 2008/02/02 00:01:24 youngh Exp $
|
24
24
|
#############################################################################
|
25
25
|
|
26
26
|
require 'rubygems'
|
@@ -44,7 +44,7 @@ $halt_reason[Warts::Trace::STOP_DEAD] = "G"
|
|
44
44
|
def show_trace(trace)
|
45
45
|
fields = ["T"]
|
46
46
|
|
47
|
-
fields.push trace.src, trace.
|
47
|
+
fields.push trace.src, trace.dest, trace.list_id, trace.cycle_id, trace.start
|
48
48
|
|
49
49
|
dest_response = trace.find_dest_response
|
50
50
|
if dest_response
|
@@ -111,7 +111,7 @@ end
|
|
111
111
|
|
112
112
|
ARGV.each do |path|
|
113
113
|
file = Warts::File::open path
|
114
|
-
file.add_filters Warts::
|
114
|
+
file.add_filters Warts::TRACE
|
115
115
|
while (trace = file.read)
|
116
116
|
show_trace trace
|
117
117
|
end
|
data/bin/select-traces
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
## along with this program; if not, write to the Free Software
|
23
23
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
24
24
|
##
|
25
|
-
## $Id: select-traces,v 1.
|
25
|
+
## $Id: select-traces,v 1.3 2008/02/02 00:01:24 youngh Exp $
|
26
26
|
#############################################################################
|
27
27
|
|
28
28
|
require 'rubygems'
|
@@ -170,18 +170,18 @@ class Stats
|
|
170
170
|
end
|
171
171
|
|
172
172
|
def print
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
173
|
+
printf "%8d traces\n", @traces
|
174
|
+
printf "%8d responding (%.1f%%)\n", @responding, pct(@responding, @traces)
|
175
|
+
printf "%8d complete (%.1f%%)\n", @complete, pct(@complete, @traces)
|
176
|
+
printf "%8d dead traces with zero hop count (%.1f%%)\n",
|
177
|
+
@zero_dead, pct(@zero_dead, @traces)
|
178
178
|
puts
|
179
179
|
stop_reason.to_a.sort.each do |k, v|
|
180
|
-
|
180
|
+
printf "%8d stop reason %d, %s\n", v, k, @stop_text[k]
|
181
181
|
end
|
182
182
|
puts
|
183
183
|
@hop_histogram.to_a.sort.each do |k, v|
|
184
|
-
|
184
|
+
printf "%8d %d hops\n", v, k
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -226,7 +226,7 @@ ARGV.each do |path|
|
|
226
226
|
exit 1
|
227
227
|
end
|
228
228
|
|
229
|
-
file.add_filters Warts::
|
229
|
+
file.add_filters Warts::TRACE
|
230
230
|
file.read do |trace|
|
231
231
|
trace_index += 1
|
232
232
|
next if trace_index <= $options.skip_traces
|
data/bin/show-cycles
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
## along with this program; if not, write to the Free Software
|
22
22
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
23
|
##
|
24
|
-
## $Id: show-cycles,v 1.
|
24
|
+
## $Id: show-cycles,v 1.2 2008/02/02 00:01:24 youngh Exp $
|
25
25
|
#############################################################################
|
26
26
|
|
27
27
|
require "rubygems"
|
@@ -29,9 +29,9 @@ require 'wartslib'
|
|
29
29
|
|
30
30
|
def cycle_type(element)
|
31
31
|
case element.element_type
|
32
|
-
when Warts::
|
33
|
-
when Warts::
|
34
|
-
when Warts::
|
32
|
+
when Warts::CYCLE_START: "START"
|
33
|
+
when Warts::CYCLE_DEF: "DEF"
|
34
|
+
when Warts::CYCLE_STOP: "STOP"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -42,8 +42,7 @@ end
|
|
42
42
|
ARGV.each do |path|
|
43
43
|
puts ">> #{path}"
|
44
44
|
Warts::File::open(path) do |file|
|
45
|
-
file.add_filters Warts::
|
46
|
-
Warts::File::CYCLE_STOP
|
45
|
+
file.add_filters Warts::CYCLE_START, Warts::CYCLE_DEF, Warts::CYCLE_STOP
|
47
46
|
file.read do |c|
|
48
47
|
start_date = ts_date c.start_time
|
49
48
|
stop_date = ts_date c.stop_time
|
data/bin/split-traces-by-type
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
## along with this program; if not, write to the Free Software
|
22
22
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
23
|
##
|
24
|
-
## $Id: split-traces-by-type,v 1.
|
24
|
+
## $Id: split-traces-by-type,v 1.2 2008/02/02 00:01:24 youngh Exp $
|
25
25
|
#############################################################################
|
26
26
|
|
27
27
|
require 'rubygems'
|
@@ -83,7 +83,7 @@ if ARGV.length > 0
|
|
83
83
|
split = SplitFiles.new filename
|
84
84
|
|
85
85
|
Warts::File::open(filename) do |file|
|
86
|
-
file.add_filters Warts::
|
86
|
+
file.add_filters Warts::TRACE
|
87
87
|
file.read do |element|
|
88
88
|
split.sort_trace element
|
89
89
|
end
|
data/bin/stat-traces
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
## along with this program; if not, write to the Free Software
|
21
21
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
22
22
|
##
|
23
|
-
## $Id: stat-traces,v 1.
|
23
|
+
## $Id: stat-traces,v 1.10 2008/02/02 00:01:24 youngh Exp $
|
24
24
|
#############################################################################
|
25
25
|
|
26
26
|
require 'rubygems'
|
@@ -29,7 +29,7 @@ require 'wartslib'
|
|
29
29
|
|
30
30
|
class Stats
|
31
31
|
attr_accessor :traces, :responding, :complete, :stop_reason, :icmp_reason
|
32
|
-
attr_accessor :hop_histogram
|
32
|
+
attr_accessor :hop_histogram
|
33
33
|
|
34
34
|
# Based on http://www.iana.org/assignments/icmp-parameters
|
35
35
|
ICMP_TYPE_NAMES = {
|
@@ -84,33 +84,18 @@ class Stats
|
|
84
84
|
@complete = 0
|
85
85
|
@stop_reason = Hash.new 0
|
86
86
|
@icmp_reason = Hash.new 0 # "#{icmp_type} #{icmp_code}"
|
87
|
-
|
88
|
-
# from scamper_trace.h:SCAMPER_TRACE_STOP_*
|
89
|
-
@stop_text = {
|
90
|
-
0 => "none (null reason)",
|
91
|
-
1 => "completed (got an ICMP port unreach)",
|
92
|
-
2 => "unreach (got an other ICMP unreach code)",
|
93
|
-
3 => "icmp (got an ICMP msg, not unreach)",
|
94
|
-
4 => "loop (loop detected)",
|
95
|
-
5 => "dead (unresponsive target)",
|
96
|
-
6 => "error (sendto error)"
|
97
|
-
}
|
98
|
-
@stop_text.default = "<<UNKNOWN STOP CODE>>"
|
99
|
-
|
87
|
+
@tcp_flags = Hash.new 0
|
100
88
|
@hop_histogram = Hash.new 0
|
101
|
-
@zero_dead = 0
|
102
89
|
end
|
103
90
|
|
104
91
|
def print
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
puts "%8d dead traces with zero hop count (%.1f%%)" %
|
109
|
-
[ @zero_dead, pct(@zero_dead, @traces) ]
|
92
|
+
printf "%8d traces\n", @traces
|
93
|
+
printf "%8d responding (%.1f%%)\n", @responding, pct(@responding, @traces)
|
94
|
+
printf "%8d complete (%.1f%%)\n", @complete, pct(@complete, @traces)
|
110
95
|
|
111
96
|
puts
|
112
97
|
@stop_reason.to_a.sort.each do |k, v|
|
113
|
-
|
98
|
+
printf "%8d stop reason %d, %s\n", v, k, Warts::Trace::STOP_REASON_TEXT[k]
|
114
99
|
end
|
115
100
|
|
116
101
|
puts
|
@@ -127,12 +112,20 @@ class Stats
|
|
127
112
|
end
|
128
113
|
names += ")"
|
129
114
|
end
|
130
|
-
|
115
|
+
printf "%8d icmp type %d, code %d%s\n", v, t, c, names
|
116
|
+
end
|
117
|
+
|
118
|
+
unless @tcp_flags.empty?
|
119
|
+
puts
|
120
|
+
@tcp_flags.to_a.sort.each do |k, v|
|
121
|
+
printf "%8d tcp flags %d ", v, k
|
122
|
+
p Warts::Trace.decompose_tcp_flags(k)
|
123
|
+
end
|
131
124
|
end
|
132
125
|
|
133
126
|
puts
|
134
127
|
@hop_histogram.to_a.sort.each do |k, v|
|
135
|
-
|
128
|
+
printf "%8d %d hops\n", v, k
|
136
129
|
end
|
137
130
|
end
|
138
131
|
|
@@ -140,6 +133,10 @@ class Stats
|
|
140
133
|
@icmp_reason[icmp_type << 8 | icmp_code] += 1
|
141
134
|
end
|
142
135
|
|
136
|
+
def add_tcp_flags(flags)
|
137
|
+
@tcp_flags[flags] += 1
|
138
|
+
end
|
139
|
+
|
143
140
|
def add(other)
|
144
141
|
@traces += other.traces
|
145
142
|
@responding += other.responding
|
@@ -147,7 +144,6 @@ class Stats
|
|
147
144
|
other.stop_reason.each { |k,v| @stop_reason[k] += v }
|
148
145
|
other.icmp_reason.each { |k,v| @icmp_reason[k] += v }
|
149
146
|
other.hop_histogram.each { |k,v| @hop_histogram[k] += v }
|
150
|
-
@zero_dead += other.zero_dead
|
151
147
|
end
|
152
148
|
|
153
149
|
def pct(x, y)
|
@@ -163,7 +159,7 @@ total = Stats.new
|
|
163
159
|
ARGV.each do |path|
|
164
160
|
stats = Stats.new
|
165
161
|
Warts::File.open(path) do |file|
|
166
|
-
file.add_filters Warts::
|
162
|
+
file.add_filters Warts::TRACE
|
167
163
|
file.read do |trace|
|
168
164
|
stats.traces += 1
|
169
165
|
stats.responding += 1 if trace.dest_responded?
|
@@ -175,13 +171,16 @@ ARGV.each do |path|
|
|
175
171
|
# values for the response from the destination.
|
176
172
|
trace.each_hop_and_response do |hop, response, exists|
|
177
173
|
next unless exists
|
178
|
-
|
179
|
-
|
180
|
-
|
174
|
+
if trace.hop_has_icmp_reply? hop, response
|
175
|
+
icmp_type = trace.hop_icmp_type hop, response
|
176
|
+
icmp_code = trace.hop_icmp_code hop, response
|
177
|
+
stats.add_icmp_reason icmp_type, icmp_code
|
178
|
+
else
|
179
|
+
stats.add_tcp_flags trace.hop_tcp_flags(hop, response)
|
180
|
+
end
|
181
181
|
end
|
182
182
|
|
183
183
|
stats.hop_histogram[trace.path_length] += 1
|
184
|
-
stats.zero_dead += 1 if trace.stop_reason == 5 && trace.hop_count == 0
|
185
184
|
end
|
186
185
|
end
|
187
186
|
|