summaryrefslogtreecommitdiff
path: root/graphics/xplot/patches/patch-ab
blob: 70769329cde37f438e0c49f7a2b93c502a387f26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$NetBSD: patch-ab,v 1.7 2006/10/14 09:13:14 bad Exp $

--- tcpdump2xplot.pl.orig	2000-05-03 20:08:19.000000000 +0200
+++ tcpdump2xplot.pl
@@ -226,9 +226,16 @@ for ($lineNo = 1; <$Tcpdump>; $lineNo++)
     local(%opts);
 
     chop;
+    # strip unwanted output added by modern tcdump versions in verbose mode
+    #
+    s/\(tos.*?\)//;     # (tos 0x0, ttl ... length: \d+)
+    s/ \[(?:bad )?tcp (?:ck)?sum.*?\]//; # [tcp sum ok]/[bad tcp cksum ....]
     $opts = $_;   # save this for later 
 
-    split(/ /);
+    split(/ +/);
+    # Sometime after version 3.7.1 tcpdump started to print 'IP'
+    # as the second field in the output. Get rid of it again.
+    splice @_, 1, 1 if $_[1] eq 'IP';
     $time = $_[0];
     $from = $_[1];
     $to = $_[3];
@@ -412,7 +419,7 @@ for ($lineNo = 1; <$Tcpdump>; $lineNo++)
 
 		# print stderr "SACKS after : $sacks \n";
 
-		@sacks = split(/ /, $sacks);
+		@sacks = split(/ +/, $sacks);
 		
 		for ($i = 0; $i <= $#sacks; $i++) {
 		    local($start);