Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 15abd35bdca97bb1e3249ded3c40a859ca0105ea 1 parent 0df658a
@jlouis authored
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
+
Please sign in to comment.
Something went wrong with that request. Please try again.