3 # netsniff-ng - the packet sniffing beast
4 # Copyright 2011 Daniel Borkmann <daniel@netsniff-ng.org>
6 # Configuration file generator for trafgen.
7 # Generates RPR Quadrimodal packet distribution (64:50, 512:15, 1518:15, 9218:20)
8 # In lengths the Frame Check Sequence of 4 Byte is not counted
10 # FIXME: http://en.wikipedia.org/wiki/Jumbo_frame#Super_jumbo_frames
11 # As it has been a relatively difficult, and somewhat lengthy, process
12 # to increase the path MTU of high performance national research and
13 # education networks from 1518 bytes to 9000 bytes or so, a subsequent
14 # increase, possibly to 64000 bytes for example, may take some time.
15 # So we use 9000 - 4 in this example instaed of 9218 - 4. RFC!
23 1514 => 15, # 1518 - 4
27 print "# Run in round-robin mode with trafgen!\n";
28 print "# E.g. trafgen --dev eth0 --conf <this-as-file> --bind 0\n\n";
31 foreach (values(%conf)) {
35 for (my $pkt = 0; $pkt < $sum; ++$pkt) {
36 my ($len, $done) = (0, 0);
39 my @list = keys(%conf);
40 my $index = int(rand(scalar(@list)));
41 my $key = $list[$index];
42 if ($conf{$key} > 0) {
50 for (my $byte = 0; $byte < $len;) {
51 for (my $off = 0; $off < 13 && $byte < $len; ++$off, ++$byte) {
52 my $cur = sprintf("0x%02x", int(rand(256)));