Browse files

Add the tools from the original etorrent repo.

The tools can simulate bad networking conditions. This is highly useful
when testing the stack proper.
  • Loading branch information...
1 parent 0df658a commit 15abd35bdca97bb1e3249ded3c40a859ca0105ea @jlouis committed Jun 9, 2012
Showing with 107 additions and 0 deletions.
  1. +26 −0 tools/impose_network.sh
  2. +3 −0 tools/linux_clear.sh
  3. +10 −0 tools/linux_network_1.sh
  4. +10 −0 tools/linux_network_2.sh
  5. +29 −0 tools/really_faulty.sh
  6. +29 −0 tools/slightly_faulty.sh
View
26 tools/impose_network.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+from=${1-127.0.0.1}
+to=${2-127.0.0.1}
+
+ipfw delete 100
+ipfw delete 200
+ipfw delete 300
+ipfw delete 400
+ipfw delete 500
+
+ipfw add 1000 allow all from any to any
+
+ipfw add 100 pipe 10 udp from ${from} to ${to} 3333 in
+ipfw add 200 pipe 20 udp from ${to} 3333 to ${from} out
+
+## Pipes starting with 10 is one way
+ipfw pipe 10 config bw 10Mbit/s
+ipfw pipe 10 config delay 100ms
+ipfw pipe 10 config plr 0.1
+
+## Pipes starting with 20 is the other way
+ipfw pipe 20 config bw 10Mbit/s
+ipfw pipe 20 config delay 100ms
+ipfw pipe 20 config plr 0.1
+
View
3 tools/linux_clear.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+tc qdisc del dev lo root
View
10 tools/linux_network_1.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Traffic-shape a test network
+
+tc qdisc replace dev lo root netem \
+ delay 100ms 20ms distribution normal \
+ reorder 25% 50% \
+ loss 1.5% 25% \
+ duplicate 3%
+
View
10 tools/linux_network_2.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# Traffic-shape a test network
+
+tc qdisc replace dev lo root netem \
+ delay 10ms 5ms distribution normal \
+ reorder 25% 50% \
+ loss 1.5% 25% \
+ duplicate 3%
+
View
29 tools/really_faulty.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+## Create a network where something around the 10th packet are lost.
+## This is a somewhat realistic network condition and it does happen.
+
+from=${1-127.0.0.1}
+to=${2-127.0.0.1}
+
+ipfw delete 100
+ipfw delete 200
+ipfw delete 300
+ipfw delete 400
+ipfw delete 500
+
+ipfw add 1000 allow all from any to any
+
+ipfw add 100 pipe 10 udp from ${from} to ${to} 3333 in
+ipfw add 200 pipe 20 udp from ${to} 3333 to ${from} out
+
+## Pipes starting with 10 is one way
+ipfw pipe 10 config bw 10Mbit/s
+ipfw pipe 10 config delay 100ms
+ipfw pipe 10 config plr 0.1
+
+## Pipes starting with 20 is the other way
+ipfw pipe 20 config bw 10Mbit/s
+ipfw pipe 20 config delay 100ms
+ipfw pipe 20 config plr 0.1
+
View
29 tools/slightly_faulty.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+## Create a network where something around the 100th packet are lost.
+## This is a somewhat realistic network condition and it does happen.
+
+from=${1-127.0.0.1}
+to=${2-127.0.0.1}
+
+ipfw delete 100
+ipfw delete 200
+ipfw delete 300
+ipfw delete 400
+ipfw delete 500
+
+ipfw add 1000 allow all from any to any
+
+ipfw add 100 pipe 10 udp from ${from} to ${to} 3333 in
+ipfw add 200 pipe 20 udp from ${to} 3333 to ${from} out
+
+## Pipes starting with 10 is one way
+ipfw pipe 10 config bw 10Mbit/s
+ipfw pipe 10 config delay 100ms
+ipfw pipe 10 config plr 0.01
+
+## Pipes starting with 20 is the other way
+ipfw pipe 20 config bw 10Mbit/s
+ipfw pipe 20 config delay 100ms
+ipfw pipe 20 config plr 0.01
+

0 comments on commit 15abd35

Please sign in to comment.