fix parsing and pcap generation for packets with multiple output lines

(those that are > 16 bytes).
This commit is contained in:
maralvira 2011-01-17 15:47:08 +00:00
parent d0227afbed
commit d82b004154

View file

@ -59,13 +59,13 @@ while(1) {
#new packet #new packet
($sec, $usec) = gettimeofday; ($sec, $usec) = gettimeofday;
print STDERR "rftestline: $sec $usec $str"; print STDERR "rftestline: $sec $usec $str";
} elsif($str =~ /^\s*data/) { } elsif($str =~ /^\w+/) {
#packet payload #packet payload
print STDERR "dataline: "; print STDERR "dataline: ";
print STDERR $str; print STDERR $str;
$str =~ /data: 0x\d+ (.+)/; chomp $str;
$str =~ /(.+)/;
my @data = split(' ',$1); my @data = split(' ',$1);
($len, @data) = @data;
#write out pcap entry #write out pcap entry
print pack('LLLL',($sec,$usec,scalar(@data),scalar(@data)+2)); print pack('LLLL',($sec,$usec,scalar(@data),scalar(@data)+2));
print STDERR "new packet: $sec $usec " . scalar(@data) . " " . (scalar(@data)+2) . "\n\r"; print STDERR "new packet: $sec $usec " . scalar(@data) . " " . (scalar(@data)+2) . "\n\r";